[prev in list] [next in list] [prev in thread] [next in thread] 

List:       msql-mysql-modules
Subject:    Re: Last_Insert_ID
From:       Jochen Wiedmann <jochen.wiedmann () freenet ! de>
Date:       2004-06-14 10:28:47
Message-ID: 1087208927.2436.39.camel () localhost ! localdomain
[Download RAW message or body]


Any threads in use? Besides, what version of the driver are you using? 


On Mo, 2004-06-14 at 12:01, Scott Simpson wrote:
> Dear All,
>  
> I am working with an older version 3.23.54 of MySQL.  I have a subroutine
> like this:
>  
> sub c_new
> {
>             my ($dbh, $params) = @_;
>             my $query = qq{INSERT INTO t_masts (f_site, f_name) VALUES
> ('$params->{f_site}', '$params->{f_name}')};
>             my $sth = $dbh->prepare(qq{$query});
>             $sth->execute(); 
>             $query = qq{SELECT LAST_INSERT_ID() from t_masts};
>             $sth = $dbh->prepare(qq{$query});
>             my $last_id = $sth->execute();
>             $sth->finish();
>             return $last_id;
> }
>  
> Which returns the ID of the last record inserted into t_masts.  Except that
> after deleting record(s) from t_masts the subroutine returns the number of
> records in t_masts (which is less than the ID of the record inserted and
> it's that  ID I want).  My reading of the DuBois's book is that this should
> work in version 3.23 upward.
>  
> Can anyone point out what I have missed?
>  
> Regards,
> Scott
>  

-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/perl?unsub=msql-mysql-modules@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic