[fpc-pascal] Bump: Trouble setting/getting ftVarBytes field data inTBufDataset

Reinier Olislagers reinierolislagers at gmail.com
Wed Aug 3 12:59:05 CEST 2011


On 3-8-2011 12:32, Ludo Brands wrote:
>> On 2-8-2011 7:39, Reinier Olislagers wrote:
>>> I've got trouble finding out how to fill and retrieve data for a 
>>> ftVarBytes field in a TBufDataset.
>>>   TestDataset.FieldByName('ftVarBytes').Asstring := Teststring;
>>>   writeln('ftVarbytes.AsString: ' + 
>>> TestDataset.FieldByName('ftVarBytes').AsString);
> 
> This is the way to do it. However:
> - FieldDef.Size := 2; You only store 2 characters. 
Oops. Correct.
> - TCustomBufDataset.GetFieldSize doesn't recognise TBinaryField descendants
> and fixes their length arbitrary as 10 bytes... Setting fieldsize to more
> than 10 bytes won't store more than 10 chars. TMemDataset handles this more
> elegantly by raising a SErrFieldTypeNotSupported.
> So the answer is that TBufDataset doesn' support TBinaryField descendants
> correctly.
> 
> For test purposes, limit field size to 10 bytes ;)
Thanks for the answer, I will ;)
(I'll have a go at adding this info to the wiki as well)

Reinier



More information about the fpc-pascal mailing list