Re: prepare, execute & oids

Поиск
Список
Период
Сортировка
От phazon
Тема Re: prepare, execute & oids
Дата
Msg-id 94ffdc2e0608020025i1d5d26e8if8971b09468b221@mail.gmail.com
обсуждение исходный текст
Ответ на Re: prepare, execute & oids  (Michael Fuhr <mike@fuhr.org>)
Ответы Re: prepare, execute & oids  (Martijn van Oosterhout <kleptog@svana.org>)
Re: prepare, execute & oids  (Chris <dmagick@gmail.com>)
Re: prepare, execute & oids  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
I use PHP.
When I make juste a simple insert like

Insert Into my_table (my_field) values ('value')

I get back the OID of the inserted line.

But when i use the prepareInsert fonction, I get nothing back. That's a pprobleme becaus i need to take the primary key of the line inserted in order to make post-operations.

I can't use the curval of a sequence because it can be the value of another insert made by another user.

I use a prepare function because it's really faster (I need to insert many entries, nearly 5000) and i look for any way to make it faster and get the primary key of all the line inserted.

2006/8/1, Michael Fuhr <mike@fuhr.org>:
On Tue, Aug 01, 2006 at 06:19:29PM +0200, phazon wrote:
> I juste want to get the OID of the line inserted. Does anyone know how to do
> it ?

It depends on the client interface.  What interface are you using?

OIDs are deprecated as row identifiers; the preferred method is to
use a sequence (serial column).  To get a sequence's value you can
use currval() or lastval() (the latter available in 8.1).

--
Michael Fuhr

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

Предыдущее
От: Flemming Frandsen
Дата:
Сообщение: Re: LISTEN considered dangerous
Следующее
От: "Christian Rengstl"
Дата:
Сообщение: Strange error message