I Often use this domains in my Firebird databases
So I can use them in my tables definitions like this:
Before Firebird 2.1 when I wanted to create a stored procedure I had to write the data type of the domain instead of the domain name, like in the table definition, so I had to check the domain definition and write the data type on the procedure definition, although IBExpert help with that, my Stored Proc definition end it up not using the domains like this:
Now with version 2.1 I can use domain in PSQL. I just need to type the domain name if i want to inheriting the check clause and the default value, or I can use the TYPE OF keyword if I just want the data type so I can define something like this:
This way it seems that there is more consistency on my data types.
CREATE DOMAIN STRING AS VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ES_ES_CI_AI; /* for Spanish text */
CREATE DOMAIN MONEY AS DECIMAL(15, 2);
CREATE DOMAIN BOOL AS SMALLINT CHECK VALUE = 0 OR VALUE = 1;
So I can use them in my tables definitions like this:
CREATE TABLE PRODUCTS(
ID INTEGER,
DESCRIPTION STRING,
PRICE MONEY,
ACTIVE BOOL
)
ALTER TABLE PRODUCTS ADD CONSTRAINT PK_PRODUCTOS PRIMARY KEY (ID);
Before Firebird 2.1 when I wanted to create a stored procedure I had to write the data type of the domain instead of the domain name, like in the table definition, so I had to check the domain definition and write the data type on the procedure definition, although IBExpert help with that, my Stored Proc definition end it up not using the domains like this:
CREATE PROCEDURE INSERT_PRODUCT(
DESCRIPTION VARCHAR(50),
PRICE DECIMAL(15, 2),
ACTIVE SMALLINT
)
BEGIN
...
END
Now with version 2.1 I can use domain in PSQL. I just need to type the domain name if i want to inheriting the check clause and the default value, or I can use the TYPE OF keyword if I just want the data type so I can define something like this:
CREATE PROCEDURE INSERT_PRODUCT(
DESCRIPTION STRING,
PRICE TYPE OF MONEY,
ACTIVE BOOL
)
BEGIN
...
END
This way it seems that there is more consistency on my data types.
That was really a nice and long waited feature for me.
ResponderBorrar=)
cool. I'm working with postrgresql for the last few months - but my heart belongs to firebird. When the project's finished, I might well write the (objective-c) data access layer so that it will talk to firebird.
ResponderBorrar