How do I get the rec-id from an insert.

Поиск
Список
Период
Сортировка
От Chris Ruprecht
Тема How do I get the rec-id from an insert.
Дата
Msg-id 200208272340.17513.chris@cdrbill.com
обсуждение исходный текст
Ответы Re: How do I get the rec-id from an insert.  (Clinton Adams <clinton@vote-smart.org>)
Список pgsql-php
Hi all,

I have 3 tables:

a:
a.recid
a.name

b:
b.recid
b.address
b.city

c:
c.recid
c.arecid
c.brecid


each has a default sequence on their respective recid - which is the primary
index.

when I do an "insert into a ...", it automagically assigns recid a new, unique
value, same goes for b.

But to create c, I need to know the recid from a and b, so I can connect the
two.
Is there any way to get the recid from a and b after they have been inserted
like in "insert into a ... and give me the recid you're going to use, back"?

I know, I can do a "netxval('...')" stuff and then insert the records with
values in recid, but that requires two extra calls to the DB per transaction.

Best regards,
Chris



--
Chris Ruprecht
Network Grunt and bitpusher extraordinaire

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

Предыдущее
От: Chris Ruprecht
Дата:
Сообщение: New PHP/PG functions
Следующее
От: "Cornelia Boenigk"
Дата:
Сообщение: Re: Where can I get error messages?