[fpc-pascal] Assigning value to ftVariant datatype & varbytes -still stuck

Reinier Olislagers reinierolislagers at gmail.com
Sun Aug 7 19:25:25 CEST 2011


On 7-8-2011 18:28, Ludo Brands wrote:
>>   FTestDataSet.FieldByName('ftVarBytes').AsString:=TestString;
>>   FTestDataSet.FieldByName('ftVariant').AsString:=TestString;
> 
> Same problem as before: TBufDataset doesn't support correctly ftVarBytes and
> ftVariant and doesn't raise an SErrFieldTypeNotSupported like TMemDataset is
> doing.
> Look at TCustomBufDataset.GetFieldSize and you'll see that data length for
> ftVarBytes and ftVariant is arbitrarely set at 10. Compare this with
> TMemDataset.MDSGetBufferSize.
> 
> Ludo
> 
I'm afraid you'll have to spell it out for me; I now set the size
explicitly:
  FieldDef.Name := 'ftVariant';
  FieldDef.DataType := ftVariant;
  FieldDef.Size:=NumberOfBytes;

even I do this:
  FTestDataset.Fieldbyname('ftTypedBinary').Asstring :=
PChar(AnsiLeftStr(TestString,7)+#0);

FTestDataSet.FieldByName('ftVarBytes').AsString:=PChar(AnsiLeftStr(TestString,7)+#0);

FTestDataSet.FieldByName('ftVariant').AsString:=PChar(AnsiLeftStr(TestString,7)+#0);


I still get the errors.


As for patching TBufDataset: ftVariant and ftVarbytes seem like
blob-type fields to me, so:
in TCustomBufDataset.GetFieldSize
  case FieldDef.DataType of
...
    ftBlob,
      ftMemo,
      ftGraphic,
      ftFmtMemo,
      ftParadoxOle,
      ftDBaseOle,
      ftTypedBinary,
      ftOraBlob,
      ftOraClob,
      ftWideMemo : result := sizeof(TBufBlobField)
  else Result := 10
  end;

would it make sense to add ftVariant, ftVarBytes to the list with ftBlob
etc?
(I'm going to try anyway, see what happens ;)

Thanks for all the help,
Reinier



More information about the fpc-pascal mailing list