RE : RE : RE : [fpc-pascal] Assigning value to ftVariant datatype varbytes-still stuck
On 7-8-2011 19:50, Ludo Brands wrote: TBufDataset doesn't support ftVarBytes and ftVariant. Variants are complex objects and aren't stored by just copying bytes. Don't use them with TBufDataset. Ludo ... cause they have some kind of structure that describes what kind of data the variable/field actually contains and a pointer to memory containing the actual data? Just guessing... Anyway, once again thanks a lot for the help, I've updated my test code and posted http://bugs.freepascal.org/view.php?id=19930 I created a patch for ftVariant, ftBytes and ftVarBytes support as well as a check for supported types and attached it to the issue. Feel free to extend your tests with it ;) Also a change in fpXMLXSDExport line 388: Fanode := Foutputdoc.Createtextnode(Utf8decode(EF.Field.AsString)); Instead of Fanode := Foutputdoc.Createtextnode(Encodestringbase64(EF.Field.AsString)); The format was defined as string before. Ludo ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: RE : RE : [fpc-pascal] Assigning value to ftVariant datatype varbytes-still stuck
On 7-8-2011 19:50, Ludo Brands wrote: TBufDataset doesn't support ftVarBytes and ftVariant. Variants are complex objects and aren't stored by just copying bytes. Don't use them with TBufDataset. Ludo ... cause they have some kind of structure that describes what kind of data the variable/field actually contains and a pointer to memory containing the actual data? Just guessing... Anyway, once again thanks a lot for the help, I've updated my test code and posted http://bugs.freepascal.org/view.php?id=19930 Reinier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE : RE : RE : [fpc-pascal] Assigning value to ftVariant datatype varbytes-still stuck
TBufDataset doesn't support ftVarBytes and ftVariant. Variants are complex objects and aren't stored by just copying bytes. Don't use them with TBufDataset. Ludo ... cause they have some kind of structure that describes what kind of data the variable/field actually contains and a pointer to memory containing the actual data? Just guessing... Yes, a pointer or the actual data for basic types. Sizeof(variant) is 16. Copying only 10 bytes is clearly not working, even for the simple datatypes. Ludo Anyway, once again thanks a lot for the help, I've updated my test code and posted http://bugs.freepascal.org/view.php?id=19930 Reinier ___ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE : [fpc-pascal] Assigning value to ftVariant datatype varbytes -still stuck
Hi list, Free Pascal Compiler version 2.5.1 [2011/08/04] for i386 While improving my fcl-db XML export code, I'm testing with ftVariant types in a bufdataset: FieldDef := FTestDataset.FieldDefs.AddFieldDef; FieldDef.Name := 'ftVariant'; FieldDef.DataType := ftVariant; This works: TestString:='The answer to life, the universe, and everything'; FTestDataset.Append; FTestDataSet.FieldByName('ftVarBytes').AsString:=TestString; FTestDataSet.FieldByName('ftVarBytes').SetData(TempPChar); //FTestDataSet.FieldByName('ftVariant').AsString:=TestString; FTestDataset.Post; However, I can't assign values to ftVariant, whatever combination I try. The strange thing is that I get an access violation when printing the fields' contents in a loop, and it happens when getting the value for ftVarBytes. Would it have to do with the ASCII NULL delimiter Ludo Brands reported in http://bugs.freepascal.org/view.php?id=19922 This doesn't work: //FTestDataSet.FieldByName('ftVarBytes').AsString:=TestString; FTestDataSet.FieldByName('ftVarBytes').SetData(TempPChar); FTestDataSet.FieldByName('ftVariant').AsString:=TestString; nor this: //FTestDataSet.FieldByName('ftVarBytes').AsString:=TestString; //FTestDataSet.FieldByName('ftVarBytes').SetData(TempPChar); FTestDataSet.FieldByName('ftVariant').AsString:=TestString; nor this: FTestDataSet.FieldByName('ftVarBytes').AsString:=TestString; FTestDataSet.FieldByName('ftVarBytes').SetData(TempPChar); FTestDataSet.FieldByName('ftVariant').AsString:=TestString; How can I properly assign values to ftVarBytes and ftVariant and retrieve them? I know I asked before for ftVarBytes; I just use .AsString:='bla', but obviously it doesn't work. 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 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: RE : [fpc-pascal] Assigning value to ftVariant datatype varbytes -still stuck
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 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE : RE : [fpc-pascal] Assigning value to ftVariant datatype varbytes-still stuck
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; TBufDataset doesn't support ftVarBytes and ftVariant. Variants are complex objects and aren't stored by just copying bytes. Don't use them with TBufDataset. Ludo ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: RE : RE : [fpc-pascal] Assigning value to ftVariant datatype varbytes-still stuck
On 7-8-2011 19:50, Ludo Brands wrote: 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; TBufDataset doesn't support ftVarBytes and ftVariant. Variants are complex objects and aren't stored by just copying bytes. Don't use them with TBufDataset. Ludo Thanks, that's very clear - I'll get rid of them in the tests ;) I might upload a patch to give an error instead of the fixed size - that might possibly lie within my abilities... Thanks, Reinier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal