Hi,
I noticed you guys are using PEAR::DB. Looking at rcube_db.inc there is already a bit of conditional code for databases (although I am not sure if you really need the special connect treatment for sqlite). However your lastinsertid handling is for example integrated in MDB2 via the lastInsertID() method (and yes it will work on pgsql as you expect).
Furthermore MDB2 can also handle table creation and altering. Through MDB2_Schema it can even do so in a single xml schema file that can automatically determine what create, drop and alter statements are needed which it can then execute or you can extract into an SQL file.
As for your handling of NOW(). Currently MDB2 handles this through MDB2_Date. However there have always been plans to add a module that will generate the necessary SQL to make SQL functions portable.
Another cool thing I have done for my framework when serializing strings into the database is to add a new abstract datatype to MDB2 which means that MDB2 automatically handles serializing and unserializing for me. Overall you will notice that MDB2 has much more detailed support for datatypes.
If you are interested about the current state of things in MDB2 you may want to check out my blog: http://pooteeweet.org/
regards, Lukas