Subject | RE: [firebird-support] varchar(2048) holds 1012 |
---|---|
Author | Helen Borrie |
Post date | 2004-01-01T01:45:30Z |
At 12:08 PM 1/01/2004 +1100, Alan McDonald wrote:
This isn't correct. A varchar(2048) will store 2048 characters of its
defined character set, regardless. If character set is NONE, the column
will be 2050 bytes wide (varchar has two bytes reserved for length). If,
for example, the input is UNICODE_FSS, then the column would need to be
6146 bytes wide to store 2048 UNICODE_FSS characters, but it would still be
varchar(2048).
An overflow (i.e. string truncation) could occur if the input was coming
through as "too many" multi-byte characters for storage into a cs NONE
column, i.e. more than 2048 bytes That still doesn't account for the
arithmetic exception indicated by the sqlcode.
/heLen
>What character set are you using? depending on which one, you may not getAlan,
>anywhere near the char size of the field. If NONE, then you should get all
>2048
This isn't correct. A varchar(2048) will store 2048 characters of its
defined character set, regardless. If character set is NONE, the column
will be 2050 bytes wide (varchar has two bytes reserved for length). If,
for example, the input is UNICODE_FSS, then the column would need to be
6146 bytes wide to store 2048 UNICODE_FSS characters, but it would still be
varchar(2048).
An overflow (i.e. string truncation) could occur if the input was coming
through as "too many" multi-byte characters for storage into a cs NONE
column, i.e. more than 2048 bytes That still doesn't account for the
arithmetic exception indicated by the sqlcode.
/heLen