ID:               36389
 Updated by:       [EMAIL PROTECTED]
 Reported By:      camka at email dot ee
-Status:           Open
+Status:           Feedback
 Bug Type:         MySQLi related
 Operating System: win xp
 PHP Version:      5.1.2
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip




Previous Comments:
------------------------------------------------------------------------

[2006-02-14 12:52:04] camka at email dot ee

Description:
------------
When trying to bind a result variable to a prepared statement the error
"Using unsupported buffer type: 253" comes up.
Moreover, the binded in paramter doesn't get binded correctly either as
seen from mysql log.

The other strange thing is that, if field datatype varchar(15) (< then
16) is used for tm table, than error 253 won't come up, buth the
problem with binded parameter remains. Integer type works without the
error as well.

Tested with both current stable php version and the latest snapshot
(Built On: Feb 14, 2006 11:30 GMT)

Reproduce code:
---------------
<?php
echo "PHP version: ".phpversion();
$m = new mysqli('localhost','***','***','***');

$v = $m->query("select @@version as v")->fetch_assoc();
echo "\nMySQL version: ".$v['v'];

$m->query("create temporary table tm (txt varchar(16))");
$m->query("insert into tm (txt) values ('2'),('3'),('4')");


$v = $m->query("select count(*) as v from tm")->fetch_assoc();
echo "\nNum of recs: ".$v['v'];

$str = "select txt from tm where txt=?";
$ps = $m->prepare($str);

$txt_in  = '2';
$txt_out = null;

if (!$ps->bind_param('s', $txt_in)) echo "\nbind_param: ".$ps->error;
if (!$ps->bind_result($txt_out))    echo "\nbind_result: ".$ps->error;
if ($ps->execute())                 echo "\nexecuted successfully:
".$ps->num_rows;
else                                echo "\nfailed ps execution:
".$ps->error;
if (!$ps->store_result())           echo "\nstore_result:
".$ps->error;
if ($z = $ps->fetch())              echo "\nfetched successfully:
".$txt_out;
elseif($z === false)                echo "\nfailed fetching:
".$ps->error;
elseif($z === null)                 echo "\nno more records";
?>

Expected result:
----------------
PHP version: 5.1.2
MySQL version: 5.0.18-nt-log
Num of recs: 3
executed successfully: 0
fetched successfully: 1

Actual result:
--------------
PHP version: 5.1.2
MySQL version: 5.0.18-nt-log
Num of recs: 3
bind_result: Using unsupported buffer type: 253 (parameter: 1)
executed successfully: 0
no more records

[mysql log file]
58 Query       select @@version as v
58 Query       create temporary table tm (txt varchar(16))
58 Query       insert into tm (txt) values ('2'),('3'),('4')
58 Query       select count(*) as v from tm
58 Prepare     [1] 
58 Execute     [1] select txt from tm where txt=0


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36389&edit=1

Reply via email to