Subject | Re: [firebird-support] Equivalent to ENUM? |
---|---|
Author | The Wogster |
Post date | 2006-02-28T03:01:58Z |
Robin Davis wrote:
this:
CREATE TRIGGER FIX_BOOL_FIELD FOR MY_TABLE BEFORE UPDATE
BEGIN
IF ( NEW.BOOLFIELD <> 0 ) THEN NEW.BOOLFIELD = -1;
END;
Where BOOLFIELD is the "boolean" field you want.
This would really allow the Front end to set the boolean to anything,
since true is actually not false. Realistically Access or OpenOffice
should assume that 0 is false, and anything else is true, for a checkbox.
One thing you do want to do, is make sure that Access is using native
SQL, Access traditionally does things within the client, that should be
done in the database. For example say your Customer Table has 1,000,000
records and your parts table has 1,000,000,000 records, your orders
table contains both the customer number and part number and you want to
read a specific orders customer and parts detail. A three table join
passed to Access will read the ENTIRE customer table, parts table and
order_detail table, and execute it's own SQL on the result. Performance
wise this really, really sucks.
You also want to build all the business rules into the database, and
gradually move the users away from General purpose tools to a specific
application that does what they need to do.
W
> Sorry for that badly formed message, I was very tired when I wrote that!Probably the best solution would be a trigger, then code the inside like
>
> To explain more fully, they want to use Access as their front end, but I
> want to use OpenOffice. Access sees boolean as 0 and -1, and Openoffice
> sees boolean as 0 and 1, so I just wondered if there was a way of
> forcing either program to match the other, as ENUM does in MySql.
this:
CREATE TRIGGER FIX_BOOL_FIELD FOR MY_TABLE BEFORE UPDATE
BEGIN
IF ( NEW.BOOLFIELD <> 0 ) THEN NEW.BOOLFIELD = -1;
END;
Where BOOLFIELD is the "boolean" field you want.
This would really allow the Front end to set the boolean to anything,
since true is actually not false. Realistically Access or OpenOffice
should assume that 0 is false, and anything else is true, for a checkbox.
One thing you do want to do, is make sure that Access is using native
SQL, Access traditionally does things within the client, that should be
done in the database. For example say your Customer Table has 1,000,000
records and your parts table has 1,000,000,000 records, your orders
table contains both the customer number and part number and you want to
read a specific orders customer and parts detail. A three table join
passed to Access will read the ENTIRE customer table, parts table and
order_detail table, and execute it's own SQL on the result. Performance
wise this really, really sucks.
You also want to build all the business rules into the database, and
gradually move the users away from General purpose tools to a specific
application that does what they need to do.
W