From: scott.marlowe <scott.marlowe@ihs.com>
To: William <DarkCancerian@netscape.net>
Cc: info@pgsql.com
Cc: Marc G. Fournier <scrappy@hub.org>
Cc: pgsql-php@postgresql.org
Subject: Re: Inquiry From Form [pgsql]
Date: Mon, 18 Nov 2002 10:07:26 -0700 (MST)
Message-ID: <Pine.LNX.4.33.0211181004390.17026-100000@css120.ihs.com> (raw)
In-Reply-To: <20021115222409.C2DD78A1A87@hub.org>
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?
Not really. The only issue is if you used MySQL proprietary stuff.
There's a lot of things in MySQL that are workarounds for it not being a
transactional database that won't work in Postgresql, but using the
"right" method (i.e. a transaction or ANSI SQL) will work just fine.
The only other thing to change is your mysql_xxx commands to pgsql_xxx
commands.
Also, Postgresql doesn't have a pgsql_lastinsert_id like MySQL, instead,
you do it like this:
(Warning pseudocode... :-)
begin;
insert into table yada (field1, field2) values (val1, val2);
select currval('yada_seq');
insert into table yada_child (field1, field2, y_id) values (val1, val2,
y_id);
commit;
i.e. you use currval('seqname') to find out what the id was that was just
inserted.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: scott.marlowe@ihs.com, DarkCancerian@netscape.net, info@pgsql.com, scrappy@hub.org
Subject: Re: Inquiry From Form [pgsql]
In-Reply-To: <Pine.LNX.4.33.0211181004390.17026-100000@css120.ihs.com>
References: <20021115222409.C2DD78A1A87@hub.org> <Pine.LNX.4.33.0211181004390.17026-100000@css120.ihs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox