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; virtual; abstract; |
89 |
> |
procedure InternalPrepare(CursorName: AnsiString=''); virtual; abstract; |
90 |
|
function InternalExecute(Transaction: ITransaction): IResults; virtual; abstract; |
91 |
< |
function InternalOpenCursor(aTransaction: ITransaction): IResultSet; virtual; abstract; |
91 |
> |
function InternalOpenCursor(aTransaction: ITransaction; Scrollable: boolean): IResultSet; virtual; abstract; |
92 |
|
procedure ProcessSQL(sql: AnsiString; GenerateParamNames: boolean; var processedSQL: AnsiString); virtual; abstract; |
93 |
|
procedure FreeHandle; virtual; abstract; |
94 |
|
procedure InternalClose(Force: boolean); virtual; abstract; |
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); virtual; |
121 |
> |
procedure Prepare(aTransaction: ITransaction=nil); overload; |
122 |
> |
procedure Prepare(CursorName: AnsiString; aTransaction: ITransaction=nil); overload; virtual; |
123 |
|
function Execute(aTransaction: ITransaction=nil): IResults; |
124 |
< |
function OpenCursor(aTransaction: ITransaction=nil): IResultSet; |
124 |
> |
function OpenCursor(aTransaction: ITransaction=nil): IResultSet; overload; |
125 |
> |
function OpenCursor(Scrollable: boolean; aTransaction: ITransaction=nil): IResultSet; overload; |
126 |
|
function CreateBlob(paramName: AnsiString): IBlob; overload; |
127 |
|
function CreateBlob(index: integer): IBlob; overload; |
128 |
|
function CreateBlob(column: TColumnMetaData): IBlob; overload; virtual; abstract; |
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; |
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; |
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); |
342 |
+ |
end; |
343 |
+ |
|
344 |
+ |
procedure TFBStatement.Prepare(CursorName: AnsiString; |
345 |
+ |
aTransaction: ITransaction); |
346 |
+ |
begin |
347 |
|
if FPrepared then FreeHandle; |
348 |
|
if aTransaction <> nil then |
349 |
|
begin |
351 |
|
FTransactionIntf := aTransaction; |
352 |
|
AddMonitor(FTransactionIntf as TFBTransaction); |
353 |
|
end; |
354 |
< |
InternalPrepare; |
354 |
> |
InternalPrepare(CursorName); |
355 |
|
end; |
356 |
|
|
357 |
|
function TFBStatement.Execute(aTransaction: ITransaction): IResults; |
360 |
|
Result := InternalExecute(FTransactionIntf) |
361 |
|
else |
362 |
|
Result := InternalExecute(aTransaction); |
363 |
+ |
DoJournaling; |
364 |
|
end; |
365 |
|
|
366 |
|
procedure TFBStatement.AddToBatch; |
407 |
|
|
408 |
|
function TFBStatement.OpenCursor(aTransaction: ITransaction): IResultSet; |
409 |
|
begin |
410 |
+ |
Result := OpenCursor(false,aTransaction); |
411 |
+ |
end; |
412 |
+ |
|
413 |
+ |
function TFBStatement.OpenCursor(Scrollable: boolean; aTransaction: ITransaction |
414 |
+ |
): IResultSet; |
415 |
+ |
begin |
416 |
|
Close; |
417 |
|
if aTransaction = nil then |
418 |
< |
Result := InternalOpenCursor(FTransactionIntf) |
418 |
> |
Result := InternalOpenCursor(FTransactionIntf,Scrollable) |
419 |
|
else |
420 |
< |
Result := InternalOpenCursor(aTransaction); |
420 |
> |
Result := InternalOpenCursor(aTransaction,Scrollable); |
421 |
> |
DoJournaling; |
422 |
|
end; |
423 |
|
|
424 |
|
function TFBStatement.CreateBlob(paramName: AnsiString): IBlob; |