Re: Inquiry From Form [pgsql]

Поиск
Список
Период
Сортировка
От scott.marlowe
Тема Re: Inquiry From Form [pgsql]
Дата
Msg-id Pine.LNX.4.33.0211181004390.17026-100000@css120.ihs.com
обсуждение исходный текст
Ответ на Inquiry From Form [pgsql]  (William <DarkCancerian@netscape.net>)
Ответы Re: Inquiry From Form [pgsql]  (Keary Suska <hierophant@pcisys.net>)
Список 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?

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.


В списке pgsql-php по дате отправления:

Предыдущее
От: Adam Witney
Дата:
Сообщение: Re: Transaction including two web page + timer
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: Inquiry From Form [pgsql]