58 |
|
FSQLUpdating: boolean; |
59 |
|
FInQueryChanged: boolean; |
60 |
|
function GetRowsAffected: Integer; |
61 |
+ |
function ParseSQL(ParamList: TParams; SQL: string; DoClear: boolean): string; |
62 |
|
procedure PrepareSQL; |
63 |
|
procedure QueryChanged(Sender: TObject); |
64 |
|
procedure ReadParamData(Reader: TReader); |
115 |
|
property AutoCommit; |
116 |
|
property BufferChunks; |
117 |
|
property CachedUpdates; |
118 |
+ |
property CaseSensitiveParameterNames; |
119 |
|
property DataSource read GetDataSource write SetDataSource; |
120 |
|
property EnableStatistics; |
121 |
|
property GenerateParamNames; |
143 |
|
|
144 |
|
implementation |
145 |
|
|
146 |
< |
uses FBMessages; |
146 |
> |
uses FBMessages, IBUtils; |
147 |
|
|
148 |
|
{ TIBQuery } |
149 |
|
|
235 |
|
begin |
236 |
|
Disconnect; |
237 |
|
if csDesigning in ComponentState then |
238 |
< |
FText := FParams.ParseSQL(SQL.Text, true) |
238 |
> |
FText := ParseSQL(FParams,SQL.Text, true) |
239 |
|
else |
240 |
|
FText := SQL.Text; |
241 |
|
DataEvent(dePropertyChange, 0); |
242 |
|
end else |
243 |
< |
FText := FParams.ParseSQL(SQL.Text, true); |
243 |
> |
FText := ParseSQL(FParams,SQL.Text, true); |
244 |
|
|
245 |
|
if not FSQLUpdating then |
246 |
|
begin |
353 |
|
|
354 |
|
|
355 |
|
function TIBQuery.ParamByName(const Value: string): TParam; |
356 |
+ |
var i: integer; |
357 |
|
begin |
358 |
|
if not Prepared then |
359 |
|
Prepare; |
360 |
< |
Result := FParams.ParamByName(Value); |
360 |
> |
Result := nil; |
361 |
> |
if not CaseSensitiveParameterNames then |
362 |
> |
Result := FParams.ParamByName(Value) |
363 |
> |
else |
364 |
> |
begin |
365 |
> |
i := FParams.Count - 1; |
366 |
> |
while (Result = nil) and (i >= 0) do |
367 |
> |
if CompareStr(Value,FParams.Items[i].Name) = 0 then |
368 |
> |
Result := FParams.Items[i] |
369 |
> |
else |
370 |
> |
Dec(i); |
371 |
> |
if Result = nil then |
372 |
> |
IBError(ibxeParameterNameNotFound,[Value]); |
373 |
> |
end; |
374 |
|
end; |
375 |
|
|
376 |
|
procedure TIBQuery.BatchInput(InputObject: TIBBatchInput); |
469 |
|
begin |
470 |
|
List := TParams.Create(Self); |
471 |
|
try |
472 |
< |
FText := List.ParseSQL(SQL.Text, True); |
472 |
> |
FText := ParseSQL(List,SQL.Text, True); |
473 |
|
List.AssignValues(FParams); |
474 |
|
FParams.Clear; |
475 |
|
FParams.Assign(List); |
487 |
|
Result := QSelect.RowsAffected |
488 |
|
end; |
489 |
|
|
490 |
+ |
function TIBQuery.ParseSQL(ParamList: TParams; SQL: string; DoClear: boolean |
491 |
+ |
): string; |
492 |
+ |
var ParamNames: TStrings; |
493 |
+ |
i: integer; |
494 |
+ |
begin |
495 |
+ |
ParamNames := TStringList.Create; |
496 |
+ |
try |
497 |
+ |
Result := TSQLParamProcessor.Execute(SQL,GenerateParamNames,ParamNames); |
498 |
+ |
if DoClear then ParamList.Clear; |
499 |
+ |
for i := 0 to ParamNames.Count - 1 do |
500 |
+ |
begin |
501 |
+ |
if not CaseSensitiveParameterNames then |
502 |
+ |
ParamNames[i] := AnsiUpperCase(ParamNames[i]); |
503 |
+ |
if ParamList.FindParam(ParamNames[i]) = nil then |
504 |
+ |
ParamList.CreateParam(ftUnknown, ParamNames[i], ptInput); |
505 |
+ |
end; |
506 |
+ |
finally |
507 |
+ |
ParamNames.Free |
508 |
+ |
end; |
509 |
+ |
end; |
510 |
+ |
|
511 |
|
|
512 |
|
procedure TIBQuery.GetDetailLinkFields(MasterFields, DetailFields: TList); |
513 |
|
|