From: maesa at email dot it
Operating system: Windows XP SP2
PHP version: 5.1.0RC1
PHP Bug Type: PDO related
Bug description: pdo::exec fails when executing sequential 'OPTIMIZE TABLE'
queries
Description:
------------
A pdo::exec call fails when i try to execute sequential query ( 'OPTIMIZE
TABLE' queries )
Reproduce code:
---------------
$dsn = 'mysql:dbname=my_database;host=localhost';
$user = 'root';
$password = '';
try {
$dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
$dbh->exec( 'OPTIMIZE TABLE my_table' );
print_r($dbh->errorInfo());
$dbh->exec( 'OPTIMIZE TABLE my_table_1' );
print_r($dbh->errorInfo());
Expected result:
----------------
I expected that the second call to $dbh->exec will be successful as the
first one, but the second fails.
Actual result:
--------------
Printing the array returned from $dbh->errorInfo() i obtain for the first
call to pdo::exec
Array
(
[0] => 00000
)
but for the second call
Array
(
[0] => HY000
[1] => 2014
[2] => Cannot execute queries while other unbuffered queries are
active. Consider using PDOStatement::fetchAll(). Alternatively, if your
code is only ever going to run against mysql, you may enable query
buffering by setting the PDO_MYSQL_ATTR_USE_BUFFERED_QUERY attribute.
)
--
Edit bug report at http://bugs.php.net/?id=34499&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34499&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34499&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34499&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34499&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34499&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34499&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34499&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34499&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34499&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34499&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34499&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34499&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34499&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34499&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34499&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34499&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34499&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34499&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34499&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34499&r=mysqlcfg