28 |
|
* |
29 |
|
*) |
30 |
|
unit FBStatement; |
31 |
+ |
{$IFDEF MSWINDOWS} |
32 |
+ |
{$DEFINE WINDOWS} |
33 |
+ |
{$ENDIF} |
34 |
|
|
35 |
|
{$IFDEF FPC} |
36 |
< |
{$mode objfpc}{$H+} |
36 |
> |
{$mode delphi} |
37 |
|
{$codepage UTF8} |
38 |
|
{$interfaces COM} |
39 |
|
{$ENDIF} |
45 |
|
FBTransaction; |
46 |
|
|
47 |
|
type |
48 |
< |
TPerfStatistics = array[psCurrentMemory..psFetches] of Int64; |
48 |
> |
TPerfStatistics = array[psCurrentMemory..psFetches] of comp; |
49 |
|
|
50 |
|
{ TFBStatement } |
51 |
|
|
60 |
|
FOpen: boolean; |
61 |
|
FPrepared: boolean; |
62 |
|
FPrepareSeqNo: integer; {used to check for out of date references from interfaces} |
63 |
< |
FSQL: string; |
64 |
< |
FProcessedSQL: string; |
63 |
> |
FSQL: AnsiString; |
64 |
> |
FProcessedSQL: AnsiString; |
65 |
|
FHasParamNames: boolean; |
66 |
|
FBOF: boolean; |
67 |
|
FEOF: boolean; |
82 |
|
procedure InternalClose(Force: boolean); virtual; abstract; |
83 |
|
public |
84 |
|
constructor Create(Attachment: IAttachment; Transaction: ITransaction; |
85 |
< |
sql: string; SQLDialect: integer); |
85 |
> |
sql: AnsiString; SQLDialect: integer); |
86 |
|
constructor CreateWithParameterNames(Attachment: IAttachment; Transaction: ITransaction; |
87 |
< |
sql: string; SQLDialect: integer; GenerateParamNames: boolean =false); |
87 |
> |
sql: AnsiString; SQLDialect: integer; GenerateParamNames: boolean =false); |
88 |
|
destructor Destroy; override; |
89 |
|
procedure Close; |
90 |
|
procedure TransactionEnding(aTransaction: ITransaction; Force: boolean); |
96 |
|
function GetRowsAffected(var SelectCount, InsertCount, UpdateCount, |
97 |
|
DeleteCount: integer): boolean; |
98 |
|
function GetSQLStatementType: TIBSQLStatementTypes; |
99 |
< |
function GetSQLText: string; |
99 |
> |
function GetSQLText: AnsiString; |
100 |
|
function GetSQLDialect: integer; |
101 |
|
|
102 |
|
{GetDSQLInfo only supports isc_info_sql_stmt_type, isc_info_sql_get_plan, isc_info_sql_records} |
103 |
|
procedure Prepare(aTransaction: ITransaction=nil); virtual; |
104 |
|
function Execute(aTransaction: ITransaction=nil): IResults; |
105 |
|
function OpenCursor(aTransaction: ITransaction=nil): IResultSet; |
106 |
< |
function CreateBlob(paramName: string): IBlob; overload; |
106 |
> |
function CreateBlob(paramName: AnsiString): IBlob; overload; |
107 |
|
function CreateBlob(index: integer): IBlob; overload; |
108 |
|
function CreateBlob(column: TColumnMetaData): IBlob; overload; virtual; abstract; |
109 |
< |
function CreateArray(paramName: string): IArray; overload; |
109 |
> |
function CreateArray(paramName: AnsiString): IArray; overload; |
110 |
|
function CreateArray(index: integer): IArray; overload; |
111 |
|
function CreateArray(column: TColumnMetaData): IArray; overload; virtual; abstract; |
112 |
|
function GetAttachment: IAttachment; |
136 |
|
end; |
137 |
|
|
138 |
|
constructor TFBStatement.Create(Attachment: IAttachment; |
139 |
< |
Transaction: ITransaction; sql: string; SQLDialect: integer); |
139 |
> |
Transaction: ITransaction; sql: AnsiString; SQLDialect: integer); |
140 |
|
begin |
141 |
|
inherited Create(Transaction as TFBTransaction,2); |
142 |
|
FAttachmentIntf := Attachment; |
146 |
|
end; |
147 |
|
|
148 |
|
constructor TFBStatement.CreateWithParameterNames(Attachment: IAttachment; |
149 |
< |
Transaction: ITransaction; sql: string; SQLDialect: integer; |
149 |
> |
Transaction: ITransaction; sql: AnsiString; SQLDialect: integer; |
150 |
|
GenerateParamNames: boolean); |
151 |
|
begin |
152 |
|
FHasParamNames := true; |
217 |
|
Result := FSQLStatementType; |
218 |
|
end; |
219 |
|
|
220 |
< |
function TFBStatement.GetSQLText: string; |
220 |
> |
function TFBStatement.GetSQLText: AnsiString; |
221 |
|
begin |
222 |
|
Result := FSQL; |
223 |
|
end; |
256 |
|
Result := InternalOpenCursor(aTransaction); |
257 |
|
end; |
258 |
|
|
259 |
< |
function TFBStatement.CreateBlob(paramName: string): IBlob; |
259 |
> |
function TFBStatement.CreateBlob(paramName: AnsiString): IBlob; |
260 |
|
var column: TColumnMetaData; |
261 |
|
begin |
262 |
|
InternalPrepare; |
272 |
|
Result := CreateBlob(SQLParams[index] as TSQLParam); |
273 |
|
end; |
274 |
|
|
275 |
< |
function TFBStatement.CreateArray(paramName: string): IArray; |
275 |
> |
function TFBStatement.CreateArray(paramName: AnsiString): IArray; |
276 |
|
var column: TColumnMetaData; |
277 |
|
begin |
278 |
|
InternalPrepare; |