[Lazarus] Handy script for Firebird users

Graeme Geldenhuys graemeg.lists at gmail.com
Thu May 1 13:30:53 CEST 2008


2008/4/30 mramirez <lazarus.mramirez@******.com>:
>
>  Not everyone has the time to a SQL query in each table & verify that all
> values, for an integer field are either 0 o 1, or varchar(1) with "f" and
> "t".

Just for interest sake and completeness....  You don't have to do such
checks, the database does those for you....

CREATE DOMAIN D_BOOLEAN AS SMALLINT CHECK (VALUE IN (0, 1));

or if you prefer text boolean types.

CREATE DOMAIN D_BOOLEAN AS CHAR(1) CHECK (VALUE IN ('T', 'F'));

Now create a table with a field of type D_BOOLEAN


I use tiOPF for object persistence. My business objects all use native
object pascal types (Boolean being one of them) and the database
persistences layer does the conversion to whatever I setup in the
database. Boolean as T/F or Boolean as 1/0 in the database.


Just my 2c response. :-)


Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the Lazarus mailing list