|
bug in DBD::MySQL on Ubuntu / Sarge: msg#00042db.mysql.perl
Hi, I have come across a problem in DBD::MySQL while porting code from Woody to Sarge and Ubuntu (both hoary and breezy). The following script creates a simple test table and attempts to perform 6 updates. The first 3 updates work correctly, but in the final 3 updates, the key is erroneously taken as NULL: #! /usr/bin/perl5 -w use strict; use DBI; my $dbh = DBI->connect( "dbi:mysql:test:host=chadwick:port=3306", 'testuser', 'test', {RaiseError=>1, PrintError=>0} ); $dbh->do( "drop table if exists update_bug" ); $dbh->do( "create table update_bug( k int not null primary key, status int not null )" ); my $v = '4000930012345671'; $dbh->do( "update update_bug set status = 5 where k = ?", undef, substr( $v, -11 ) ); # OK $dbh->do( "update update_bug set status = 5 where k = ?", undef, substr( $v, -11 ) ); # OK cancel( $v ); # OK cancel( $v ); # bug - k is NULL cancel( $v ); # bug - k is NULL cancel( $v ); # bug - k is NULL sub cancel { my ( $dcref ) = @_; print "DCREF: $dcref\n"; $dbh->do( "update update_bug set status = 5 where k = ?", undef, substr( $dcref, -11 ) ); } In the Query log of the 4.1.11 database we're connecting to, we see: 060526 14:24:52 4605 Connect testuser@chadwick on test 4605 Query SET AUTOCOMMIT=1 4605 Query drop table if exists update_bug 4605 Query create table update_bug( k int not null primary key, status int not null ) 4605 Query update update_bug set status = 5 where k = '30012345671' 4605 Query update update_bug set status = 5 where k = '30012345671' 4605 Query update update_bug set status = 5 where k = '30012345671' 4605 Query update update_bug set status = 5 where k = NULL 4605 Query update update_bug set status = 5 where k = NULL 4605 Query update update_bug set status = 5 where k = NULL 4605 Quit The problem seems to be related to the fact that a substring expression is passed as an argument to DBI::do, but only when the DBI::do is called within a subroutine. I'm stumped here. Is this a bug in Perl or DBD::MySQL, or just the versions on Sarge and Ubuntu ? regards, Martin -- MySQL Perl Mailing List For list archives: http://lists.mysql.com/perl To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@xxxxxxxxxxx |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: stored procedures: 00042, Mark Strong |
|---|---|
| Next by Date: | Re: bug in DBD::MySQL on Ubuntu / Sarge: 00042, Patrick Galbraith |
| Previous by Thread: | stored proceduresi: 00042, Mark Strong |
| Next by Thread: | Re: bug in DBD::MySQL on Ubuntu / Sarge: 00042, Patrick Galbraith |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |