how to read a variable upon insert?

Поиск
Список
Период
Сортировка
От Brian
Тема how to read a variable upon insert?
Дата
Msg-id Pine.LNX.4.10.9904132242030.32097-100000@mercury.shreve.net
обсуждение исходный текст
Список pgsql-general
I am running Postgres 6.3.2 and have a question.

I have a field, called "idnum", that automagically gets assigned a value
when something is inserted.  I want to know that value when I do the
insert:

  $sth = $dbh->prepare("INSERT INTO foo (bar) VALUES('$bar')");
  $sth->execute;
  $insertid = $sth->{'idnum'};



I would think that last line should be able to retreive it from the
statment handle, but it doesn't work.

Is the only way, to do *another* select after I insert and get the data?
I would hope after doing the insert, since I have the statment handle, I
could get the value.

Brian


-----------------------------------------------------
Brian Feeny (BF304)     signal@shreve.net
318-222-2638 x 109    http://www.shreve.net/~signal
Network Administrator   ShreveNet Inc. (ASN 11881)


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

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: Re: [GENERAL] Would this project be of interest to anyone?
Следующее
От: "Gene Selkov, Jr."
Дата:
Сообщение: a propos printed books on postgresql