Subject Re: Catching True and False of the SQL statement.
Author Svein Erling Tysvær
Hi Joël!

I'm sorry to say that I think you have to change your SQL statements.
Firebird knows numbers, strings and dates, but writing TRUE without
any quotes around makes Firebird believe it is a column or a reserved
word. I suppose you could add TRUE and FALSE as new columns in your
table and try to hack your way out, but that would at best be a lousy
replacement for changing your application the proper way. I don't
think there is a way to create new constants that can be used directly
in an SQL statement, though writing two UDFs or stored procedures and
call them using TRUE() and FALSE() might work. Still, changing your
code is the proper way to do things and that should give you the least
trouble in the future.

Sorry,
Set

--- In firebird-support@yahoogroups.com, jgijbels wrote:
> Hi All,
>
> Have a question about the Boolean type. After adding a domain with
> this code:
> CREATE DOMAIN D_BOOLEAN AS
> SMALLINT
> DEFAULT 0
> CHECK (value BETWEEN -1 and 0)
>
> I created a Boolean as I found the information somenwhere on the
> internet. I used -1 for True because this is standard for VB.NET
> (which I use).
> Now my problem is I have a full application running on a MSAccess
> database (which I'm changing to Firebird of course). But when I do
> an UPDATE or INSERT query with True or False in it, I get an error:
> Column does not belong to referenced table.
> Dynamic SQL Error.
> SQL error code = -206.
> Column unknown.
> TRUE.
> At line 3, column 73.
>
> Now I was wondering, is there a way to catch the False and True and
> change them to an integer (resp. 0 and -1), before the triggering of
> they error (maybe in a trigger "before update/insert"???). Otherwise
> I'm obligated to change all SQL statements in my application... I
> don't fancy this solution, as you would guess.
>
> Thanks in advance and God bless you,
>
> Joël.