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

Comparing ibx/trunk/fbintf/client/FBArray.pas (file contents):
Revision 56 by tony, Mon Mar 6 10:20:02 2017 UTC vs.
Revision 309 by tony, Tue Jul 21 08:00:42 2020 UTC

# Line 90 | Line 90 | type
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;
# Line 108 | Line 109 | type
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;
# Line 126 | Line 128 | type
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;
# Line 137 | Line 140 | type
140  
141    TFBArray = class(TActivityReporter,IArray)
142    private
143 +    FFirebirdClientAPI: TFBClientAPI;
144      FMetaData: IArrayMetaData;
145      FIsNew: boolean;
146      FLoaded: boolean;
# Line 159 | Line 163 | type
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;
# Line 180 | Line 184 | type
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;
# Line 273 | Line 278 | end;
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;
# Line 298 | Line 303 | begin
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
# Line 398 | Line 408 | 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,
# Line 486 | Line 496 | constructor TFBArrayMetaData.Create(aAtt
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);
# Line 652 | Line 665 | begin
665      end;
666      FBufSize := FElementSize * l;
667  
668 <    with FirebirdClientAPI do
668 >    with FFirebirdClientAPI do
669        IBAlloc(FBuffer,0,FBufSize);
670  
671      Dims := GetDimensions;
# Line 741 | Line 754 | begin
754    inherited Create(aTransaction);
755    FMetaData := aField;
756    FAttachment := aAttachment;
757 +  FFirebirdClientAPI := aTransaction.FirebirdAPI;
758    FTransactionIntf :=  aTransaction;
759    FTransactionSeqNo := aTransaction.TransactionSeqNo;
760    FIsNew := true;
# Line 759 | Line 773 | begin
773    FMetaData := aField;
774    FArrayID := ArrayID;
775    FAttachment := aAttachment;
776 +  FFirebirdClientAPI := aTransaction.FirebirdAPI;
777    FTransactionIntf :=  aTransaction;
778    FTransactionSeqNo := aTransaction.TransactionSeqNo;
779    FIsNew := false;
# Line 849 | Line 864 | begin
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines