25 |
|
* |
26 |
|
*) |
27 |
|
unit FB30Array; |
28 |
+ |
{$IFDEF MSWINDOWS} |
29 |
+ |
{$DEFINE WINDOWS} |
30 |
+ |
{$ENDIF} |
31 |
|
|
32 |
|
{$IFDEF FPC} |
33 |
< |
{$mode objfpc}{$H+} |
33 |
> |
{$mode delphi} |
34 |
|
{$codepage UTF8} |
35 |
|
{$interfaces COM} |
36 |
|
{$ENDIF} |
43 |
|
|
44 |
|
type |
45 |
|
|
46 |
< |
ISDLItem = interface |
47 |
< |
function getParamType: byte; |
45 |
< |
function getAsInteger: integer; |
46 |
< |
function getAsString: string; |
47 |
< |
function getAsByte: byte; |
46 |
> |
ISDLItem = interface(IParameterBlockItem) |
47 |
> |
['{a34b6064-5ae9-4fc1-85c3-f145f069b607}'] |
48 |
|
procedure addByte(aValue: byte); |
49 |
|
procedure addShortInteger(aValue: integer); |
50 |
– |
procedure setAsString(aValue: string); |
51 |
– |
procedure setAsByte(aValue: byte); |
52 |
– |
procedure SetAsInteger(aValue: integer); |
50 |
|
procedure SetAsShortInteger(aValue: integer); |
51 |
|
procedure SetAsTinyInteger(aValue: integer); |
55 |
– |
property AsString: string read getAsString write setAsString; |
56 |
– |
property AsByte: byte read getAsByte write setAsByte; |
57 |
– |
property AsInteger: integer read getAsInteger write SetAsInteger; |
52 |
|
end; |
53 |
|
|
54 |
< |
ISDL = interface |
55 |
< |
function getCount: integer; |
62 |
< |
function Add(ParamType: byte): ISDLItem; |
63 |
< |
function getItems(index: integer): ISDLItem; |
64 |
< |
function Find(ParamType: byte): ISDLItem; |
65 |
< |
property Items[index: integer]: ISDLItem read getItems; default; |
54 |
> |
ISDL = interface(IParameterBlock<ISDLItem>) |
55 |
> |
['{52ae1f5f-657b-4b14-81aa-7b3658454f4c}'] |
56 |
|
end; |
57 |
|
|
58 |
|
{ TFB30ArrayMetaData } |
62 |
|
FCodePage: TSystemCodePage; |
63 |
|
protected |
64 |
|
procedure LoadMetaData(aAttachment: IAttachment; aTransaction: ITransaction; |
65 |
< |
relationName, columnName: string); override; |
65 |
> |
relationName, columnName: AnsiString); override; |
66 |
|
public |
67 |
|
function GetCharSetID: cardinal; override; |
68 |
|
function GetCodePage: TSystemCodePage; override; |
88 |
|
|
89 |
|
{ TSDLBlock } |
90 |
|
|
91 |
< |
TSDLBlock = class (specialize TCustomParamBlock<TSDLItem,ISDLItem>, ISDL) |
91 |
> |
TSDLBlock = class (TCustomParamBlock<TSDLItem,ISDLItem>, ISDL) |
92 |
|
public |
93 |
|
constructor Create; |
94 |
|
end; |
112 |
|
{Assemble the array descriptor from the System Tables} |
113 |
|
|
114 |
|
procedure TFB30ArrayMetaData.LoadMetaData(aAttachment: IAttachment; |
115 |
< |
aTransaction: ITransaction; relationName, columnName: string); |
115 |
> |
aTransaction: ITransaction; relationName, columnName: AnsiString); |
116 |
|
var stmt: IStatement; |
117 |
|
CharWidth: integer; |
118 |
|
begin |
132 |
|
Move(columnName[1],FArrayDesc.array_desc_field_name,Length(columnName)); |
133 |
|
Move(relationName[1],FArrayDesc.array_desc_relation_name,length(relationName)); |
134 |
|
FArrayDesc.array_desc_length := Data[0].AsInteger; |
135 |
< |
FArrayDesc.array_desc_scale := char(Data[1].AsInteger); |
135 |
> |
FArrayDesc.array_desc_scale := Data[1].AsInteger; |
136 |
|
FArrayDesc.array_desc_dtype := Data[2].AsInteger; |
137 |
|
FArrayDesc.array_desc_dimensions := Data[3].AsInteger; |
138 |
|
FArrayDesc.array_desc_flags := 0; {row major} |
146 |
|
with aAttachment as TFBAttachment do |
147 |
|
begin |
148 |
|
if HasDefaultCharSet and FirebirdClientAPI.CharSetWidth(CharSetID,CharWidth) then |
149 |
< |
FArrayDesc.array_desc_length *= CharWidth; |
149 |
> |
FArrayDesc.array_desc_length := FArrayDesc.array_desc_length * CharWidth; |
150 |
|
end; |
151 |
|
repeat |
152 |
|
with FArrayDesc.array_desc_bounds[Data[4].AsInteger] do |
289 |
|
begin |
290 |
|
inherited Create; |
291 |
|
FDataLength := 1; |
292 |
< |
FBuffer^ := char(isc_sdl_version1); |
292 |
> |
FBuffer^ := isc_sdl_version1; |
293 |
|
end; |
294 |
|
|
295 |
|
end. |