Main | SubVersion to CVS commit tool »

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.

TrackBack

TrackBack URL for this entry:
http://blog.rot13.org/mt/mt-tb.cgi/472

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on March 5, 2004 11:35 AM.

The next post in this blog is SubVersion to CVS commit tool.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 4.1