From:             jonathan+php at daikini dot com
Operating system: Mac OS X 10.4.2
PHP version:      5.1.0b3
PHP Bug Type:     PDO related
Bug description:  pdo_mysql driver prepares all queries

Description:
------------
Using MySQL 4.1.11

The pdo_mysql driver appears to attempt to prepare every query 
that it processes. Unfortunately only certain query statement 
types can be prepared in the current version of MySQL. See: 
http://bugs.mysql.com/bug.php?id=6415

This is causing a failure in the example code posted.

Perhaps the pdo_mysql driver could look at the type of 
statement it is processing and act accordingly and only 
prepare statements that allow it or perhaps a new option or 
method could be added so that it could be explicitly stated 
that the query should not be prepared.

Reproduce code:
---------------
<?php
$db = new PDO("mysql:dbname=test;host=127.0.0.1", 'root', '');

$db->query('DROP TABLE IF EXISTS pdo_test');
$db->query('CREATE TABLE pdo_test (field1 int(11) default NULL, field2
varchar(20) default NULL)');

$query_that_should_not_fail = "SHOW CREATE TABLE pdo_test";

$result = $db->query($query_that_should_not_fail);
      
if (!$result) {
   $errorInfo = $db->errorInfo();
   print_r($errorInfo);
   exit;
}

$row = $result->fetch(PDO_FETCH_ASSOC);
echo count($row);
?>

Expected result:
----------------
2

Actual result:
--------------
Array
(
    [0] => HY000
    [1] => 1295
    [2] => This command is not supported in the prepared 
statement protocol yet
) 

-- 
Edit bug report at http://bugs.php.net/?id=34054&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34054&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34054&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34054&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34054&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34054&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34054&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34054&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34054&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34054&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34054&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34054&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34054&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34054&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34054&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34054&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34054&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34054&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34054&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34054&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34054&r=mysqlcfg

Reply via email to