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

Comparing ibx/trunk/fbintf/client/2.5/FB25Array.pas (file contents):
Revision 47 by tony, Mon Jan 9 15:31:51 2017 UTC vs.
Revision 113 by tony, Thu Jan 18 14:37:59 2018 UTC

# Line 25 | Line 25
25   *
26   *)
27   unit FB25Array;
28 + {$IFDEF MSWINDOWS}
29 + {$DEFINE WINDOWS}
30 + {$ENDIF}
31  
32   {$IFDEF FPC}
33 < {$mode objfpc}{$H+}
33 > {$mode delphi}
34   {$codepage UTF8}
35   {$interfaces COM}
36   {$ENDIF}
# Line 47 | Line 50 | type
50      FCodePage: TSystemCodePage;
51    protected
52      procedure LoadMetaData(aAttachment: IAttachment; aTransaction: ITransaction;
53 <                   relationName, columnName: string); override;
53 >                   relationName, columnName: AnsiString); override;
54    public
55      function GetCharSetID: cardinal; override;
56      function GetCodePage: TSystemCodePage; override;
# Line 75 | Line 78 | const
78    sGetArrayMetaData = 'Select F.RDB$CHARACTER_SET_ID '+
79                        'From RDB$FIELDS F JOIN RDB$RELATION_FIELDS RF '+
80                        'On F.RDB$FIELD_NAME = RF.RDB$FIELD_SOURCE '+
81 <                      'Where RF.RDB$RELATION_NAME = ? and RF.RDB$FIELD_NAME = ?';
81 >                      'Where RF.RDB$RELATION_NAME = ? and RF.RDB$FIELD_NAME = ? '+
82 >                      'UNION '+
83 >                      'Select F.RDB$CHARACTER_SET_ID '+
84 >                      'From RDB$FIELDS F JOIN RDB$PROCEDURE_PARAMETERS PP '+
85 >                      'On F.RDB$FIELD_NAME = PP.RDB$FIELD_SOURCE '+
86 >                      'Where PP.RDB$PROCEDURE_NAME = ? and PP.RDB$PARAMETER_NAME = ?';
87  
88    { TFB25ArrayMetaData }
89  
90   procedure TFB25ArrayMetaData.LoadMetaData(aAttachment: IAttachment;
91 <  aTransaction: ITransaction; relationName, columnName: string);
91 >  aTransaction: ITransaction; relationName, columnName: AnsiString);
92   var
93    DBHandle: TISC_DB_HANDLE;
94    TRHandle: TISC_TR_HANDLE;
95    stmt: IStatement;
96    CharWidth: integer;
97 +  RelName: AnsiString;
98 +  ColName: AnsiString;
99   begin
100    DBHandle := (aAttachment as TFB25Attachment).Handle;
101    TRHandle := (aTransaction as TFB25Transaction).Handle;
102 +  RelName := AnsiUpperCase(relationName);
103 +  ColName := AnsiUpperCase(columnName);
104    with Firebird25ClientAPI do
105      if isc_array_lookup_bounds(StatusVector,@(DBHandle),@(TRHandle),
106 <        PChar(AnsiUpperCase(relationName)),PChar(AnsiUpperCase(columnName)),@FArrayDesc) > 0 then
106 >        PAnsiChar(RelName),PAnsiChar(ColName),@FArrayDesc) > 0 then
107            IBDatabaseError;
108  
109    if (GetSQLType = SQL_TEXT) or (GetSQLType = SQL_VARYING) then
# Line 102 | Line 114 | begin
114      begin
115        SQLParams[0].AsString := RelationName;
116        SQLParams[1].AsString := ColumnName;
117 +      SQLParams[2].AsString := RelationName;
118 +      SQLParams[3].AsString := ColumnName;
119        with OpenCursor do
120        if FetchNext then
121        begin
# Line 115 | Line 129 | begin
129          else
130          begin
131            FCodePage := CP_NONE;
132 <          FirebirdClientAPI.CharSetID2CodePage(FCharSetID,FCodePage);
132 >          FAttachment.CharSetID2CodePage(FCharSetID,FCodePage);
133          end;
134        end;
135      end;
# Line 124 | Line 138 | begin
138        (FCharSetID = 0) then {This really shouldn't be necessary - but it is :(}
139    with aAttachment as TFBAttachment do
140    begin
141 <    if HasDefaultCharSet  and FirebirdClientAPI.CharSetWidth(CharSetID,CharWidth) then
142 <      FArrayDesc.array_desc_length *= CharWidth;
141 >    if HasDefaultCharSet  and FAttachment.CharSetWidth(CharSetID,CharWidth) then
142 >      FArrayDesc.array_desc_length := FArrayDesc.array_desc_length * CharWidth;
143    end;
144   end;
145  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines