|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesphp-5.3.10-cursor-support-for-pdo_oci.patch (last revision 2012-03-20 10:19 UTC by psrustik at yandex dot ru)php-5.3.8-cursor-support-for-pdo_oci.patch (last revision 2012-01-12 22:41 UTC by marcos dot ramirez dot aranda at gmail dot com) Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-03-20 05:22 UTC] gureedo at gmail dot com
[2012-03-20 10:21 UTC] psrustik at yandex dot ru
[2016-03-08 01:10 UTC] sixd@php.net
-Package: PDO related
+Package: PDO OCI
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 20 21:00:02 2025 UTC |
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