Wrong string length in VariantToBuffer

Issue #62 resolved
Václav Čejka created an issue

Procedure TAbstractObjectDataset.VariantToBuffer for Field.DataType = ftString on Windows uses SysStringLen function. This function supposes that given string in [-1] item has number of bytes of the string (you can see it in disassembly of this function, at least on my Win8.1Pro). However it is stored using typical Delphi definition with number of characters, which is half the number of bytes for Unicode strings.

The result is shortened string recieved by TAbstractObjectDataset.GetFieldData and in any further operation.

Tested on commit 037bc65 (15.12.2014) of Marchmallow branch.

Comments (11)

  1. Václav Čejka reporter

    The problem does not occur in all string fields. In my case it occurs only with lookup string fields, but direct data string field works. Transliterate must be On (default), with Off value "False" occurs. I'll post some minimalistic project, but today is too late.

  2. Václav Čejka reporter

    Another interesting point: the issue accurs for LookupCache = True for lookup string column. For LookupCache = False, field has always value "False".

  3. Log in to comment