Skip Menu |

This queue is for tickets about the DBD-mysql CPAN distribution.

Report information
The Basics
Id: 24974
Status: resolved
Priority: 0/
Queue: DBD-mysql

Owner: Nobody in particular
Requestors: TIMB [...]

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)


Subject: do() method doesn't set $dbh->{Statement}
Download (untitled) / with headers
text/plain 258b
do() method doesn't set $dbh->{Statement} which means that a) using DBI::Profile doesn't give correct profile results for calls to do() b) using ShowErrorStatement may report the wrong statement in the error message. I've attached a patch, including a test.
Only in DBD-mysql-4.001.timbunce1: Makefile Only in DBD-mysql-4.001.timbunce1: blib Only in DBD-mysql-4.001.timbunce1: dbdimp.o Only in DBD-mysql-4.001.timbunce1: Only in DBD-mysql-4.001.timbunce1: mysql.c Only in DBD-mysql-4.001.timbunce1: mysql.o diff -ur DBD-mysql-4.001/mysql.xs DBD-mysql-4.001.timbunce1/mysql.xs --- DBD-mysql-4.001/mysql.xs 2007-01-08 00:39:05.000000000 +0000 +++ DBD-mysql-4.001.timbunce1/mysql.xs 2007-02-15 16:59:46.000000000 +0000 @@ -300,6 +300,8 @@ "mysql.xs do() use_server_side_prepare %d\n", use_server_side_prepare); + hv_store((HV*)SvRV(dbh), "Statement", 9, SvREFCNT_inc(statement), 0); + if (use_server_side_prepare) { str_ptr= SvPV(statement, slen); Only in DBD-mysql-4.001.timbunce1: mysql.xsi Only in DBD-mysql-4.001.timbunce1: pm_to_blib diff -ur DBD-mysql-4.001/t/20createdrop.t DBD-mysql-4.001.timbunce1/t/20createdrop.t --- DBD-mysql-4.001/t/20createdrop.t 2006-12-23 18:03:30.000000000 +0000 +++ DBD-mysql-4.001.timbunce1/t/20createdrop.t 2007-02-15 16:58:27.000000000 +0000 @@ -73,6 +73,12 @@ or DbiError($dbh->err, $dbh->errstr); # + # ... check do() sets $dbh->{Statement} + # + Test($state or $dbh->{Statement} eq "DROP TABLE $table") + or DbiError(1, "do() didn't set Statement attribute"); + + # # Finally disconnect. # Test($state or $dbh->disconnect()) Only in DBD-mysql-4.001.timbunce1/t: mysql.mtest
Patrick (CAPTTOFU) committed the patch for this.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to