69 |
|
|
70 |
|
TFB30ArrayMetaData = class(TFBArrayMetaData,IArrayMetaData) |
71 |
|
private |
72 |
– |
FCharSetID: integer; |
72 |
|
FCodePage: TSystemCodePage; |
73 |
|
protected |
74 |
|
procedure LoadMetaData(aAttachment: IAttachment; aTransaction: ITransaction; |
105 |
|
|
106 |
|
implementation |
107 |
|
|
108 |
< |
uses FB30ClientAPI, FB30Statement; |
108 |
> |
uses FBAttachment, FB30ClientAPI, FB30Statement; |
109 |
|
|
110 |
|
const |
111 |
|
sGetArrayMetaData = 'Select F.RDB$FIELD_LENGTH, F.RDB$FIELD_SCALE, F.RDB$FIELD_TYPE, '+ |
124 |
|
procedure TFB30ArrayMetaData.LoadMetaData(aAttachment: IAttachment; |
125 |
|
aTransaction: ITransaction; relationName, columnName: string); |
126 |
|
var stmt: IStatement; |
127 |
+ |
CharWidth: integer; |
128 |
|
begin |
129 |
|
RelationName := AnsiUpperCase(RelationName); |
130 |
|
ColumnName := AnsiUpperCase(ColumnName); |
138 |
|
if FetchNext then |
139 |
|
begin |
140 |
|
FillChar(FArrayDesc.array_desc_field_name,sizeof(FArrayDesc.array_desc_field_name),' '); |
141 |
< |
FillChar(FArrayDesc.array_desc_relation_name,sizeof(FArrayDesc.array_desc_field_name),' '); |
141 |
> |
FillChar(FArrayDesc.array_desc_relation_name,sizeof(FArrayDesc.array_desc_relation_name),' '); |
142 |
|
Move(columnName[1],FArrayDesc.array_desc_field_name,Length(columnName)); |
143 |
|
Move(relationName[1],FArrayDesc.array_desc_relation_name,length(relationName)); |
144 |
|
FArrayDesc.array_desc_length := Data[0].AsInteger; |
151 |
|
FCharSetID := (aAttachment as TFB30Attachment).CharSetID; |
152 |
|
FCodePage := CP_NONE; |
153 |
|
FirebirdClientAPI.CharSetID2CodePage(FCharSetID,FCodePage); |
154 |
+ |
if (FArrayDesc.array_desc_dtype in [blr_text,blr_cstring, blr_varying]) and |
155 |
+ |
(FCharSetID = 0) then {This really shouldn't be necessary - but it is :(} |
156 |
+ |
with aAttachment as TFBAttachment do |
157 |
+ |
begin |
158 |
+ |
if HasDefaultCharSet and FirebirdClientAPI.CharSetWidth(CharSetID,CharWidth) then |
159 |
+ |
FArrayDesc.array_desc_length *= CharWidth; |
160 |
+ |
end; |
161 |
|
repeat |
162 |
|
with FArrayDesc.array_desc_bounds[Data[4].AsInteger] do |
163 |
|
begin |
216 |
|
SDLItem.addShortInteger(array_desc_length); |
217 |
|
end; |
218 |
|
|
219 |
< |
FSDL.Add(isc_sdl_relation).SetAsString(GetTableName); |
220 |
< |
FSDL.Add(isc_sdl_field).SetAsString(GetColumnName); |
219 |
> |
FSDL.Add(isc_sdl_relation).SetAsString(array_desc_relation_name); |
220 |
> |
FSDL.Add(isc_sdl_field).SetAsString(array_desc_field_name); |
221 |
|
|
222 |
|
for i := 0 to array_desc_dimensions - 1 do |
223 |
|
begin |