Doc #64638 [NEW]: No info about combining prepared statements and stored procedures
From: DimonSoft at sa-sec dot org
Operating system: Irrelevant
PHP version: Irrelevant
Package: MySQLi related
Bug Type: Documentation Problem
Bug description:No info about combining prepared statements and stored procedures
Description:
------------
It seems like there's no enough info in the documentation on how to
retrieve result sets when calling a stored procedure with mysqli_stmt
(prepared statement).
Although it is quite easy to find non-official recomendations on the
Internet (like using mysqli_stmt_more_results() and
mysqli_stmt_next_result()) it is still not enough.
Right now I'm having a related problem. There're 2 stored procedures: Proc1
and Proc2. Proc1 internally calls Proc2(), which, in its turn, produces a
resultset. See pseudocode.
Test script:
---------------
Pseudocode:
$DB = new mysqli(â¦);
$Stmt = $DB->prepare('CALL Proc1(?)');
$Stmt->bind_param(â¦);
$Stmt->execute();
$Stmt->store_result();
$Stmt->bind_result(â¦);
while ($Stmt->fetch())
{
â¦
}
while ($Stmt->next_result())
$Stmt->store_result();
$Stmt->free_result
â¦
Expected result:
----------------
Resultset is expected to get fetched.
Actual result:
--------------
A call to $Stmt->fetch() fails with "Packets out of order" message.
I guess, I'm doing something wrong, but there're no hints anywhere in the
documentation.
--
Edit bug report at https://bugs.php.net/bug.php?id=64638&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64638&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64638&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64638&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64638&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64638&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64638&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64638&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64638&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64638&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64638&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=64638&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=64638&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64638&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64638&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64638&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64638&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64638&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64638&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64638&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64638&r=mysqlcfg
Thread (8 messages)
- DimonSoft at sa-sec dot org