From:             admin at ifyouwantblood dot de
Operating system: Windows XP SP 3
PHP version:      5.2.8
PHP Bug Type:     PDO related
Bug description:  error "SQLSTATE[HY000]: General error: 2014" with sql comments

Description:
------------
i get this error with following code:

-------------
SQLSTATE[HY000]: General error: 2014 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. HY000

#0 D:\_projects\web\1.php(13): PDO->query('INSERT INTO `te...')
#1 {main} 
--------------

removing !SQL COMMENTS! will solve this. this only appears on windows
(XP), linux is fine. mysql version is 5.0.51a. latest XAMPP package was
used to test this (without modifications).

Reproduce code:
---------------
<?php

set_exception_handler('ehandler');

$pdo=new PDO('mysql:dbname=barcodescanner;host=127.0.0.1','root','');
$pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$pdo->query(' CREATE TABLE IF NOT EXISTS `test` (
`some` VARCHAR( 100 ) NOT NULL
) ENGINE = INNODB ');
$pdo->query('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE');
$pdo->query('START TRANSACTION');
$pdo->query("INSERT INTO `test` (some) VALUES ('1111111111111111'),
('1111111111111'); -- I AM AN SQL COMMENT, REMOVING ME WILL SOLVE THIS
PROBLEM");
$pdo->query("INSERT INTO `test` (some) VALUES ('1111111111111111'),
('1111111111111')");
$pdo->query('COMMIT');



function ehandler($exception)
{
        echo '<pre>'."\r\n";
        echo $exception->getMessage().' '.$exception->getCode();
        echo "\r\n\r\n";
        echo $exception->getTraceAsString();
        echo '</pre>';
} 

Expected result:
----------------
nothing

Actual result:
--------------
SQLSTATE[HY000]: General error: 2014 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. HY000

#0 D:\_projects\web\1.php(13): PDO->query('INSERT INTO `te...')
#1 {main} 

-- 
Edit bug report at http://bugs.php.net/?id=47504&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47504&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47504&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47504&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47504&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47504&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47504&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47504&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47504&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47504&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47504&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47504&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47504&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47504&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47504&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47504&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47504&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47504&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47504&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47504&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47504&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47504&r=mysqlcfg

Reply via email to