Re: [PECL-DEV] mysqlnd_qc (mysqlnd query cache) 1.0.1 with prepared statement support

[email protected] (Ulf Wendel)
Newsgroups php.pecl.dev
Message-ID <[email protected]>
Lukas Kahwe Smith schrieb:
> On 13.07.2010, at 19:26, Ulf Wendel wrote:
> 
>> Benjamin Eberlei schrieb:
>>> Actually missing prepared statements and unbuffered queries were the
>>> only issues I had with the Query Cache so far. Can i compile the Mysqlnd
>>> + Query Cache PECL Trunk against 5.3.99-DEV only to test it? 
>> ... remember that PDO emulates prepared statements by default.
> 
> by default? since when?

Since when does it not?

Try:

nixnutz@linux-fuxh:~/php/php-src/trunk_qc> sapi/cli/php -d 
mysqlnd.debug="d:t:O,/tmp/pdo.trace" -r 'var_dump(phpversion()); $pdo = 
new PDO("mysql:host=localhost;dbname=test", "root", "root"); $stmt = 
$pdo->prepare("SELECT 1 FROM DUAL LIMIT ?"); $stmt->execute(array(2)); 
var_dump($stmt->errorInfo());'
string(10) "5.3.99-dev"
array(3) {
   [0]=>
   string(5) "42000"
   [1]=>
   int(1064)
   [2]=>
   string(149) "You have an error in your SQL syntax; check the manual 
that corresponds to your MySQL server version for the right syntax to 
use near ''2'' at line 1"
}

That is the classical PDO  emulation sucks bug that get's bogussed 
frequently. And the cause is in the log: http://pastebin.com/taq3JeeN .

The log is a bit bloated because of QC, but still you see

 >mysqlnd_conn::query 
 

| | info : conn=97 query=SELECT 1 FROM DUAL LIMIT '2' 
 

| | >mysqlnd_conn::simple_command 
 

| | | info : command=QUERY ok_packet=11 silent=0 


Here is your COM_QUERY = C API mysql_query --- no sign of a native 
prepared statement.

Ulf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.