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

Comparing ibx/trunk/fbintf/client/3.0/FB30Statement.pas (file contents):
Revision 209 by tony, Wed Mar 14 12:48:51 2018 UTC vs.
Revision 270 by tony, Fri Jan 18 11:10:37 2019 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
256      constructor Create(Attachment: TFB30Attachment; Transaction: ITransaction;
257        sql: AnsiString; aSQLDialect: integer);
258      constructor CreateWithParameterNames(Attachment: TFB30Attachment; Transaction: ITransaction;
259 <      sql: AnsiString;  aSQLDialect: integer; GenerateParamNames: boolean =false);
259 >      sql: AnsiString;  aSQLDialect: integer; GenerateParamNames: boolean =false;
260 >      CaseSensitiveParams: boolean=false);
261      destructor Destroy; override;
262      function FetchNext: boolean;
263      property StatementIntf: Firebird.IStatement read FStatementIntf;
# Line 296 | Line 301 | end;
301  
302   function TIBXSQLVAR.GetAliasName: AnsiString;
303   begin
304 <  with Firebird30ClientAPI do
304 >  with FFirebird30ClientAPI do
305    begin
306      result := strpas(TIBXSQLDA(Parent).MetaData.getAlias(StatusIntf,Index));
307      Check4DataBaseError;
# Line 310 | Line 315 | end;
315  
316   function TIBXSQLVAR.GetOwnerName: AnsiString;
317   begin
318 <  with Firebird30ClientAPI do
318 >  with FFirebird30ClientAPI do
319    begin
320      result := strpas(TIBXSQLDA(Parent).MetaData.getOwner(StatusIntf,Index));
321      Check4DataBaseError;
# Line 447 | Line 452 | begin
452    if not FOwnsSQLData then
453      FSQLData := nil;
454    FDataLength := len;
455 <  with Firebird30ClientAPI do
455 >  with FFirebird30ClientAPI do
456      IBAlloc(FSQLData, 0, FDataLength);
457    FOwnsSQLData := true;
458    Changed;
# Line 469 | Line 474 | constructor TIBXSQLVAR.Create(aParent: T
474   begin
475    inherited Create(aParent,aIndex);
476    FStatement := aParent.Statement;
477 +  FFirebird30ClientAPI := aParent.FFirebird30ClientAPI;
478   end;
479  
480   procedure TIBXSQLVAR.RowChange;
# Line 629 | Line 635 | var Builder: Firebird.IMetadataBuilder;
635      i: integer;
636   begin
637    if FCurMetaData = nil then
638 <  with Firebird30ClientAPI do
638 >  with FFirebird30ClientAPI do
639    begin
640      Builder := inherited MetaData.getBuilder(StatusIntf);
641      Check4DataBaseError;
# Line 662 | Line 668 | begin
668    BuildMetadata;
669  
670    if FMsgLength = 0 then
671 <  with Firebird30ClientAPI do
671 >  with FFirebird30ClientAPI do
672    begin
673      FMsgLength := FCurMetaData.getMessageLength(StatusIntf);
674      Check4DataBaseError;
# Line 712 | Line 718 | procedure TIBXINPUTSQLDA.Bind(aMetaData:
718   var i: integer;
719   begin
720    FMetaData := aMetaData;
721 <  with Firebird30ClientAPI do
721 >  with FFirebird30ClientAPI do
722    begin
723      Count := metadata.getCount(StatusIntf);
724      Check4DataBaseError;
# Line 790 | Line 796 | procedure TIBXOUTPUTSQLDA.Bind(aMetaData
796   var i: integer;
797   begin
798    FMetaData := aMetaData;
799 <  with Firebird30ClientAPI do
799 >  with FFirebird30ClientAPI do
800    begin
801      Count := metadata.getCount(StatusIntf);
802      Check4DataBaseError;
# Line 850 | Line 856 | begin
856      len := FDataLength;
857      if not IsNull and (FSQLType = SQL_VARYING) then
858      begin
859 <      with Firebird30ClientAPI do
859 >      with FFirebird30ClientAPI do
860          len := DecodeInteger(data,2);
861        Inc(Data,2);
862      end;
# Line 867 | Line 873 | constructor TIBXSQLDA.Create(aStatement:
873   begin
874    inherited Create;
875    FStatement := aStatement;
876 +  FFirebird30ClientAPI := aStatement.FFirebird30ClientAPI;
877    FSize := 0;
878   //  writeln('Creating ',ClassName);
879   end;
# Line 983 | Line 990 | end;
990   procedure TFB30Statement.GetDSQLInfo(info_request: byte; buffer: ISQLInfoResults
991    );
992   begin
993 <  with Firebird30ClientAPI, buffer as TSQLInfoResultsBuffer do
993 >  with FFirebird30ClientAPI, buffer as TSQLInfoResultsBuffer do
994    begin
995      StatementIntf.getInfo(StatusIntf,1,BytePtr(@info_request),
996                       GetBufSize, BytePtr(Buffer));
# Line 999 | Line 1006 | begin
1006      IBError(ibxeEmptyQuery, [nil]);
1007    try
1008      CheckTransaction(FTransactionIntf);
1009 <    with Firebird30ClientAPI do
1009 >    with FFirebird30ClientAPI do
1010      begin
1011        if FHasParamNames then
1012        begin
1013          if FProcessedSQL = '' then
1014 <          FSQLParams.PreprocessSQL(FSQL,FGenerateParamNames,FProcessedSQL);
1014 >          ProcessSQL(FSQL,FGenerateParamNames,FProcessedSQL);
1015          FStatementIntf := (GetAttachment as TFB30Attachment).AttachmentIntf.prepare(StatusIntf,
1016                              (FTransactionIntf as TFB30Transaction).TransactionIntf,
1017                              Length(FProcessedSQL),
# Line 1096 | Line 1103 | begin
1103      IBError(ibxeInterfaceOutofDate,[nil]);
1104  
1105    try
1106 <    with Firebird30ClientAPI do
1106 >    with FFirebird30ClientAPI do
1107      begin
1108        if FCollectStatistics then
1109        begin
# Line 1167 | Line 1174 | begin
1174    if (FSQLParams.FTransactionSeqNo < (FTransactionIntf as TFB30transaction).TransactionSeqNo) then
1175      IBError(ibxeInterfaceOutofDate,[nil]);
1176  
1177 < with Firebird30ClientAPI do
1177 > with FFirebird30ClientAPI do
1178   begin
1179     if FCollectStatistics then
1180     begin
# Line 1207 | Line 1214 | begin
1214   Inc(FChangeSeqNo);
1215   end;
1216  
1217 + procedure TFB30Statement.ProcessSQL(sql: AnsiString; GenerateParamNames: boolean;
1218 +  var processedSQL: AnsiString);
1219 + begin
1220 +  FSQLParams.PreprocessSQL(sql,GenerateParamNames,processedSQL);
1221 + end;
1222 +
1223   procedure TFB30Statement.FreeHandle;
1224   begin
1225    Close;
# Line 1223 | Line 1236 | procedure TFB30Statement.InternalClose(F
1236   begin
1237    if (FStatementIntf <> nil) and (SQLStatementType = SQLSelect) and FOpen then
1238    try
1239 <    with Firebird30ClientAPI do
1239 >    with FFirebird30ClientAPI do
1240      begin
1241        if FResultSet <> nil then
1242        begin
# Line 1251 | Line 1264 | constructor TFB30Statement.Create(Attach
1264    Transaction: ITransaction; sql: AnsiString; aSQLDialect: integer);
1265   begin
1266    inherited Create(Attachment,Transaction,sql,aSQLDialect);
1267 +  FFirebird30ClientAPI := Attachment.Firebird30ClientAPI;
1268    FSQLParams := TIBXINPUTSQLDA.Create(self);
1269    FSQLRecord := TIBXOUTPUTSQLDA.Create(self);
1270    InternalPrepare;
# Line 1258 | Line 1272 | end;
1272  
1273   constructor TFB30Statement.CreateWithParameterNames(
1274    Attachment: TFB30Attachment; Transaction: ITransaction; sql: AnsiString;
1275 <  aSQLDialect: integer; GenerateParamNames: boolean);
1275 >  aSQLDialect: integer; GenerateParamNames: boolean;
1276 >  CaseSensitiveParams: boolean);
1277   begin
1278    inherited CreateWithParameterNames(Attachment,Transaction,sql,aSQLDialect,GenerateParamNames);
1279 +  FFirebird30ClientAPI := Attachment.Firebird30ClientAPI;
1280    FSQLParams := TIBXINPUTSQLDA.Create(self);
1281 +  FSQLParams.CaseSensitiveParams := CaseSensitiveParams;
1282    FSQLRecord := TIBXOUTPUTSQLDA.Create(self);
1283    InternalPrepare;
1284   end;
# Line 1282 | Line 1299 | begin
1299    if FEOF then
1300      IBError(ibxeEOF,[nil]);
1301  
1302 <  with Firebird30ClientAPI do
1302 >  with FFirebird30ClientAPI do
1303    begin
1304      { Go to the next record... }
1305      fetchResult := FResultSet.fetchNext(StatusIntf,FSQLRecord.MessageBuffer);
# Line 1346 | Line 1363 | begin
1363         SQLUpdate, SQLDelete])) then
1364      result := ''
1365    else
1366 <  with Firebird30ClientAPI do
1366 >  with FFirebird30ClientAPI do
1367    begin
1368      Result := FStatementIntf.getPlan(StatusIntf,true);
1369      Check4DataBaseError;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines