On 18/08/05, Steve Holdoway <[EMAIL PROTECTED]> wrote:
> 
> On Thu, August 18, 2005 8:18 pm, David Mann said:
> > On Aug 18, 2005, at 6:57 PM, Hadley Rich wrote:
> >
> >> It's much the same as using MySql, just replace mysql_ with pg_ i.e.
> >>
> >> mysql_fetch_array() becomes pg_fetch_array()
> >
> > You're basically right but you've omitted an important point: the
> > order of parameters is often different.
> > eg mysql_query(query_string[, connection]) vs pg_query([connection, ]
> > query_string).
> >
> > I don't know why but it is a bit annoying as I'm about to convert a
> > MySQL project to PostgreSQL, and a simple search-and-replace would
> > have made it much less time-consuming.
> >
> Why not use a function to wrap the mysql_... functions and swaps the
> parameters around to correctly call the pg_ functions? That way, the
> search and replace option becomes viable.

This sort of thing, as you might imagine, has come up many, many times before.
Google for ODBC. It is an intermediate layer between applications and
databases. Theoretically, it makes it much easier to switch between
database backends.

Cheers,
Carl.

Reply via email to