Subject Re: [firebird-support] Right-padded char fields?
Author Adriano dos Santos Fernandes
Ivan Prenosil escreveu:
> "Olivier Mascia" wrote:
>> By the way, I don't think the user of the API has use for the buffer
>> length. The buffer has been allocated by the API
>
> When you prepare the statement, API will return (among other informations)
> desired length of buffer. It is task of the application to allocate the buffer.
> When you then fetch the data, that length is again used by the API
> to verify whether the data fit.
> (Because you can allocate smaller buffer, provided you set its length
> in sqlvar structure appropriately. You can even change datatype
> and let FB do conversion for you, e.g. fetch integer data into varchar
> buffer, which then must be longer that 4 bytes.)
>

...

> or you can let FB return that length using VARCHAR format
> by single line of code which chages
>
> xsqlda^.sqlvar[col].sqltype := ...
>
AFAIR, this doesn't work at least for output buffers. You will have a
"message length error". And AFAIK, it can't work correctly for
CHAR->VARCHAR, because regardless of user supplied types, the data will
be sent to the client on the originally described type, so the client
can't correctly do it.


Adriano