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 46 by tony, Tue Dec 6 10:33:46 2016 UTC vs.
Revision 47 by tony, Mon Jan 9 15:31:51 2017 UTC

# Line 78 | Line 78 | type
78     function SQLData: PChar; override;
79     function GetDataLength: cardinal; override;
80     function GetCodePage: TSystemCodePage; override;
81 +   function getCharSetID: cardinal; override;
82     procedure SetDataLength(len: cardinal); override;
83     procedure SetSQLType(aValue: cardinal); override;
84    public
# Line 99 | Line 100 | type
100    { TFBArrayMetaData }
101  
102    TFBArrayMetaData = class(TFBInterfacedObject,IArrayMetaData)
103 +  private
104 +   function GetDType(SQLType: cardinal): UChar;
105    protected
106     FArrayDesc: TISC_ARRAY_DESC;
107 +   FCharSetID: integer;
108     procedure LoadMetaData(aAttachment: IAttachment; aTransaction: ITransaction;
109                 relationName, columnName: string); virtual; abstract;
110     function NumOfElements: integer;
111    public
112     constructor Create(aAttachment: IAttachment; aTransaction: ITransaction;
113 <     relationName, columnName: string);
113 >     relationName, columnName: string); overload;
114 >   constructor Create(SQLType: cardinal; tableName: string; columnName: string;
115 >     Scale: integer; size: cardinal; charSetID: cardinal;
116 >     dimensions: cardinal; bounds: TArrayBounds); overload;
117     function GetCodePage: TSystemCodePage; virtual; abstract;
118  
119    public
# Line 250 | Line 257 | begin
257    Result := (FArray.FMetaData as TFBArrayMetaData).GetCodePage;
258   end;
259  
260 + function TFBArrayElement.getCharSetID: cardinal;
261 + begin
262 +  Result := (FArray.FMetaData as TFBArrayMetaData).GetCharSetID;
263 + end;
264 +
265   procedure TFBArrayElement.SetDataLength(len: cardinal);
266   begin
267    if len > GetDataLength then
# Line 474 | Line 486 | begin
486    LoadMetaData(aAttachment,aTransaction,relationName, columnName);
487   end;
488  
489 + constructor TFBArrayMetaData.Create(SQLType: cardinal; tableName: string;
490 +  columnName: string; Scale: integer; size: cardinal; charSetID: cardinal;
491 +  dimensions: cardinal; bounds: TArrayBounds);
492 + var i: integer;
493 + begin
494 +  inherited Create;
495 +  with FArrayDesc do
496 +  begin
497 +    array_desc_dtype := GetDType(SQLType);
498 +    array_desc_scale := char(Scale);
499 +    array_desc_length := UShort(size);
500 +    StrPLCopy(array_desc_field_name,columnName,sizeof(array_desc_field_name));
501 +    StrPLCopy(array_desc_relation_name,tableName,sizeof(array_desc_relation_name));
502 +    array_desc_dimensions := dimensions;
503 +    array_desc_flags := 0;
504 +    FCharSetID := charSetID;
505 +    for i := 0 to Length(bounds) - 1 do
506 +    begin
507 +     array_desc_bounds[i].array_bound_lower := bounds[i].LowerBound;
508 +     array_desc_bounds[i].array_bound_upper := bounds[i].UpperBound;
509 +    end;
510 +  end;
511 + end;
512 +
513   function TFBArrayMetaData.GetSQLType: cardinal;
514   begin
515    case  FArrayDesc.array_desc_dtype of
# Line 549 | Line 585 | begin
585    end;
586   end;
587  
588 + function TFBArrayMetaData.GetDType(SQLType: cardinal): UChar;
589 + begin
590 +  case  SQLType of
591 +  SQL_TEXT:
592 +    Result := blr_text;
593 +  SQL_SHORT:
594 +    Result :=  blr_short;
595 +  SQL_LONG:
596 +    Result := blr_long;
597 +  SQL_QUAD:
598 +    Result := blr_quad;
599 +  SQL_FLOAT:
600 +    Result := blr_float;
601 +  SQL_D_FLOAT:
602 +    Result := blr_double;
603 +  SQL_TIMESTAMP:
604 +    Result := blr_timestamp;
605 +  SQL_VARYING:
606 +    Result := blr_varying;
607 +  SQL_TYPE_DATE:
608 +    Result := blr_sql_date;
609 +  SQL_TYPE_TIME:
610 +    Result :=  blr_sql_time;
611 +  SQL_INT64:
612 +    Result := blr_int64;
613 +  end;
614 + end;
615 +
616   function TFBArrayMetaData.NumOfElements: integer;
617   var i: integer;
618      Bounds: TArrayBounds;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines