Обсуждение: Porting MySQL PHP to Postgres

Поиск
Список
Период
Сортировка

Porting MySQL PHP to Postgres

От
Shaun Clements
Дата:

Hi All

I am going to attempt to move an Intranet Application across from MySQL, to Postgres.
I would like to know is there any best method / tool to do this.
The application is written in PHP. Perhaps there is someone who is using Postgres, who had this problem.

Thanks in advance.

Kind Regards,
Shaun Clements

Re: Porting MySQL PHP to Postgres

От
Russell Smith
Дата:
On Mon, 21 Feb 2005 08:41 pm, you wrote:
> Hi All
>
> I am going to attempt to move an Intranet Application across from MySQL, to
> Postgres.
> I would like to know is there any best method / tool to do this.
> The application is written in PHP. Perhaps there is someone who is using
> Postgres, who had this problem.
>
I can be simple or it can be hard.

It all depends on the complexity, and setup of the PHP scripts.

You may just need to change mysql_query for pg_query, the open and close
function, and it might just mostly work.  However if you app has mysql specific
code, or you are using some complicated classes to manage it, it may be harder to
port.

Unless the application is known, it difficult to give any real analysis on the difficulty of
the task.

Regards

Russell Smith.

> Thanks in advance.
>
> Kind Regards,
> Shaun Clements
>

Re: Porting MySQL PHP to Postgres

От
Shaun Clements
Дата:

Hi Russel

I assumed as much. I was hoping there was a tool available which someone had used and (or) what kind of stumbling blocks to run into.

Thanks again.

Kind Regards,
Shaun Clements

-----Original Message-----
From: Russell Smith [mailto:mr-russ@pws.com.au]
Sent: 21 February 2005 12:38 PM
To: Shaun Clements
Cc: Postgres general mailing list
Subject: Re: [GENERAL] Porting MySQL PHP to Postgres

On Mon, 21 Feb 2005 08:41 pm, you wrote:
> Hi All
>
> I am going to attempt to move an Intranet Application across from MySQL, to
> Postgres.
> I would like to know is there any best method / tool to do this.
> The application is written in PHP. Perhaps there is someone who is using
> Postgres, who had this problem.
>
I can be simple or it can be hard.

It all depends on the complexity, and setup of the PHP scripts.

You may just need to change mysql_query for pg_query, the open and close
function, and it might just mostly work.  However if you app has mysql specific
code, or you are using some complicated classes to manage it, it may be harder to
port.

Unless the application is known, it difficult to give any real analysis on the difficulty of
the task.

Regards

Russell Smith.

> Thanks in advance.
>
> Kind Regards,
> Shaun Clements
>

Re: Porting MySQL PHP to Postgres

От
Matt Kynaston
Дата:
Shaun Clements wrote:

I assumed as much. I was hoping there was a tool available which someone had used and (or) what kind of stumbling blocks to run into. There's useful articles at:
http://www.sitepoint.com/article/site-mysql-postgresql-1/2
http://www.raditha.com/postgres/
and a mysql2pgsql script (that I've never tried) at:
http://www.raditha.com/blog/archives/000497.html

In the PHP code itself, mysql_insert_id() is a big one with no direct equivalent.

Since it's an intranet app, the overhead of using one of the abstraction layers like DB or MDB might not be a huge problem. It'd make stuff like the above easier:
http://pear.php.net/packages.php?catpid=7&catname=Database

Or if you're on PHP5 and feel like catching a few bugs, check out PDO:
http://pecl.php.net/package/PDO

In the SQL, watch out for GROUP BYs without all column names used in the SELECT specified and the syntax of LIMIT. And I'm sure there's other gotchas I can't remember. But on the whole you should find Postgres is able to do far more things (like UNION, unavail in older version of MySQL): if you've got the time it'd probably pay to rethink some of the brain-dead things That Other RDBMS (TM) makes you do.

Enjoy!

Matt