Inquiry From Form [pgsql]

From: brew(at)theMode(dot)com
To: pgsql-php(at)postgresql(dot)org
Subject: Inquiry From Form [pgsql]
Date: 2002-11-17 10:43:16
Message-ID: Pine.BSF.4.44.0211170524530.37645-100000@themode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php


On Fri, 15 Nov 2002, William wrote:

> I code with PHP and use it to communicate with MySQL, if I started using
> PostgreSQL would I have to change my coding to communicate with the
> database?

Probably, but only slightly.

I changed my DB from MySQL to PostgreSQL and had to change each SQL call
slightly. It seems to me the difference was PostgreSQL needs to know the
number of rows gotten and then loop through them with a for loop, with
MySQL I was able to use a while loop without checking the number of rows
first.

It could have been my inexperience that caused me to miss the obvious,
though.

In perl there is the DBI module and php has DBX. With it you use a common
calling cenvention across a bunch of Databases (FrontBase, Microsoft SQL
Server, MySQL, ODBC, PostgreSQL, Sybase-CT, Oracle)

From the manual at php.net:

-----------------------------------------------

The dbx functions allow you to access all supported databases using a
single calling convention. The dbx-functions themselves do not interface
directly to the databases, but interface to the modules that are used to
support these databases.

-----------------------------------------------

Of course, not all these DBs offer the same features, so you'd still not
be database independent unless you limit your DB calls to the common ones,
most likely SELECT, INSERT, UPDATE, and DELETE. But if you are using
MySQL maybe that's all you are doing anyway.......

I don't have the dbx module available on my machine and since I'm
committed to using (and learning more about) PostgreSQL I don't use the
dbx. But it seems it would be a good way to go......

Maybe someone else will chime in with more info.

brew

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Budi Rianto 2002-11-18 04:48:41 Re: Inquiry From Form [pgsql]
Previous Message Digital Wokan 2002-11-15 23:08:05 Re: Transaction including two web page + timer