#44897 [Ver->Csd]: failed to prepare statement
| From: | andrey@php.net | Date: | Wed, 23 Jul 2008 14:11:34 +0000 |
| Subject: | #44897 [Ver->Csd]: failed to prepare statement | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-127199@lists.php.net to get a copy of this message | ||
ID: 44897
Updated by: andrey@php.net
Reported By: top dot bagger at bk dot ru
-Status: Verified
+Status: Closed
Bug Type: MySQLi related
Operating System: CentOS 5
PHP Version: 5.2.6
Assigned To: andrey
New Comment:
The SP call returns more than one RSet. If you use PS then libmysql
can't handle more than one RSet out of an executed PS. If you use
mysqlnd, available from 5.3+, then you will be able to do it. Usually
you need to "eat" all result sets till the line is clear but mysqlnd
will clean if you do mysqli_stmt_close()
Previous Comments:
------------------------------------------------------------------------
[2008-07-14 17:30:34] uw@php.net
Andrey, I can reproduce this with libmysql and mysqlnd using PHP 5.3
CVS and a recent version of MySQL 5.1. Have a look, I'll send you the
test.
------------------------------------------------------------------------
[2008-05-27 07:02:10] top dot bagger at bk dot ru
Mysql function that I wrote returns only one result. But anyway I will
try and provide you feedback.
------------------------------------------------------------------------
[2008-05-27 00:14:32] jani@php.net
Maybe if you fetch all the results caused by the execute of the CALL
statement before you try executing another query?
e.g. while($stmta->fetch());
------------------------------------------------------------------------
[2008-05-02 20:29:31] top dot bagger at bk dot ru
Sorry, I forgot to add my output of this:
State of user: 1prepare failed
errno: 2013 - error: Lost connection to MySQL server during query
------------------------------------------------------------------------
[2008-05-02 20:27:03] top dot bagger at bk dot ru
Description:
------------
"prepare" method call returns false if mysql stored procedure was
prepared before
Reproduce code:
---------------
$my = new mysqli("localhost","test","test","test_db");
$stmta = $my->prepare("CALL sp_auth_user(?,?)");
$user = 'user';
$pass = 'pass';
$stmta->bind_param("ss", $user,$pass);
$stmta->execute();
$stmta->bind_result($state);
$stmta->fetch();
printf("State of user: %s\n", $state);
$stmta->close();
$stmtb = $my->prepare("SELECT userId FROM appUsers WHERE login = ?");
if ($stmtb) echo "prepare succeeded";
else {
echo "prepare failed<br />";
echo "errno: ", $my->errno, " - error: ", $my->error, "<br
/>";
}
Expected result:
----------------
$stmtb contains mysqli_stmt object
Actual result:
--------------
$stmtb is false
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44897&edit=1