ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/journaling/fbintf/client/FBStatement.pas
(Generate patch)

Comparing:
ibx/trunk/fbintf/client/FBStatement.pas (file contents), Revision 350 by tony, Wed Oct 20 14:58:56 2021 UTC vs.
ibx/branches/journaling/fbintf/client/FBStatement.pas (file contents), Revision 363 by tony, Tue Dec 7 13:30:05 2021 UTC

# Line 82 | Line 82 | type
82      procedure CheckChangeBatchRowLimit; virtual;
83      procedure CheckHandle; virtual; abstract;
84      procedure CheckTransaction(aTransaction: ITransaction);
85 +    procedure DoJournaling;
86 +    function GetJournalIntf: IJournallingHook;
87 +    function GetStatementIntf: IStatement; virtual; abstract;
88      procedure GetDsqlInfo(info_request: byte; buffer: ISQLInfoResults); overload; virtual; abstract;
89      procedure InternalPrepare(CursorName: AnsiString='');  virtual; abstract;
90      function InternalExecute(Transaction: ITransaction): IResults;  virtual; abstract;
# Line 112 | Line 115 | type
115      function GetSQLText: AnsiString;
116      function GetProcessedSQLText: AnsiString;
117      function GetSQLDialect: integer;
118 +    function GetFlags: TStatementFlags; virtual;
119  
120      {GetDSQLInfo only supports isc_info_sql_stmt_type, isc_info_sql_get_plan, isc_info_sql_records}
121      procedure Prepare(aTransaction: ITransaction=nil);  overload;
# Line 170 | Line 174 | begin
174      IBError(ibxeNotInTransaction,[]);
175   end;
176  
177 + procedure TFBStatement.DoJournaling;
178 +  function doGetRowsAffected: integer;
179 +  var a,i,u,d: integer;
180 +  begin
181 +    GetRowsAffected(a,i,u,d);
182 +    Result := i + u + d;
183 +  end;
184 +
185 + var RowsAffected: integer;
186 + begin
187 +  RowsAffected := doGetRowsAffected;
188 +  with GetAttachment do
189 +    if JournalingActive and
190 +      (((joReadOnlyQueries in GetJournalOptions) and (RowsAffected = 0)) or
191 +      ((joModifyQueries in GetJournalOptions) and (RowsAffected > 0))) then
192 +      GetJournalIntf.ExecQuery(GetStatementIntf);
193 + end;
194 +
195 + function TFBStatement.GetJournalIntf: IJournallingHook;
196 + begin
197 +  GetAttachment.QueryInterface(IJournallingHook,Result)
198 + end;
199 +
200   function TFBStatement.TimeStampToMSecs(const TimeStamp: TTimeStamp): Int64;
201   begin
202    Result := TimeStamp.Time + Int64(timestamp.date)*msecsperday;
# Line 289 | Line 316 | end;
316  
317   function TFBStatement.GetProcessedSQLText: AnsiString;
318   begin
319 <  if FProcessedSQL = '' then
320 <    ProcessSQL(FSQL,FGenerateParamNames,FProcessedSQL);
321 <  Result := FProcessedSQL
319 >  if not FHasParamNames then
320 >    Result := FSQL
321 >  else
322 >  begin
323 >    if FProcessedSQL = '' then
324 >      ProcessSQL(FSQL,FGenerateParamNames,FProcessedSQL);
325 >    Result := FProcessedSQL;
326 >  end;
327   end;
328  
329   function TFBStatement.GetSQLDialect: integer;
# Line 299 | Line 331 | begin
331    Result := FSQLDialect;
332   end;
333  
334 + function TFBStatement.GetFlags: TStatementFlags;
335 + begin
336 +  Result := [];
337 + end;
338 +
339   procedure TFBStatement.Prepare(aTransaction: ITransaction);
340   begin
341    Prepare('',aTransaction);
# Line 323 | Line 360 | begin
360      Result :=  InternalExecute(FTransactionIntf)
361    else
362      Result := InternalExecute(aTransaction);
363 +  DoJournaling;
364   end;
365  
366   procedure TFBStatement.AddToBatch;
# Line 380 | Line 418 | begin
418      Result := InternalOpenCursor(FTransactionIntf,Scrollable)
419    else
420      Result := InternalOpenCursor(aTransaction,Scrollable);
421 +  DoJournaling;
422   end;
423  
424   function TFBStatement.CreateBlob(paramName: AnsiString): IBlob;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines