#34499 [Fbk->Opn]: pdo::exec fails when executing sequential 'OPTIMIZE TABLE' queries
| From: | maesa at email dot it | Date: | Wed, 14 Sep 2005 11:25:14 +0000 |
| Subject: | #34499 [Fbk->Opn]: pdo::exec fails when executing sequential 'OPTIMIZE TABLE' queries | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85024@lists.php.net to get a copy of this message | ||
ID: 34499
User updated by: maesa at email dot it
Reported By: maesa at email dot it
-Status: Feedback
+Status: Open
Bug Type: PDO related
Operating System: Windows XP SP2
PHP Version: 5.1.0RC1
New Comment:
I've installed the snapshot package for windows and got it running but
the problem persist...
Previous Comments:
------------------------------------------------------------------------
[2005-09-14 11:52:29] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
Several fixes were committed since RC1 was released..
------------------------------------------------------------------------
[2005-09-14 11:44:34] maesa at email dot it
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 this bug report at http://bugs.php.net/?id=34499&edit=1