Re: FAQ error
От | Alessio Bragadini |
---|---|
Тема | Re: FAQ error |
Дата | |
Msg-id | 3BC58318.CB0828DB@albourne.com обсуждение исходный текст |
Ответ на | FAQ error (Bruce Momjian <pgman@candle.pha.pa.us>) |
Список | pgsql-hackers |
Bruce Momjian wrote: > $newSerialID = nextval('person_id_seq'); > INSERT INTO person (id, name) VALUES ($newSerialID, 'Blaise Pascal'); > > Is this correct Perl? I don't see a nextval() function in Perl. Can > you call SQL server-side functions natively from Perl? Ofcourse not. This can be counted as 'pseudo-code'... A correct implementation using DBI (and DBD::Pg) would be $newSerialID = $dbh->selectrow_array (q{select nextval('person_id_seq')}); $dbh->do (qq{INSERT INTO person (id, name) VALUES ($newSerialID, 'Blaise Pascal')}); -- Alessio F. Bragadini alessio@albourne.com APL Financial Services http://village.albourne.com Nicosia, Cyprus phone: +357-2-755750 "It is more complicated than you think" -- The Eighth Networking Truth from RFC 1925
В списке pgsql-hackers по дате отправления: