Subject Query returning incorrect data
Author phil_hhn
Hi, I have a strange situation; it's an error that occurs in our java
application connected to the database via jaybird, but not if I run
the same query via IBExpert.

I have Firebird 1.5.5 (windows superserver), Jaybird 2.1.6. The
database is UNICODE_FSS (as are all varchar, char columns), hence when
opening the jdbc connection I specify the encoding to be UNICODE_FSS.
I can insert and retrieve (select) data ok (eg european characters,
arabic, etc).
However I have the following query:
"select (case when status=1 then 'Yes' else 'No' end) as FlagStr from
mytable"

I have a record in mytable where the status is 1. When I run the query
in IBExpert it returns a column value of 'Yes', but when I run it via
my application it returns 'Y'! Any idea why this is?
I thought maybe it's a transcoding error, i.e because the jdbc
encoding type is set to UNICODE_FSS that I need to cast the result of
the case statement to UNICODE_FSS in some way but I cannot get it to
work correctly. If this what I need to do, and if so, can someone give
an example of how to do it? (Or have I encountered a jdbc bug?)

Disclaimer! ( ;-) )
1) We are stuck with FB 1.5.5 for a while and when we go to FB 2.1.1
we'll change to UTF-8... so not sure if the same problem will exist
there, but for now we must fix it for FB 1.5.5
2) I don't like this type of end-user text hard-coded within SQL
(makes i18n hard!) but for now this code needs to stay :(

Thanks in advance,
Phil