[fpc-pascal] Re: RE : RE : RE : Assigning value to ftVariant datatype& varbytes-still stuck
Ludo Brands
ludo.brands at free.fr
Tue Aug 9 16:42:34 CEST 2011
> Applied patch in fpc source, make clean, make all make
> install for FPC, make for Lazarus, rescan fpc source
> directory, recompile test project.
>
> Still get access violations.
> (ftVariant, ftVarbytes set to size 10, then assigning all
> kinds of strings to it using .AsString)
>
> Could you have a look at the test code now - I might still be
> doing something really stupid. The commit where the files are
> readded, you can download the test code
> there:
> https://bitbucket.org/reiniero/fpc_laz_patch_playground/change
> set/6be7ed0edb4b
>
Downloaded the code and it raises an SUnsupportedFieldType when creating the ftAutoInc field. That is OK since I didn't include ftAutoinc in the supported list for TBufDataset. If you are not getting this error, then the patch and/or install didn't work.
> (It seems getting the value from the ftVariant field gives an
> access violation, but I'm not sure)
>
> Thanks,
> Reinier
>
>
>
> Some output from the test:
> *** Starting to fill row 1
> <snip>
> Field: ftString_256 has value Douglas Adams less than: < greater than
> > tab: crlf:
> åœ‹ç¼ºç•Œå¹¿æ¬ å»£ç•Œç•Œä¸œç¼º. Haddock drinks rosé (ros, e
> accent aigu), водка (wodka cyrillic) and οÏζο (ouzo
> Greek) but prefers Loch Lomond whiskey.
> Field: ftTime has value 23:59:59
> Field: ftTypedBinary has value
> Field: ftVariant: error retrieving value:
> EAccessViolation; detailed error message: Access violation
> Field: ftVarBytes has value Douglas Ad
> <snip>
> EAccessViolation; detailed error message: Access violat
> Time:00.027 N:8 E:7 F:0 I:0
> Ttestxmlxsdexport1 Time:00.027 N:8 E:7 F:0 I:0
> 00.003 TestXSDExport_Access_NoXSD_Decimal Error:
> EAccessViolation
> Exception: Access violation
> Source unit:
> Method name:
> Line number: 574
> 00.003 TestXSDExport_Access_NoXSD_NoDecimal Error:
Line 547 is where FillTestData is called. Not very usefull.
I do get a segfault in the last test when assigning to ftWideString256. When tracing the code it crashes when moving the size+1 chracters to the database. This fixed length moving is fundamentally wrong. The string is only 20 or so chars long and TCustomBufDataset.SetFieldData tries to do a move of the full 514 bytes (256+1)*2. This asking for trouble. The source of the data is here a temporary WideString created by casting a string, so probably on the heap. Reading 514 bytes when only 40 odd where allocated is not always working....
I'll try to fix that one also.
Ludo
More information about the fpc-pascal
mailing list