From:             info at chromosoft dot be
Operating system: Ubuntu
PHP version:      5.2CVS-2009-03-14 (snap)
PHP Bug Type:     PDO related
Bug description:  PDO MySQL prepare is allways emulated

Description:
------------
Hi,

The prepare is allways emulated on the mysql DB.
But if you  use mysqli the prepare work correctly.

MySQL : 5.0.51a
PHP : 5.2.4-2ubuntu5.5



Reproduce code:
---------------
Code with PDO :

$dbh = new PDO('mysql:host=localhost;dbname=db', 'root' , '');
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sth = $dbh->prepare('select * from tt where a = ?');
$sth->execute(array(1));
$sth->fetch();
unset($sth);



Code with Mysqli :

$mysqli = new mysqli("localhost", "root", "", "db");
$a = 5;
if ($stmt = $mysqli->prepare("select * from tt where a = ?"))
{
  $stmt->bind_param("i", $a); 
  $stmt->execute();
}
$mysqli->close();

Actual result:
--------------
Log with PDO
30 Connect     r...@localhost on db
30 Query       select * from tt where a = '1'
30 Quit 

Log with Mysqli
31 Connect     r...@localhost on db
31 Prepare     [1] select * from tt where a = ?
31 Execute     [1] select * from tt where a = 5
31 Quit       


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

Reply via email to