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

Comparing ibx/trunk/fbintf/client/3.0/FB30Statement.pas (file contents):
Revision 262 by tony, Wed Mar 14 12:48:51 2018 UTC vs.
Revision 263 by tony, Thu Dec 6 15:55:01 2018 UTC

# Line 87 | Line 87 | type
87    TIBXSQLVAR = class(TSQLVarData)
88    private
89      FStatement: TFB30Statement;
90 +    FFirebird30ClientAPI: TFB30ClientAPI;
91      FBlob: IBlob;             {Cache references}
92      FArray: IArray;
93      FNullIndicator: short;
# Line 148 | Line 149 | type
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;
# Line 236 | Line 238 | type
238    TFB30Statement = class(TFBStatement,IStatement)
239    private
240      FStatementIntf: Firebird.IStatement;
241 +    FFirebird30ClientAPI: TFB30ClientAPI;
242      FSQLParams: TIBXINPUTSQLDA;
243      FSQLRecord: TIBXOUTPUTSQLDA;
244      FResultSet: Firebird.IResultSet;
# Line 246 | Line 249 | type
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
# Line 296 | Line 300 | end;
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;
# Line 310 | Line 314 | end;
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;
# Line 447 | Line 451 | begin
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;
# Line 469 | Line 473 | constructor TIBXSQLVAR.Create(aParent: T
473   begin
474    inherited Create(aParent,aIndex);
475    FStatement := aParent.Statement;
476 +  FFirebird30ClientAPI := aParent.FFirebird30ClientAPI;
477   end;
478  
479   procedure TIBXSQLVAR.RowChange;
# Line 629 | Line 634 | var Builder: Firebird.IMetadataBuilder;
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;
# Line 662 | Line 667 | begin
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;
# Line 712 | Line 717 | procedure TIBXINPUTSQLDA.Bind(aMetaData:
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;
# Line 790 | Line 795 | procedure TIBXOUTPUTSQLDA.Bind(aMetaData
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;
# Line 850 | Line 855 | begin
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;
# Line 867 | Line 872 | constructor TIBXSQLDA.Create(aStatement:
872   begin
873    inherited Create;
874    FStatement := aStatement;
875 +  FFirebird30ClientAPI := aStatement.FFirebird30ClientAPI;
876    FSize := 0;
877   //  writeln('Creating ',ClassName);
878   end;
# Line 983 | Line 989 | 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));
# Line 999 | Line 1005 | begin
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),
# Line 1096 | Line 1102 | begin
1102      IBError(ibxeInterfaceOutofDate,[nil]);
1103  
1104    try
1105 <    with Firebird30ClientAPI do
1105 >    with FFirebird30ClientAPI do
1106      begin
1107        if FCollectStatistics then
1108        begin
# Line 1167 | Line 1173 | begin
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
# Line 1207 | Line 1213 | 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;
# Line 1223 | Line 1235 | procedure TFB30Statement.InternalClose(F
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
# Line 1251 | Line 1263 | constructor TFB30Statement.Create(Attach
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;
# Line 1261 | Line 1274 | constructor TFB30Statement.CreateWithPar
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;
# Line 1282 | Line 1296 | begin
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);
# Line 1346 | Line 1360 | begin
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines