Saturday, March 18, 2006

Small Firebird trigger example

After reading a post in the Firebird forum at Devshed I immediately put up a small example about writing a trigger (and also upgraded my favourite tool, Flamerobin, to the latest version) , here it goes:

1. Create an empty table












2. Create the trigger on it using Flamerobin's guided menu




As you can see the menu will guide you through defining the trigger name, to activate it (in other words you can deactivate triggers without deleting them), setting it to fire before or after a DML statement (insert/update/delete) and also define it's position, which means that many triggers with the same action (i.e. "before insert") can exist on the same table and the position will tell the firing order.
Now the trigger code:

SET TERM ^ ;

CREATE TRIGGER modified_when FOR TEST_TABLE
ACTIVE BEFORE INSERT OR UPDATE POSITION 0
AS
BEGIN
/* enter trigger code here */
NEW.updated_at = CURRENT_TIMESTAMP;

END^

SET TERM ; ^


Note that after every DML and DDL statement you need to commit to make changes effective.
Now the test phase, I'll insert a dummy row:

insert into test_table (name_field) values ('pippo');

And check for the insert result completed by the trigger action:


See the result? ;-)

More infos about triggers in Firebird can be found in this article.

BTW: isn't Flamerobin's code autocompletion great?

Tuesday, March 14, 2006

GIMP 2.3.7 on WinXP

After many difficulties with preceding development releases I finally succeeded in compiling The GIMP on WinXP with MinGW.
Right now I only used a simple --configure --disable-print --disable-python --prefix=/d/gimp237 but I'll try with more complex config options and also adding littlecms to the pack, see some screenshots below

Thursday, March 09, 2006

MySQL Workbench 1.0.5 beta ...

... nice, but not quite there yet.
I mean, it has a clean look at I processed the ported Firebird Employee database of my previous posts to check it's reverse engineering abilities, everything went smooth for tables and views (and foreign keys too!), but unfortunately no triggers and stored procs where reverse engineered.
Here is the visual cronicle:

Connection to database:










After the connection MySQL Workbench does a first roundtrip to retrieve structures:











Once structures are retrieved it offers you the option to choose which database to revers:












Right after the database selection you are asked to specify which objects belonging to it are going to be reverse engineered:











Reverse engineering is done:











Checking the result:










Exporting to sql:











Bye ;-)