Subject | TFieldefs |
---|---|
Author | Gerhardus Geldenhuis |
Post date | 2001-07-09T09:32:13Z |
Hi
How do I know to what type of variant a fieldtype will be cast.
If you cast it like the code underneath it only cast the fields
that have values. The fields that dont have values stay null.
I am asking because this is part of a SaveDatasetToFile class. I dont
want to save the structure of a record for each one, only for the
first one.
Thanks
Gerhardus
function CFD: String;
var
I: Word;
begin
for I:= 0 to Form1.IBOQuery1.FieldDefs.Count-1 do
Result:=Result+Form1.IBOQuery1.FieldDefs[I].Name+';';
Delete(Result,Length(Result),1);
end;
procedure adddata(ss:TDataset);
begin
v:=ss[cfd];
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:integer;
begin
v:=VarArrayCreate([0,IBOQuery1.FieldDefs.Count],varvariant);
adddata(IBOQuery1);
for i:=VarArrayLowBound(v,1) to VarArrayHighBound(v,1) do
Memo1.Lines.Add(IBOQuery1.FieldDefs[i].FieldClass.ClassName+'
'+ReturnVariantTypeDescription(v[I]));
end;
How do I know to what type of variant a fieldtype will be cast.
If you cast it like the code underneath it only cast the fields
that have values. The fields that dont have values stay null.
I am asking because this is part of a SaveDatasetToFile class. I dont
want to save the structure of a record for each one, only for the
first one.
Thanks
Gerhardus
function CFD: String;
var
I: Word;
begin
for I:= 0 to Form1.IBOQuery1.FieldDefs.Count-1 do
Result:=Result+Form1.IBOQuery1.FieldDefs[I].Name+';';
Delete(Result,Length(Result),1);
end;
procedure adddata(ss:TDataset);
begin
v:=ss[cfd];
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:integer;
begin
v:=VarArrayCreate([0,IBOQuery1.FieldDefs.Count],varvariant);
adddata(IBOQuery1);
for i:=VarArrayLowBound(v,1) to VarArrayHighBound(v,1) do
Memo1.Lines.Add(IBOQuery1.FieldDefs[i].FieldClass.ClassName+'
'+ReturnVariantTypeDescription(v[I]));
end;