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 56 by tony, Mon Mar 6 10:20:02 2017 UTC vs.
Revision 270 by tony, Fri Jan 18 11:10:37 2019 UTC

# Line 45 | Line 45 | uses
45    FBTransaction;
46  
47   type
48 <  TPerfStatistics = array[psCurrentMemory..psFetches] of comp;
48 >  TPerfStatistics = array[psCurrentMemory..psFetches] of Int64;
49  
50    { TFBStatement }
51  
52    TFBStatement = class(TActivityReporter)
53    private
54      FAttachmentIntf: IAttachment;
55 +    FFirebirdClientAPI: TFBClientAPI;
56    protected
57      FTransactionIntf: ITransaction;
58      FExecTransactionIntf: ITransaction;
# Line 72 | Line 73 | type
73      FStatisticsAvailable: boolean;
74      FBeforeStats: TPerfStatistics;
75      FAfterStats: TPerfStatistics;
76 +    FCaseSensitiveParams: boolean;
77      procedure CheckHandle; virtual; abstract;
78      procedure CheckTransaction(aTransaction: ITransaction);
79      procedure GetDsqlInfo(info_request: byte; buffer: ISQLInfoResults); overload; virtual; abstract;
80      procedure InternalPrepare;  virtual; abstract;
81      function InternalExecute(aTransaction: ITransaction): IResults;  virtual; abstract;
82      function InternalOpenCursor(aTransaction: ITransaction): IResultSet;   virtual; abstract;
83 +    procedure ProcessSQL(sql: AnsiString; GenerateParamNames: boolean; var processedSQL: AnsiString); virtual; abstract;
84      procedure FreeHandle;  virtual; abstract;
85      procedure InternalClose(Force: boolean); virtual; abstract;
86 +    function TimeStampToMSecs(const TimeStamp: TTimeStamp): Int64;
87    public
88      constructor Create(Attachment: IAttachment; Transaction: ITransaction;
89        sql: AnsiString; SQLDialect: integer);
90      constructor CreateWithParameterNames(Attachment: IAttachment; Transaction: ITransaction;
91 <      sql: AnsiString;  SQLDialect: integer; GenerateParamNames: boolean =false);
91 >      sql: AnsiString;  SQLDialect: integer; GenerateParamNames: boolean =false;
92 >      CaseSensitiveParams: boolean = false);
93      destructor Destroy; override;
94      procedure Close;
95      procedure TransactionEnding(aTransaction: ITransaction; Force: boolean);
96      property SQLDialect: integer read FSQLDialect;
97 +    property FirebirdClientAPI: TFBClientAPI read FFirebirdClientAPI;
98  
99    public
100      function GetSQLParams: ISQLParams; virtual; abstract;
# Line 97 | Line 103 | type
103        DeleteCount: integer): boolean;
104      function GetSQLStatementType: TIBSQLStatementTypes;
105      function GetSQLText: AnsiString;
106 +    function GetProcessedSQLText: AnsiString;
107      function GetSQLDialect: integer;
108  
109      {GetDSQLInfo only supports isc_info_sql_stmt_type, isc_info_sql_get_plan, isc_info_sql_records}
# Line 135 | Line 142 | begin
142      IBError(ibxeNotInTransaction,[]);
143   end;
144  
145 + function TFBStatement.TimeStampToMSecs(const TimeStamp: TTimeStamp): Int64;
146 + begin
147 +  Result := TimeStamp.Time + Int64(timestamp.date)*msecsperday;
148 + end;
149 +
150   constructor TFBStatement.Create(Attachment: IAttachment;
151    Transaction: ITransaction; sql: AnsiString; SQLDialect: integer);
152   begin
153    inherited Create(Transaction as TFBTransaction,2);
154    FAttachmentIntf := Attachment;
155    FTransactionIntf := Transaction;
156 +  FFirebirdClientAPI := Attachment.getFirebirdAPI as TFBClientAPI;
157    FSQLDialect := SQLDialect;
158    FSQL := sql;
159   end;
160  
161   constructor TFBStatement.CreateWithParameterNames(Attachment: IAttachment;
162    Transaction: ITransaction; sql: AnsiString; SQLDialect: integer;
163 <  GenerateParamNames: boolean);
163 >  GenerateParamNames: boolean; CaseSensitiveParams: boolean);
164   begin
165    FHasParamNames := true;
166    FGenerateParamNames := GenerateParamNames;
167 +  FCaseSensitiveParams := CaseSensitiveParams;
168    Create(Attachment,Transaction,sql,SQLDialect);
169   end;
170  
# Line 222 | Line 236 | begin
236    Result := FSQL;
237   end;
238  
239 + function TFBStatement.GetProcessedSQLText: AnsiString;
240 + begin
241 +  if FProcessedSQL = '' then
242 +    ProcessSQL(FSQL,FGenerateParamNames,FProcessedSQL);
243 +  Result := FProcessedSQL
244 + end;
245 +
246   function TFBStatement.GetSQLDialect: integer;
247   begin
248    Result := FSQLDialect;
# Line 300 | Line 321 | end;
321  
322   function TFBStatement.GetDSQLInfo(Request: byte): ISQLInfoResults;
323   begin
324 <  Result := TSQLInfoResultsBuffer.Create;
324 >  Result := TSQLInfoResultsBuffer.Create(FFirebirdClientAPI);
325    GetDsqlInfo(Request,Result);
326   end;
327  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines