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            [EMAIL PROTECTED]
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

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to