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

Comparing ibx/trunk/fbintf/client/2.5/FB25Statement.pas (file contents):
Revision 47 by tony, Mon Jan 9 15:31:51 2017 UTC vs.
Revision 60 by tony, Mon Mar 27 15:21:02 2017 UTC

# Line 60 | Line 60
60   {                                                                        }
61   {************************************************************************}
62   unit FB25Statement;
63 + {$IFDEF MSWINDOWS}
64 + {$DEFINE WINDOWS}
65 + {$ENDIF}
66  
67   {$IFDEF FPC}
68 < {$mode objfpc}{$H+}
68 > {$mode delphi}
69   {$codepage UTF8}
70   {$interfaces COM}
71   {$ENDIF}
# Line 128 | Line 131 | type
131    protected
132      function GetSQLType: cardinal; override;
133      function GetSubtype: integer; override;
134 <    function GetAliasName: string;  override;
135 <    function GetFieldName: string; override;
136 <    function GetOwnerName: string;  override;
137 <    function GetRelationName: string;  override;
134 >    function GetAliasName: AnsiString;  override;
135 >    function GetFieldName: AnsiString; override;
136 >    function GetOwnerName: AnsiString;  override;
137 >    function GetRelationName: AnsiString;  override;
138      function GetScale: integer; override;
139      function GetCharSetID: cardinal; override;
140      function GetCodePage: TSystemCodePage; override;
141      function GetIsNull: Boolean;   override;
142      function GetIsNullable: boolean; override;
143 <    function GetSQLData: PChar;  override;
143 >    function GetSQLData: PByte;  override;
144      function GetDataLength: cardinal; override;
145      procedure SetIsNull(Value: Boolean); override;
146      procedure SetIsNullable(Value: Boolean);  override;
147 <    procedure SetSQLData(AValue: PChar; len: cardinal); override;
147 >    procedure SetSQLData(AValue: PByte; len: cardinal); override;
148      procedure SetScale(aValue: integer); override;
149      procedure SetDataLength(len: cardinal); override;
150      procedure SetSQLType(aValue: cardinal); override;
# Line 211 | Line 214 | type
214      procedure Bind;
215      function GetTransaction: TFB25Transaction; override;
216      procedure GetData(index: integer; var aIsNull: boolean; var len: short;
217 <      var data: PChar); override;
217 >      var data: PByte); override;
218      function IsInputDataArea: boolean; override;
219    end;
220  
# Line 226 | Line 229 | type
229      destructor Destroy; override;
230      {IResultSet}
231      function FetchNext: boolean;
232 <    function GetCursorName: string;
232 >    function GetCursorName: AnsiString;
233      function GetTransaction: ITransaction; override;
234      function IsEof: boolean;
235      procedure Close;
# Line 240 | Line 243 | type
243      FHandle: TISC_STMT_HANDLE;
244      FSQLParams: TIBXINPUTSQLDA;
245      FSQLRecord: TIBXOUTPUTSQLDA;
246 <    FCursor: String;               { Cursor name...}
246 >    FCursor: AnsiString;               { Cursor name...}
247      FCursorSeqNo: integer;
248      procedure GetPerfCounters(var counters: TPerfStatistics);
249    protected
# Line 253 | Line 256 | type
256      procedure InternalClose(Force: boolean); override;
257    public
258      constructor Create(Attachment: TFB25Attachment; Transaction: ITransaction;
259 <      sql: string; aSQLDialect: integer);
259 >      sql: AnsiString; aSQLDialect: integer);
260      constructor CreateWithParameterNames(Attachment: TFB25Attachment;
261 <      Transaction: ITransaction; sql: string; aSQLDialect: integer; GenerateParamNames: boolean);
261 >      Transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; GenerateParamNames: boolean);
262      destructor Destroy; override;
263      function FetchNext: boolean;
264  
# Line 263 | Line 266 | type
266      {IStatement}
267      function GetSQLParams: ISQLParams; override;
268      function GetMetaData: IMetaData; override;
269 <    function GetPlan: String;
269 >    function GetPlan: AnsiString;
270      function IsPrepared: boolean;
271      function CreateBlob(column: TColumnMetaData): IBlob; override;
272      function CreateArray(column: TColumnMetaData): IArray; override;
# Line 293 | Line 296 | begin
296      result := 0;
297   end;
298  
299 < function TIBXSQLVAR.GetAliasName: string;
299 > function TIBXSQLVAR.GetAliasName: AnsiString;
300   begin
301    result := strpas(FXSQLVAR^.aliasname);
302   end;
303  
304 < function TIBXSQLVAR.GetFieldName: string;
304 > function TIBXSQLVAR.GetFieldName: AnsiString;
305   begin
306    result := strpas(FXSQLVAR^.sqlname);
307   end;
308  
309 < function TIBXSQLVAR.GetOwnerName: string;
309 > function TIBXSQLVAR.GetOwnerName: AnsiString;
310   begin
311    result := strpas(FXSQLVAR^.ownname);
312   end;
313  
314 < function TIBXSQLVAR.GetRelationName: string;
314 > function TIBXSQLVAR.GetRelationName: AnsiString;
315   begin
316    result := strpas(FXSQLVAR^.relname);
317   end;
# Line 332 | Line 335 | begin
335    SQL_BLOB:
336      if (SQLSubType = 1)  then
337        {see http://firebirdsql.org/rlsnotesh/rlsnotes210.html}
338 <      result := FXSQLVAR^.sqlscale;
338 >      result := FXSQLVAR^.sqlscale and $FF;
339  
340    SQL_ARRAY:
341      if (GetRelationName <> '') and (GetFieldName <> '') then
# Line 343 | Line 346 | end;
346   function TIBXSQLVAR.GetCodePage: TSystemCodePage;
347   begin
348    result := CP_NONE;
349 <  with FirebirdClientAPI do
349 >  with Statement.GetAttachment do
350       CharSetID2CodePage(GetCharSetID,result);
351   end;
352  
# Line 357 | Line 360 | begin
360    result := (FXSQLVAR^.sqltype and 1 = 1);
361   end;
362  
363 < function TIBXSQLVAR.GetSQLData: PChar;
363 > function TIBXSQLVAR.GetSQLData: PByte;
364   begin
365    Result := FXSQLVAR^.sqldata;
366   end;
# Line 501 | Line 504 | begin
504    end;
505   end;
506  
507 < procedure TIBXSQLVAR.SetSQLData(AValue: PChar; len: cardinal);
507 > procedure TIBXSQLVAR.SetSQLData(AValue: PByte; len: cardinal);
508   begin
509    if FOwnsSQLData then
510      FreeMem(FXSQLVAR^.sqldata);
# Line 590 | Line 593 | begin
593        FResults.Column[i].RowChange;
594   end;
595  
596 < function TResultSet.GetCursorName: string;
596 > function TResultSet.GetCursorName: AnsiString;
597   begin
598    Result := FResults.FStatement.FCursor;
599   end;
# Line 675 | Line 678 | begin
678   end;
679  
680   procedure TIBXOUTPUTSQLDA.GetData(index: integer; var aIsNull:boolean; var len: short;
681 <  var data: PChar);
681 >  var data: PByte);
682   begin
683    with TIBXSQLVAR(Column[index]), FXSQLVAR^ do
684    begin
# Line 796 | Line 799 | begin
799          if i >= FSize then
800            FColumnList[i] := TIBXSQLVAR.Create(self,i);
801          TIBXSQLVAR(Column[i]).FXSQLVAR := p;
802 <        p := Pointer(PChar(p) + sizeof(FXSQLDA^.sqlvar));
802 >        p := Pointer(PAnsiChar(p) + sizeof(FXSQLDA^.sqlvar));
803        end;
804        FSize := inherited Count;
805      end;
# Line 850 | Line 853 | begin
853    {$ELSE}
854    counters[psUserTime] := 0;
855    {$ENDIF}
856 <  counters[psRealTime] := Int64(TimeStampToMSecs(DateTimeToTimeStamp(Now)));
856 >  counters[psRealTime] := TimeStampToMSecs(DateTimeToTimeStamp(Now));
857  
858    DBInfo := GetAttachment.GetDBInformation([isc_info_reads,isc_info_writes,
859           isc_info_fetches, isc_info_num_buffers, isc_info_current_memory,
# Line 912 | Line 915 | begin
915          if FProcessedSQL = '' then
916            FSQLParams.PreprocessSQL(FSQL,FGenerateParamNames,FProcessedSQL);
917          Call(isc_dsql_prepare(StatusVector, @(TRHandle), @FHandle, 0,
918 <                 PChar(FProcessedSQL), FSQLDialect, nil), True);
918 >                 PAnsiChar(FProcessedSQL), FSQLDialect, nil), True);
919        end
920        else
921          Call(isc_dsql_prepare(StatusVector, @(TRHandle), @FHandle, 0,
922 <                 PChar(FSQL), FSQLDialect, nil), True);
922 >                 PAnsiChar(FSQL), FSQLDialect, nil), True);
923      end;
924      { After preparing the statement, query the stmt type and possibly
925        create a FSQLRecord "holder" }
# Line 1072 | Line 1075 | begin
1075       CreateGuid(GUID);
1076       FCursor := GUIDToString(GUID);
1077       Call(
1078 <       isc_dsql_set_cursor_name(StatusVector, @FHandle, PChar(FCursor), 0),
1078 >       isc_dsql_set_cursor_name(StatusVector, @FHandle, PAnsiChar(FCursor), 0),
1079         True);
1080     end;
1081  
# Line 1133 | Line 1136 | begin
1136          IBDatabaseError;
1137      end;
1138    finally
1139 <    if (FSQLRecord.FTransaction <> nil) and (FSQLRecord.FTransaction <> FTransactionIntf) then
1139 >    if (FSQLRecord.FTransaction <> nil) and (FSQLRecord.FTransaction <> (FTransactionIntf as TFB25Transaction)) then
1140        RemoveMonitor(FSQLRecord.FTransaction);
1141      FOpen := False;
1142      FExecTransactionIntf := nil;
# Line 1143 | Line 1146 | begin
1146   end;
1147  
1148   constructor TFB25Statement.Create(Attachment: TFB25Attachment;
1149 <  Transaction: ITransaction; sql: string; aSQLDialect: integer);
1149 >  Transaction: ITransaction; sql: AnsiString; aSQLDialect: integer);
1150   begin
1151    inherited Create(Attachment,Transaction,sql,aSQLDialect);
1152    FDBHandle := Attachment.Handle;
# Line 1153 | Line 1156 | begin
1156   end;
1157  
1158   constructor TFB25Statement.CreateWithParameterNames(Attachment: TFB25Attachment;
1159 <  Transaction: ITransaction; sql: string; aSQLDialect: integer;
1159 >  Transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
1160    GenerateParamNames: boolean);
1161   begin
1162    inherited CreateWithParameterNames(Attachment,Transaction,sql,aSQLDialect,GenerateParamNames);
# Line 1228 | Line 1231 | begin
1231    Result := TMetaData(GetInterface(1));
1232   end;
1233  
1234 < function TFB25Statement.GetPlan: String;
1234 > function TFB25Statement.GetPlan: AnsiString;
1235   var
1236      RB: ISQLInfoResults;
1237   begin

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines