87 |
|
TIBXSQLVAR = class(TSQLVarData) |
88 |
|
private |
89 |
|
FStatement: TFB30Statement; |
90 |
+ |
FFirebird30ClientAPI: TFB30ClientAPI; |
91 |
|
FBlob: IBlob; {Cache references} |
92 |
|
FArray: IArray; |
93 |
|
FNullIndicator: short; |
149 |
|
FSize: Integer; {Number of TIBXSQLVARs in column list} |
150 |
|
FMetaData: Firebird.IMessageMetadata; |
151 |
|
FTransactionSeqNo: integer; |
152 |
< |
protected |
152 |
> |
protected |
153 |
|
FStatement: TFB30Statement; |
154 |
+ |
FFirebird30ClientAPI: TFB30ClientAPI; |
155 |
|
function GetTransactionSeqNo: integer; override; |
156 |
|
procedure FreeXSQLDA; virtual; |
157 |
|
function GetStatement: IStatement; override; |
238 |
|
TFB30Statement = class(TFBStatement,IStatement) |
239 |
|
private |
240 |
|
FStatementIntf: Firebird.IStatement; |
241 |
+ |
FFirebird30ClientAPI: TFB30ClientAPI; |
242 |
|
FSQLParams: TIBXINPUTSQLDA; |
243 |
|
FSQLRecord: TIBXOUTPUTSQLDA; |
244 |
|
FResultSet: Firebird.IResultSet; |
249 |
|
procedure InternalPrepare; override; |
250 |
|
function InternalExecute(aTransaction: ITransaction): IResults; override; |
251 |
|
function InternalOpenCursor(aTransaction: ITransaction): IResultSet; override; |
252 |
+ |
procedure ProcessSQL(sql: AnsiString; GenerateParamNames: boolean; var processedSQL: AnsiString); override; |
253 |
|
procedure FreeHandle; override; |
254 |
|
procedure InternalClose(Force: boolean); override; |
255 |
|
public |
300 |
|
|
301 |
|
function TIBXSQLVAR.GetAliasName: AnsiString; |
302 |
|
begin |
303 |
< |
with Firebird30ClientAPI do |
303 |
> |
with FFirebird30ClientAPI do |
304 |
|
begin |
305 |
|
result := strpas(TIBXSQLDA(Parent).MetaData.getAlias(StatusIntf,Index)); |
306 |
|
Check4DataBaseError; |
314 |
|
|
315 |
|
function TIBXSQLVAR.GetOwnerName: AnsiString; |
316 |
|
begin |
317 |
< |
with Firebird30ClientAPI do |
317 |
> |
with FFirebird30ClientAPI do |
318 |
|
begin |
319 |
|
result := strpas(TIBXSQLDA(Parent).MetaData.getOwner(StatusIntf,Index)); |
320 |
|
Check4DataBaseError; |
451 |
|
if not FOwnsSQLData then |
452 |
|
FSQLData := nil; |
453 |
|
FDataLength := len; |
454 |
< |
with Firebird30ClientAPI do |
454 |
> |
with FFirebird30ClientAPI do |
455 |
|
IBAlloc(FSQLData, 0, FDataLength); |
456 |
|
FOwnsSQLData := true; |
457 |
|
Changed; |
473 |
|
begin |
474 |
|
inherited Create(aParent,aIndex); |
475 |
|
FStatement := aParent.Statement; |
476 |
+ |
FFirebird30ClientAPI := aParent.FFirebird30ClientAPI; |
477 |
|
end; |
478 |
|
|
479 |
|
procedure TIBXSQLVAR.RowChange; |
634 |
|
i: integer; |
635 |
|
begin |
636 |
|
if FCurMetaData = nil then |
637 |
< |
with Firebird30ClientAPI do |
637 |
> |
with FFirebird30ClientAPI do |
638 |
|
begin |
639 |
|
Builder := inherited MetaData.getBuilder(StatusIntf); |
640 |
|
Check4DataBaseError; |
667 |
|
BuildMetadata; |
668 |
|
|
669 |
|
if FMsgLength = 0 then |
670 |
< |
with Firebird30ClientAPI do |
670 |
> |
with FFirebird30ClientAPI do |
671 |
|
begin |
672 |
|
FMsgLength := FCurMetaData.getMessageLength(StatusIntf); |
673 |
|
Check4DataBaseError; |
717 |
|
var i: integer; |
718 |
|
begin |
719 |
|
FMetaData := aMetaData; |
720 |
< |
with Firebird30ClientAPI do |
720 |
> |
with FFirebird30ClientAPI do |
721 |
|
begin |
722 |
|
Count := metadata.getCount(StatusIntf); |
723 |
|
Check4DataBaseError; |
795 |
|
var i: integer; |
796 |
|
begin |
797 |
|
FMetaData := aMetaData; |
798 |
< |
with Firebird30ClientAPI do |
798 |
> |
with FFirebird30ClientAPI do |
799 |
|
begin |
800 |
|
Count := metadata.getCount(StatusIntf); |
801 |
|
Check4DataBaseError; |
855 |
|
len := FDataLength; |
856 |
|
if not IsNull and (FSQLType = SQL_VARYING) then |
857 |
|
begin |
858 |
< |
with Firebird30ClientAPI do |
858 |
> |
with FFirebird30ClientAPI do |
859 |
|
len := DecodeInteger(data,2); |
860 |
|
Inc(Data,2); |
861 |
|
end; |
872 |
|
begin |
873 |
|
inherited Create; |
874 |
|
FStatement := aStatement; |
875 |
+ |
FFirebird30ClientAPI := aStatement.FFirebird30ClientAPI; |
876 |
|
FSize := 0; |
877 |
|
// writeln('Creating ',ClassName); |
878 |
|
end; |
989 |
|
procedure TFB30Statement.GetDSQLInfo(info_request: byte; buffer: ISQLInfoResults |
990 |
|
); |
991 |
|
begin |
992 |
< |
with Firebird30ClientAPI, buffer as TSQLInfoResultsBuffer do |
992 |
> |
with FFirebird30ClientAPI, buffer as TSQLInfoResultsBuffer do |
993 |
|
begin |
994 |
|
StatementIntf.getInfo(StatusIntf,1,BytePtr(@info_request), |
995 |
|
GetBufSize, BytePtr(Buffer)); |
1005 |
|
IBError(ibxeEmptyQuery, [nil]); |
1006 |
|
try |
1007 |
|
CheckTransaction(FTransactionIntf); |
1008 |
< |
with Firebird30ClientAPI do |
1008 |
> |
with FFirebird30ClientAPI do |
1009 |
|
begin |
1010 |
|
if FHasParamNames then |
1011 |
|
begin |
1012 |
|
if FProcessedSQL = '' then |
1013 |
< |
FSQLParams.PreprocessSQL(FSQL,FGenerateParamNames,FProcessedSQL); |
1013 |
> |
ProcessSQL(FSQL,FGenerateParamNames,FProcessedSQL); |
1014 |
|
FStatementIntf := (GetAttachment as TFB30Attachment).AttachmentIntf.prepare(StatusIntf, |
1015 |
|
(FTransactionIntf as TFB30Transaction).TransactionIntf, |
1016 |
|
Length(FProcessedSQL), |
1102 |
|
IBError(ibxeInterfaceOutofDate,[nil]); |
1103 |
|
|
1104 |
|
try |
1105 |
< |
with Firebird30ClientAPI do |
1105 |
> |
with FFirebird30ClientAPI do |
1106 |
|
begin |
1107 |
|
if FCollectStatistics then |
1108 |
|
begin |
1152 |
|
RemoveMonitor(aTransaction as TFB30Transaction); |
1153 |
|
end; |
1154 |
|
FExecTransactionIntf := aTransaction; |
1155 |
+ |
FSQLRecord.FTransaction := (aTransaction as TFB30Transaction); |
1156 |
+ |
FSQLRecord.FTransactionSeqNo := FSQLRecord.FTransaction.TransactionSeqNo; |
1157 |
|
SignalActivity; |
1158 |
|
Inc(FChangeSeqNo); |
1159 |
|
end; |
1173 |
|
if (FSQLParams.FTransactionSeqNo < (FTransactionIntf as TFB30transaction).TransactionSeqNo) then |
1174 |
|
IBError(ibxeInterfaceOutofDate,[nil]); |
1175 |
|
|
1176 |
< |
with Firebird30ClientAPI do |
1176 |
> |
with FFirebird30ClientAPI do |
1177 |
|
begin |
1178 |
|
if FCollectStatistics then |
1179 |
|
begin |
1213 |
|
Inc(FChangeSeqNo); |
1214 |
|
end; |
1215 |
|
|
1216 |
+ |
procedure TFB30Statement.ProcessSQL(sql: AnsiString; GenerateParamNames: boolean; |
1217 |
+ |
var processedSQL: AnsiString); |
1218 |
+ |
begin |
1219 |
+ |
FSQLParams.PreprocessSQL(sql,GenerateParamNames,processedSQL); |
1220 |
+ |
end; |
1221 |
+ |
|
1222 |
|
procedure TFB30Statement.FreeHandle; |
1223 |
|
begin |
1224 |
|
Close; |
1235 |
|
begin |
1236 |
|
if (FStatementIntf <> nil) and (SQLStatementType = SQLSelect) and FOpen then |
1237 |
|
try |
1238 |
< |
with Firebird30ClientAPI do |
1238 |
> |
with FFirebird30ClientAPI do |
1239 |
|
begin |
1240 |
|
if FResultSet <> nil then |
1241 |
|
begin |
1263 |
|
Transaction: ITransaction; sql: AnsiString; aSQLDialect: integer); |
1264 |
|
begin |
1265 |
|
inherited Create(Attachment,Transaction,sql,aSQLDialect); |
1266 |
+ |
FFirebird30ClientAPI := Attachment.Firebird30ClientAPI; |
1267 |
|
FSQLParams := TIBXINPUTSQLDA.Create(self); |
1268 |
|
FSQLRecord := TIBXOUTPUTSQLDA.Create(self); |
1269 |
|
InternalPrepare; |
1274 |
|
aSQLDialect: integer; GenerateParamNames: boolean); |
1275 |
|
begin |
1276 |
|
inherited CreateWithParameterNames(Attachment,Transaction,sql,aSQLDialect,GenerateParamNames); |
1277 |
+ |
FFirebird30ClientAPI := Attachment.Firebird30ClientAPI; |
1278 |
|
FSQLParams := TIBXINPUTSQLDA.Create(self); |
1279 |
|
FSQLRecord := TIBXOUTPUTSQLDA.Create(self); |
1280 |
|
InternalPrepare; |
1296 |
|
if FEOF then |
1297 |
|
IBError(ibxeEOF,[nil]); |
1298 |
|
|
1299 |
< |
with Firebird30ClientAPI do |
1299 |
> |
with FFirebird30ClientAPI do |
1300 |
|
begin |
1301 |
|
{ Go to the next record... } |
1302 |
|
fetchResult := FResultSet.fetchNext(StatusIntf,FSQLRecord.MessageBuffer); |
1321 |
|
FBOF := false; |
1322 |
|
result := true; |
1323 |
|
end; |
1324 |
+ |
if FCollectStatistics then |
1325 |
+ |
begin |
1326 |
+ |
UtilIntf.getPerfCounters(StatusIntf, |
1327 |
+ |
(GetAttachment as TFB30Attachment).AttachmentIntf, |
1328 |
+ |
ISQL_COUNTERS,@FAfterStats); |
1329 |
+ |
Check4DataBaseError; |
1330 |
+ |
FStatisticsAvailable := true; |
1331 |
+ |
end; |
1332 |
|
end; |
1333 |
|
FSQLRecord.RowChange; |
1334 |
|
SignalActivity; |
1360 |
|
SQLUpdate, SQLDelete])) then |
1361 |
|
result := '' |
1362 |
|
else |
1363 |
< |
with Firebird30ClientAPI do |
1363 |
> |
with FFirebird30ClientAPI do |
1364 |
|
begin |
1365 |
|
Result := FStatementIntf.getPlan(StatusIntf,true); |
1366 |
|
Check4DataBaseError; |