39 |
|
|
40 |
|
uses |
41 |
|
Classes, SysUtils, IB, FBArray, IBHeader, FB25Statement, FB25Attachment, FBClientAPI, |
42 |
< |
FB25Transaction; |
42 |
> |
FB25Transaction, FB25ClientAPI; |
43 |
|
|
44 |
|
type |
45 |
|
|
62 |
|
private |
63 |
|
FDBHandle: TISC_DB_HANDLE; |
64 |
|
FTRHandle: TISC_TR_HANDLE; |
65 |
+ |
FFirebird25ClientAPI: TFB25ClientAPI; |
66 |
|
protected |
67 |
|
procedure InternalGetSlice; override; |
68 |
|
procedure InternalPutSlice(Force: boolean); override; |
73 |
|
|
74 |
|
implementation |
75 |
|
|
76 |
< |
uses FBAttachment, FB25ClientAPI; |
76 |
> |
uses FBAttachment; |
77 |
|
|
78 |
|
const |
79 |
|
sGetArrayMetaData = 'Select F.RDB$CHARACTER_SET_ID '+ |
80 |
|
'From RDB$FIELDS F JOIN RDB$RELATION_FIELDS RF '+ |
81 |
|
'On F.RDB$FIELD_NAME = RF.RDB$FIELD_SOURCE '+ |
82 |
< |
'Where RF.RDB$RELATION_NAME = ? and RF.RDB$FIELD_NAME = ?'; |
82 |
> |
'Where RF.RDB$RELATION_NAME = ? and RF.RDB$FIELD_NAME = ? '+ |
83 |
> |
'UNION '+ |
84 |
> |
'Select F.RDB$CHARACTER_SET_ID '+ |
85 |
> |
'From RDB$FIELDS F JOIN RDB$PROCEDURE_PARAMETERS PP '+ |
86 |
> |
'On F.RDB$FIELD_NAME = PP.RDB$FIELD_SOURCE '+ |
87 |
> |
'Where PP.RDB$PROCEDURE_NAME = ? and PP.RDB$PARAMETER_NAME = ?'; |
88 |
|
|
89 |
|
{ TFB25ArrayMetaData } |
90 |
|
|
102 |
|
TRHandle := (aTransaction as TFB25Transaction).Handle; |
103 |
|
RelName := AnsiUpperCase(relationName); |
104 |
|
ColName := AnsiUpperCase(columnName); |
105 |
< |
with Firebird25ClientAPI do |
105 |
> |
with (aAttachment as TFB25Attachment).Firebird25ClientAPI do |
106 |
|
if isc_array_lookup_bounds(StatusVector,@(DBHandle),@(TRHandle), |
107 |
|
PAnsiChar(RelName),PAnsiChar(ColName),@FArrayDesc) > 0 then |
108 |
|
IBDatabaseError; |
115 |
|
begin |
116 |
|
SQLParams[0].AsString := RelationName; |
117 |
|
SQLParams[1].AsString := ColumnName; |
118 |
+ |
SQLParams[2].AsString := RelationName; |
119 |
+ |
SQLParams[3].AsString := ColumnName; |
120 |
|
with OpenCursor do |
121 |
|
if FetchNext then |
122 |
|
begin |
130 |
|
else |
131 |
|
begin |
132 |
|
FCodePage := CP_NONE; |
133 |
< |
FirebirdClientAPI.CharSetID2CodePage(FCharSetID,FCodePage); |
133 |
> |
FAttachment.CharSetID2CodePage(FCharSetID,FCodePage); |
134 |
|
end; |
135 |
|
end; |
136 |
|
end; |
139 |
|
(FCharSetID = 0) then {This really shouldn't be necessary - but it is :(} |
140 |
|
with aAttachment as TFBAttachment do |
141 |
|
begin |
142 |
< |
if HasDefaultCharSet and FirebirdClientAPI.CharSetWidth(CharSetID,CharWidth) then |
142 |
> |
if HasDefaultCharSet and FAttachment.CharSetWidth(CharSetID,CharWidth) then |
143 |
|
FArrayDesc.array_desc_length := FArrayDesc.array_desc_length * CharWidth; |
144 |
|
end; |
145 |
|
end; |
158 |
|
|
159 |
|
procedure TFB25Array.InternalGetSlice; |
160 |
|
begin |
161 |
< |
with Firebird25ClientAPI do |
161 |
> |
with FFirebird25ClientAPI do |
162 |
|
Call(isc_array_get_slice(StatusVector,@(FDBHandle),@(FTRHandle), |
163 |
|
@FArrayID, GetArrayDesc, |
164 |
|
Pointer(FBuffer), @FBufSize)); |
166 |
|
|
167 |
|
procedure TFB25Array.InternalPutSlice(Force: boolean); |
168 |
|
begin |
169 |
< |
with Firebird25ClientAPI do |
169 |
> |
with FFirebird25ClientAPI do |
170 |
|
if (isc_array_put_slice(StatusVector, @(FDBHandle),@(FTRHandle), |
171 |
|
@FArrayID, GetArrayDesc, |
172 |
|
Pointer(FBuffer),@FBufSize) > 0) and not Force then |
180 |
|
inherited Create(aAttachment,aTransaction,aField); |
181 |
|
FDBHandle := aAttachment.Handle; |
182 |
|
FTRHandle := aTransaction.Handle; |
183 |
+ |
FFirebird25ClientAPI := aAttachment.Firebird25ClientAPI; |
184 |
+ |
OnDatabaseError := FFirebird25ClientAPI.IBDataBaseError; |
185 |
|
end; |
186 |
|
|
187 |
|
constructor TFB25Array.Create(aAttachment: TFB25Attachment; |
190 |
|
inherited Create(aAttachment,aTransaction,aField,ArrayID); |
191 |
|
FDBHandle := aAttachment.Handle; |
192 |
|
FTRHandle := aTransaction.Handle; |
193 |
+ |
FFirebird25ClientAPI := aAttachment.Firebird25ClientAPI; |
194 |
+ |
OnDatabaseError := FFirebird25ClientAPI.IBDataBaseError; |
195 |
|
end; |
196 |
|
|
197 |
|
end. |