Re: Retrieve OID from newly added record

2000-11-08 Thread Buddy Lee Haystack

Be warned that the OID field for a PostgreSQL record may not always be a unique value. 
 Visit the PostgreSQL Hackers list for more information. 

Consider creating your own unique value using a combination of time/IP/random number, 
or using a sequence. Although the condition rarely arises, it has bitten a few people. 
Don't make the same mistake I did.

Have Fun!

Tim Tompkins wrote:
 
 According to the DBD::Pg docs,
 
 $sth-pg_oid_status
 Returns the OID of the last INSERT command.
 
 See: http://theoryx5.uwinnipeg.ca/CPAN/data/DBD-Pg/dbd-pg.html
 
 Thanks,
 
 Tim Tompkins
 --
 Programmer / Staff Engineer
 http://www.arttoday.com/
 --
 - Original Message -
 From: "cbell" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, November 07, 2000 1:28 PM
 Subject: Retrieve OID from newly added record
 
  Hello everyone, does anyone know how to retrieve the Object Identifier
  (OID) from a record that was just inserted into a postgres database from
  within perl?
 
  These are the commands I'm using to insert the record:
 
  $sth = $dbh-prepare("Insert into inventory Values ($id)");
  $rc = $sth-execute;
 
  $rc will tell me whether or not the insert was successful or not, but
  that's it.
 
  If I insert records from the psql utility, the OID is returned on the
  screen after the insert, so I know it's there.  I just need to know how
  to get it from within modperl.  I want to get this number so I can
  insert a bunch of records in another file using the OID as the key.
 
  Thanks in advance!
 
 

-- 
BLH
www.RentZone.org



Retrieve OID from newly added record

2000-11-07 Thread cbell

Hello everyone, does anyone know how to retrieve the Object Identifier
(OID) from a record that was just inserted into a postgres database from
within perl?

These are the commands I'm using to insert the record:

$sth = $dbh-prepare("Insert into inventory Values ($id)");
$rc = $sth-execute;

$rc will tell me whether or not the insert was successful or not, but
that's it.

If I insert records from the psql utility, the OID is returned on the
screen after the insert, so I know it's there.  I just need to know how
to get it from within modperl.  I want to get this number so I can
insert a bunch of records in another file using the OID as the key.

Thanks in advance!




Retrieve OID from newly added record

2000-11-07 Thread cbell

Hello everyone, does anyone know how to retrieve the Object Identifier
(OID) from a record that was just inserted into a postgres database from

within modperl?

These are the commands I'm using to insert the record:

$sth = $dbh-prepare("Insert into inventory Values ($id)");
$rc = $sth-execute;

$rc will tell me whether or not the insert was successful or not, but
that's it.

If I insert records from the psql utility, the OID is returned on the
screen after the insert, so I know it's there.  I just need to know how
to get it from within modperl.  I want to get this number so I can
insert a bunch of records in another file using the OID as the key.

Thanks in advance!




Re: Retrieve OID from newly added record

2000-11-07 Thread Tim Tompkins

According to the DBD::Pg docs,

$sth-pg_oid_status 
Returns the OID of the last INSERT command. 

See: http://theoryx5.uwinnipeg.ca/CPAN/data/DBD-Pg/dbd-pg.html 


Thanks,
 
Tim Tompkins
--
Programmer / Staff Engineer
http://www.arttoday.com/  
-- 
- Original Message - 
From: "cbell" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, November 07, 2000 1:28 PM
Subject: Retrieve OID from newly added record


 Hello everyone, does anyone know how to retrieve the Object Identifier
 (OID) from a record that was just inserted into a postgres database from
 within perl?
 
 These are the commands I'm using to insert the record:
 
 $sth = $dbh-prepare("Insert into inventory Values ($id)");
 $rc = $sth-execute;
 
 $rc will tell me whether or not the insert was successful or not, but
 that's it.
 
 If I insert records from the psql utility, the OID is returned on the
 screen after the insert, so I know it's there.  I just need to know how
 to get it from within modperl.  I want to get this number so I can
 insert a bunch of records in another file using the OID as the key.
 
 Thanks in advance!