Subject Re: [firebird-support] Right-padded char fields?
Author Milan Babuskov
Kjell Rilbe wrote:
> In a databse with default charset UTF8 I have a couple of char(1) and
> char(2) columns. I know these are implemented as char(4) and char(8)
> behind the scenes to make room for the "worst case" encoding in UTF8,
> but it seems that this shines through a bit too much.
>
> In FlameRobin a select on these columns the displayed data is
> right-padded with 3 and 6 spaces respectively.
>
> Is this:
>
> 1. A Firebird bug?
>
> 2. A Firebird "feature" (= as designed)? (Why?)
>
> 3. A FlameRobin bug?

I can confirm the behaviour. It's interesting that reported column size
by IBPP is 4 and 8 respectively. IBPP uses a code like this:

XSQLVAR* var = &(mDescrArea->sqlvar[varnum-1]);
return var->sqllen;

So, for select statement that selects CHAR(1) column, var->sqllen
returns 4, and for CHAR(2) it returns 8. Apparently, strings get padded
that much as well? Anyway, I just tested with pure IBPP code and it does
return spaces - so the problem is either in Firebird or IBPP. I'm Cc-ing
the IBPP list, so maybe Olivier will reply as well.

I'd love to be able to test with isql, but it seems that it trims chars
before displaying.

--
Milan Babuskov
http://www.flamerobin.org
http://www.guacosoft.com