Subject | Re[2]: [IBO] How to store a SET into Firebird with IBO? |
---|---|
Author | Ramil |
Post date | 2005-07-07T10:38:07Z |
8 Integers is shortest variant - 32 bytes.
You can also store INT8 array in one Varchar field
having executed corresponding transformation.
IB_Query1.FieldByName('MYSET').AsString:=S;
1. As '0' and '1'
S:='01000111010101111000110001010...
Up to 256 bytes
2. As HEX
S:='4A7854E038587D679000493380...
Up to 64 bytes
3. UUEncode or Base64
S:='PD94bWwgdmVy...
Regards,
Ramil
You can also store INT8 array in one Varchar field
having executed corresponding transformation.
IB_Query1.FieldByName('MYSET').AsString:=S;
1. As '0' and '1'
S:='01000111010101111000110001010...
Up to 256 bytes
2. As HEX
S:='4A7854E038587D679000493380...
Up to 64 bytes
3. UUEncode or Base64
S:='PD94bWwgdmVy...
Regards,
Ramil
> Hello
> Try 8 Integer fields (or 4 Int64 as you wish)
> type
> PByteSet = ^TByteSet;
> TByteSet = set of Byte;
> var
> INT8: Array[1..8] of Integer;
> MySet,MySet2: TByteSet;
> ...
> //write
> PByteSet(@INT8)^:=MySet;
> IB_Query1.FieldByName('SET1').AsInteger:=INT8[1];
> IB_Query1.FieldByName('SET2').AsInteger:=INT8[2];
> ...
> IB_Query1.FieldByName('SET8').AsInteger:=INT8[8];
> ...
> //read
> INT8[1]:=IB_Query1.FieldByName('SET1').AsInteger;
> INT8[2]:=IB_Query1.FieldByName('SET2').AsInteger;
> ...
> INT8[8]:=IB_Query1.FieldByName('SET8').AsInteger;
> MySet2:=PByteSet(@INT8)^;
> Ramil
>> I have three differents SETs in my Delphi application, I'd like to store
>> in a Firebird Table
>> 1.) What datatype is appropriate to store it?
>> 2.) What do you recommend for converting the SET into the Firebird
>> compatible datatype?
>> Regards
>> Gunther