Re: Class::DBI _auto_increment_value update/suggestion

[prev] [thread] [next] [Date index for 2005/06/23]

From: Tim Bunce
Subject: Re: Class::DBI _auto_increment_value update/suggestion
Date: 21:28 on 23 Jun 2005
On Thu, Jun 23, 2005 at 02:06:49PM +0100, Tony Bowden wrote:
> On Wed, Jun 22, 2005 at 08:42:55PM +0100, larodi@xxxxx.xxx wrote:
> >    DBI actually provides the last_insert_id method since v1.38 (nb:
> > current DBI version is 1.48) and most DB drivers already handle it
> > properly. That's why I believe the above two lines should be replaced
> > with something like:
> >    my $id  = $dbh->last_insert_id(undef, undef, $self->table, undef );
> 
> Tim, does this sound like a good idea?

Yes, though "most DB drivers already handle it" may be a little optimistic.

It returns undef "if the driver does not support the method or can't
determine the value" so if you get an undef you're no worse off than before.

Tim.

Re: Class::DBI _auto_increment_value update/suggestion
Tim Bunce 21:28 on 23 Jun 2005

Generated at 16:35 on 28 Jul 2005 by mariachi v0.52