Edit report at https://bugs.php.net/bug.php?id=60703&edit=1
ID: 60703 Comment by: gureedo at gmail dot com Reported by: marcos dot ramirez dot aranda at gmail dot com Summary: support for reference cursors on pdo_oci Status: Open Type: Feature/Change Request Package: PDO related Operating System: Linux PHP Version: 5.3.8 Block user comment: N Private report: N New Comment: attatched patch does not work with ZTS enabled configuration. Previous Comments: ------------------------------------------------------------------------ [2012-01-10 19:55:18] marcos dot ramirez dot aranda at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=60703&edit=1