56 |
|
FPrepared: Boolean; |
57 |
|
FParams: TParams; |
58 |
|
FText: string; |
59 |
– |
FRowsAffected: Integer; |
60 |
– |
FCheckRowsAffected: Boolean; |
59 |
|
FSQLUpdating: boolean; |
60 |
|
FInQueryChanged: boolean; |
61 |
|
function GetRowsAffected: Integer; |
69 |
|
procedure SetPrepared(Value: Boolean); |
70 |
|
procedure SetPrepare(Value: Boolean); |
71 |
|
procedure WriteParamData(Writer: TWriter); |
72 |
< |
function GetStmtHandle: TISC_STMT_HANDLE; |
72 |
> |
function GetStmtHandle: IStatement; |
73 |
|
procedure UpdateSQL; |
74 |
|
|
75 |
|
protected |
103 |
|
procedure ResetParser; override; |
104 |
|
property Prepared: Boolean read FPrepared write SetPrepare; |
105 |
|
property ParamCount: Word read GetParamsCount; |
106 |
< |
property StmtHandle: TISC_STMT_HANDLE read GetStmtHandle; |
106 |
> |
property StmtHandle: IStatement read GetStmtHandle; |
107 |
|
property StatementType; |
108 |
|
property Text: string read FText; |
109 |
|
property RowsAffected: Integer read GetRowsAffected; |
135 |
|
property TransactionFree; |
136 |
|
property OnFilterRecord; |
137 |
|
property OnValidatePost; |
138 |
+ |
property OnDeleteReturning; |
139 |
|
end; |
140 |
|
|
141 |
|
implementation |
142 |
|
|
143 |
+ |
uses FBMessages; |
144 |
+ |
|
145 |
|
{ TIBQuery } |
146 |
|
|
147 |
|
constructor TIBQuery.Create(AOwner: TComponent); |
151 |
|
TStringList(SQL).OnChange := QueryChanged; |
152 |
|
FParams := TParams.Create(Self); |
153 |
|
ParamCheck := True; |
153 |
– |
FRowsAffected := -1; |
154 |
|
end; |
155 |
|
|
156 |
|
destructor TIBQuery.Destroy; |
295 |
|
begin |
296 |
|
if Value then |
297 |
|
begin |
298 |
– |
FRowsAffected := -1; |
299 |
– |
FCheckRowsAffected := True; |
298 |
|
if Length(Text) > 1 then PrepareSQL |
299 |
|
else IBError(ibxeEmptySQLStatement, [nil]); |
300 |
|
end |
301 |
|
else |
302 |
|
begin |
305 |
– |
if FCheckRowsAffected then |
306 |
– |
FRowsAffected := RowsAffected; |
303 |
|
InternalUnPrepare; |
304 |
|
FParams.Clear; |
305 |
|
end; |
372 |
|
begin |
373 |
|
CheckInActive; |
374 |
|
if SQL.Count <= 0 then |
379 |
– |
begin |
380 |
– |
FCheckRowsAffected := False; |
375 |
|
IBError(ibxeEmptySQLStatement, [nil]); |
376 |
< |
end; |
376 |
> |
|
377 |
|
ActivateConnection(); |
378 |
|
DidActivate := ActivateTransaction; |
379 |
|
try |
384 |
|
finally |
385 |
|
if DidActivate then |
386 |
|
DeactivateTransaction; |
393 |
– |
FCheckRowsAffected := True; |
387 |
|
end; |
388 |
|
end; |
389 |
|
|
392 |
|
var |
393 |
|
i : integer; |
394 |
|
Buffer: Pointer; |
395 |
< |
SQLParam: TIBXSQLVAR; |
395 |
> |
SQLParam: ISQLParam; |
396 |
|
|
397 |
|
begin |
398 |
|
for I := 0 to FParams.Count - 1 do |
495 |
|
AddFieldToList(Params[i].Name, Self, DetailFields); |
496 |
|
end; |
497 |
|
|
498 |
< |
function TIBQuery.GetStmtHandle: TISC_STMT_HANDLE; |
498 |
> |
function TIBQuery.GetStmtHandle: IStatement; |
499 |
|
begin |
500 |
|
Result := SelectStmtHandle; |
501 |
|
end; |
502 |
|
|
503 |
|
procedure TIBQuery.UpdateSQL; |
504 |
|
begin |
505 |
< |
if not FSQLUpdating and not FInQueryChanged then |
505 |
> |
if not FSQLUpdating and not FInQueryChanged and (SQL.Text <> SelectSQL.Text) then |
506 |
|
begin |
507 |
|
FSQLUpdating := true; |
508 |
|
try |