90 |
|
function GetName: AnsiString; override; |
91 |
|
function GetScale: integer; override; |
92 |
|
function GetSize: integer; |
93 |
+ |
function GetCharSetWidth: integer; override; |
94 |
|
function GetAsString: AnsiString; override; |
95 |
|
procedure SetAsLong(Value: Long); override; |
96 |
|
procedure SetAsShort(Value: Short); override; |
109 |
|
protected |
110 |
|
FArrayDesc: TISC_ARRAY_DESC; |
111 |
|
FCharSetID: integer; |
112 |
+ |
FAttachment: IAttachment; |
113 |
|
procedure LoadMetaData(aAttachment: IAttachment; aTransaction: ITransaction; |
114 |
|
relationName, columnName: AnsiString); virtual; abstract; |
115 |
|
function NumOfElements: integer; |
116 |
|
public |
117 |
|
constructor Create(aAttachment: IAttachment; aTransaction: ITransaction; |
118 |
|
relationName, columnName: AnsiString); overload; |
119 |
< |
constructor Create(SQLType: cardinal; tableName: AnsiString; columnName: AnsiString; |
119 |
> |
constructor Create(aAttachment: IAttachment;SQLType: cardinal; tableName: AnsiString; columnName: AnsiString; |
120 |
|
Scale: integer; size: cardinal; charSetID: cardinal; |
121 |
|
dimensions: cardinal; bounds: TArrayBounds); overload; |
122 |
|
function GetCodePage: TSystemCodePage; virtual; abstract; |
128 |
|
function GetScale: integer; |
129 |
|
function GetSize: cardinal; |
130 |
|
function GetCharSetID: cardinal; virtual; abstract; |
131 |
+ |
function GetCharSetWidth: integer; virtual; abstract; |
132 |
|
function GetTableName: AnsiString; |
133 |
|
function GetColumnName: AnsiString; |
134 |
|
function GetDimensions: integer; |
140 |
|
|
141 |
|
TFBArray = class(TActivityReporter,IArray) |
142 |
|
private |
143 |
+ |
FFirebirdClientAPI: TFBClientAPI; |
144 |
|
FMetaData: IArrayMetaData; |
145 |
|
FIsNew: boolean; |
146 |
|
FLoaded: boolean; |
163 |
|
FBufSize: ISC_LONG; |
164 |
|
FArrayID: TISC_QUAD; |
165 |
|
procedure AllocateBuffer; virtual; |
166 |
< |
procedure Changing; |
167 |
< |
procedure Changed; |
166 |
> |
procedure Changing; virtual; |
167 |
> |
procedure Changed; virtual; |
168 |
|
function GetArrayDesc: PISC_ARRAY_DESC; |
169 |
|
procedure InternalGetSlice; virtual; abstract; |
170 |
|
procedure InternalPutSlice(Force: boolean); virtual; abstract; |
184 |
|
function GetScale: integer; |
185 |
|
function GetSize: cardinal; |
186 |
|
function GetCharSetID: cardinal; |
187 |
+ |
function GetCharSetWidth: integer; |
188 |
|
function GetTableName: AnsiString; |
189 |
|
function GetColumnName: AnsiString; |
190 |
|
function GetDimensions: integer; |
278 |
|
|
279 |
|
constructor TFBArrayElement.Create(anArray: TFBArray; P: PByte); |
280 |
|
begin |
281 |
< |
inherited Create; |
281 |
> |
inherited Create(anArray.FFirebirdClientAPI); |
282 |
|
FArray := anArray; |
283 |
|
FBufPtr := P; |
284 |
|
end; |
303 |
|
Result := GetDataLength; |
304 |
|
end; |
305 |
|
|
306 |
+ |
function TFBArrayElement.GetCharSetWidth: integer; |
307 |
+ |
begin |
308 |
+ |
Result := FArray.FMetaData.GetCharSetWidth; |
309 |
+ |
end; |
310 |
+ |
|
311 |
|
function TFBArrayElement.GetAsString: AnsiString; |
312 |
|
var rs: RawByteString; |
313 |
|
begin |
408 |
|
if trim(Value) = '' then |
409 |
|
SetAsInt64(0) |
410 |
|
else |
411 |
< |
SetAsInt64(StrToInt(Value)); |
411 |
> |
SetAsInt64(AdjustScaleFromCurrency(StrToCurr(Value),GetScale)); |
412 |
|
|
413 |
|
SQL_D_FLOAT, |
414 |
|
SQL_DOUBLE, |
496 |
|
aTransaction: ITransaction; relationName, columnName: AnsiString); |
497 |
|
begin |
498 |
|
inherited Create; |
499 |
+ |
FAttachment := aAttachment; |
500 |
|
LoadMetaData(aAttachment,aTransaction,relationName, columnName); |
501 |
|
end; |
502 |
|
|
503 |
< |
constructor TFBArrayMetaData.Create(SQLType: cardinal; tableName: AnsiString; |
504 |
< |
columnName: AnsiString; Scale: integer; size: cardinal; charSetID: cardinal; |
505 |
< |
dimensions: cardinal; bounds: TArrayBounds); |
503 |
> |
constructor TFBArrayMetaData.Create(aAttachment: IAttachment; |
504 |
> |
SQLType: cardinal; tableName: AnsiString; columnName: AnsiString; |
505 |
> |
Scale: integer; size: cardinal; charSetID: cardinal; dimensions: cardinal; |
506 |
> |
bounds: TArrayBounds); |
507 |
|
var i: integer; |
508 |
|
begin |
509 |
|
inherited Create; |
510 |
+ |
FAttachment := aAttachment; |
511 |
|
with FArrayDesc do |
512 |
|
begin |
513 |
|
array_desc_dtype := GetDType(SQLType); |
665 |
|
end; |
666 |
|
FBufSize := FElementSize * l; |
667 |
|
|
668 |
< |
with FirebirdClientAPI do |
668 |
> |
with FFirebirdClientAPI do |
669 |
|
IBAlloc(FBuffer,0,FBufSize); |
670 |
|
|
671 |
|
Dims := GetDimensions; |
754 |
|
inherited Create(aTransaction); |
755 |
|
FMetaData := aField; |
756 |
|
FAttachment := aAttachment; |
757 |
+ |
FFirebirdClientAPI := aTransaction.FirebirdAPI; |
758 |
|
FTransactionIntf := aTransaction; |
759 |
|
FTransactionSeqNo := aTransaction.TransactionSeqNo; |
760 |
|
FIsNew := true; |
773 |
|
FMetaData := aField; |
774 |
|
FArrayID := ArrayID; |
775 |
|
FAttachment := aAttachment; |
776 |
+ |
FFirebirdClientAPI := aTransaction.FirebirdAPI; |
777 |
|
FTransactionIntf := aTransaction; |
778 |
|
FTransactionSeqNo := aTransaction.TransactionSeqNo; |
779 |
|
FIsNew := false; |
864 |
|
Result := FMetaData.GetCharSetID; |
865 |
|
end; |
866 |
|
|
867 |
+ |
function TFBArray.GetCharSetWidth: integer; |
868 |
+ |
begin |
869 |
+ |
Result := FMetaData.GetCharSetWidth; |
870 |
+ |
end; |
871 |
+ |
|
872 |
|
function TFBArray.GetTableName: AnsiString; |
873 |
|
begin |
874 |
|
Result := FMetaData.GetTableName; |