Re: AutoIncrement Database Fields for MySQL and PostGreSQL

2005-04-11 Thread Bob Showalter
Siegfried Heintze wrote: Thanks. I see that works for mysql. "my $lastid = $dbh->{mysql_insertid};" Is this a feature of MySQL or DBI? It's a feature of MySQL, via the DBD::mysql driver. If it is not a feature of DBI, will it work for PostGreSQL? No, but there is a similar feature. Read the docs fo

RE: AutoIncrement Database Fields for MySQL and PostGreSQL

2005-04-11 Thread Siegfried Heintze
Thanks. I see that works for mysql. "my $lastid = $dbh->{mysql_insertid};" Is this a feature of MySQL or DBI? If it is not a feature of DBI, will it work for PostGreSQL? Thanks, Siegfried -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: AutoIncrement Database Fields for MySQL and PostGreSQL

2005-04-11 Thread Bob Showalter
Siegfried Heintze wrote: If I use the auto-increment feature for a couple of normalized relations, how do I insert into them? Specifically, when I insert into a relation with the autoincrement feature on the primary key, how do I get the value of the index on the newly created row so I can use that

Re: AutoIncrement Database Fields for MySQL and PostGreSQL

2005-04-11 Thread toolscripts
"SELECT MAX(id)+1 as lastid FROM table" (It's not +1 if you already said INSERT etc) I'm not sure what normalized relations are, but I think this will help anyway. --t - Original Message - From: "Siegfried Heintze" <[EMAIL PROTECTED]> To: "'Perl Beginners'" Sent: Monday, April 11, 200