ID:               43707
 Comment by:       dev at bcdiv dot com
 Reported By:      lunter at interia dot pl
 Status:           Open
 Bug Type:         PDO related
 Operating System: WinXP
 PHP Version:      5.3CVS-2007-12-29 (CVS)
 New Comment:

Correction to the above note (23 Jan 11:28pm UTC):

All references of "oConn" should read "cn" instead.


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

[2008-01-23 23:28:12] dev at bcdiv dot com

Experiencing similar issue.

Environment: 
Vista Ultimate
Apache/2.0.61 (Win32) PHP/5.2.5
MySQL Client API version  5.0.45
PDO Driver for MySQL, client library version 5.0.45

MySQL:
stored proc executes properly in MySQL QueryBrowser giving proper
result of 2 recordsets (recordsets contain only small varchar fields,
ints, booleans so should not be an issue related to size of the
returning records or #s of them)

PHP:
successfully use PDO with stored procs producing 1 recordset, but
using the above stored proc only the first recordset can be retrieved
attempting to test for nextRecordset results in optional feature not
implemented error.

CODE:
(Am just including the bare minimum to see if I can move from the first
recordset to the next)

                $cn = new PDO;
                $cn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

                $sp = $cn->prepare("CALL spGetInfo(?,?)");
                $sp->bindParam(1,$oID, PDO::PARAM_INT);
                $sp->bindParam(2,$cID, PDO::PARAM_INT);

                $result = $sp->execute();
                echo "result = ".$result."<br />";
                $err = $oConn->errorCode();
                $errmsg = $oConn->errorInfo();
                if($err > 0){
                  print_r("sproc returned error: " .$err." ErrorMsg: ".$errmsg."
value<br />");
                }else{
          for($i=0; $oRow = $sp->fetch(PDO::FETCH_ASSOC); $i++){
                 echo var_dump($oRow);
          }
                }

RESULT:
result = 1
array(3) { ["oID"]=> string(5) "28353" ["cID"]=> string(1) "0" ["sv"]=>
NULL } 

Error!: SQLSTATE[HYC00]: Optional feature not implemented


SIMILAR BUGS:
Review of other bugs shows a number open, but some comments indicate
that perhaps this is an issue resolved if I use another version of the
DLL libraries for pdo_mysql or pdo? 
Even using the latest snap of these (copying over the dlls only into
the PHP ext folder, then restarting Apache)doesn't seem to resolve the
problem.
#34727 One bug said these had to be compiled, but that was in 2005, and
it seems perhaps an out-dated comment.
#43709 seems to indicate this issue isn't going to be fixed except by
revising the documentation for the current version.

QUESTIONS:
Though I note bugs shouldn't raise questions, online documenation may
benefit by answering these -- specifically in the manual. Surely it
would reduce the number of pings to you on the subject. PDO on the whole
has worked very well for the single recordset sprocs, so hopefully its
simply a matter of configuration.
(1) What version of PHP enables nextRowset() for WIN32/MySQL?
(2) If no available version enables this feature, what version should
it be anticipated?
(3) Are there work-arounds are being used with PDO for the return of
multiple recordsets?

Thanks! This is definitely an important issue for any of us using
stored procs that return multiple recordsets.

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

[2007-12-30 12:36:03] lunter at interia dot pl

This is rather important bug, becouse it doesn't permite to full use
stored procedured by MySQL, MS SQL etc. programmers.

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

[2007-12-29 20:44:11] lunter at interia dot pl

Description:
------------
PDOStatement->nextRowset() doesn't work


Reproduce code:
---------------
<?
 $h=new PDO('mysql:host=localhost;dbname=root','root','root');

// $q=$h->query('CALL some_proc()');
 $q=$h->query('SELECT 1 AS col;SELECT 2 AS col;');

 $r=$q->fetchAll(PDO::FETCH_ASSOC);
 print_r($r);

 $q->nextRowset();
 $r=$q->fetchAll(PDO::FETCH_ASSOC);
 print_r($r);
?>


Expected result:
----------------
Array ( [0] => Array ( [col] => 1 ) ) 

Array ( [0] => Array ( [col] => 2 ) ) 


Actual result:
--------------
Array ( [0] => Array ( [col] => 1 ) ) 

Array ( ) 



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


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

Reply via email to