Porting PHP software from MySQL to PostgreSQL

While working on porting of LibData to PostgreSQL I created small toolkit which might be useful when converting application from MySQL to PostgreSQL.

Procedure is simple, first replace all calls for mysql_* functions to xx_* (so that program will call our wrapper functions -- there is script for that mysql2xx.sh) and then include one file which has wrapper from xx_* back to mysql_* or (with some more logic) to pg_*.

This toolkit is not complete wrapper for all mysql_* functions, but most projects don't use all functions anyway.

After conversion of database using my2pg.pl you have more-or-less working application on PostgreSQL. There are some problems: MySQL accepts '' (empty string) as null value for columns which are defined as integer, and that won't work in PostgreSQL. Right solution is to rewrite php code to use something like Pear DB with placeholders, and I will probably do that.