From: Operating system: Linux PHP version: 5.3.8 Package: PDO related Bug Type: Feature/Change Request Bug description:support for reference cursors on pdo_oci
Description: ------------ PDO_OCI doesn't yet allow fetching ref cursors with oracle (or any other database). This patch adds support for fetching reference cursors on pdo_oci on both SELECT's as well CALL's to stored procedures (see the example below). Test script: --------------- $dbh = new PDO('oci:dbname=//localhost/XE', 'user', 'pass'); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); $sql = "select cursor(select table_name, owner from all_tables where rownum <= 1) as cursor from dual"; $sth = $dbh->prepare($sql); $sth->execute(); $row = $sth->fetch(PDO::FETCH_ASSOC); var_dump($row); if (is_a($row['CURSOR'],'PDOStatement')) { $sthc = $row['CURSOR']; while ($rr = $sthc->fetch(PDO::FETCH_ASSOC)) { var_dump($rr); } } $sql = "begin OPEN :c FOR 'SELECT table_name FROM all_TABLES WHERE ROWNUM <= 1'; END;"; $sthc = ''; $sth = $dbh->prepare($sql); $sth->bindParam(":c", $sthc, PDO::PARAM_STMT|PDO::PARAM_INPUT_OUTPUT); $sth->execute(); if ($sthc && is_a($sthc,'PDOStatement')) while ($rr = $sthc->fetch(PDO::FETCH_ASSOC)) { var_dump($rr); } Expected result: ---------------- array(1) { ["CURSOR"]=> object(PDOStatement)#3 (1) { ["queryString"]=> NULL } } array(2) { ["TABLE_NAME"]=> string(5) "ICOL$" ["OWNER"]=> string(3) "SYS" } array(1) { ["TABLE_NAME"]=> string(5) "ICOL$" } Actual result: -------------- PHP Warning: PDOStatement::fetch(): SQLSTATE[HY000]: General error: 932 OCIStmtFetch: ORA-00932: inconsistent datatypes: expected CHAR got DTYCWD Warning: PDOStatement::fetch(): SQLSTATE[HY000]: General error: 932 OCIStmtFetch: ORA-00932: inconsistent datatypes: expected CHAR got DTYCWD bool(false) PHP Warning: PDOStatement::execute(): SQLSTATE[HY000]: General error: 1008 OCIStmtExecute: ORA-01008: not all variables bound Warning: PDOStatement::execute(): SQLSTATE[HY000]: General error: 1008 OCIStmtExecute: ORA-01008: not all variables bound -- Edit bug report at https://bugs.php.net/bug.php?id=60703&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60703&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60703&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60703&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60703&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60703&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60703&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60703&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60703&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60703&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60703&r=support Expected behavior: https://bugs.php.net/fix.php?id=60703&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60703&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60703&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60703&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60703&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60703&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60703&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60703&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60703&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60703&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60703&r=mysqlcfg