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 |
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; |
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; |
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; |
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; |
474 |
|
begin |
475 |
|
inherited Create(aParent,aIndex); |
476 |
|
FStatement := aParent.Statement; |
477 |
+ |
FFirebird30ClientAPI := aParent.FFirebird30ClientAPI; |
478 |
|
end; |
479 |
|
|
480 |
|
procedure TIBXSQLVAR.RowChange; |
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; |
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; |
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; |
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; |
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; |
873 |
|
begin |
874 |
|
inherited Create; |
875 |
|
FStatement := aStatement; |
876 |
+ |
FFirebird30ClientAPI := aStatement.FFirebird30ClientAPI; |
877 |
|
FSize := 0; |
878 |
|
// writeln('Creating ',ClassName); |
879 |
|
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)); |
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), |
1103 |
|
IBError(ibxeInterfaceOutofDate,[nil]); |
1104 |
|
|
1105 |
|
try |
1106 |
< |
with Firebird30ClientAPI do |
1106 |
> |
with FFirebird30ClientAPI do |
1107 |
|
begin |
1108 |
|
if FCollectStatistics then |
1109 |
|
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 |
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; |
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 |
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; |
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; |
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); |
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; |