Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Request #3660 Permit oci8::execute bind input/output cursor/rowid/blob/bfile parameteres
Submitted: 2005-03-01 15:31 UTC
From: marcos at inf dot utfsm dot cl Assigned: quipo
Status: Closed Package: MDB2_Driver_oci8
PHP Version: Irrelevant OS: ANY
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 28 + 3 = ?

 
 [2005-03-01 15:31 UTC] marcos at inf dot utfsm dot cl
Description: ------------ A call to a procedure/function with IN/OUT abstract Datatype (LOB/ROWID/BFILE) or ref cursor parameters fails because the binding needs an extra parameter (type) and the parameter needs to be allocated first using ocinewdescriptor/ocinewcursor. Reproduce code: --------------- $cursor = null; $sth = $dbh->query("begin pkg.get_ref_cursor(?, ?); end;", array(10, &$cursor ) ) ; PL/SQL CODE: CREATE OR REPLACE PACKAGE ELQUI.pkg AS TYPE REF_CURSOR IS REF CURSOR; PROCEDURE get_ref_cursor(n IN NUMBER, c out ref_cursor); END; / CREATE OR REPLACE PACKAGE BODY ELQUI.PKG AS PROCEDURE get_ref_cursor(n IN NUMBER, c out ref_cursor) IS BEGIN open c FOR SELECT table_name from user_tables where rownum <= n; END ; END; / This patch adds the extra functionality needed to the execute method, so a call as shown will work as expected. $cursor = null; $sth = $dbh->query("begin pkg.get_ref_cursor(?, ?); end;", array(10, array(&$cursor, OCI_B_CURSOR) ) ) ; diff -ru DB.orig/oci8.php DB/oci8.php --- DB.orig/oci8.php 2005-02-27 22:42:01.000000000 -0300 +++ DB/oci8.php 2005-03-01 11:49:44.029554305 -0300 @@ -641,10 +641,30 @@ $data[$key] = fread($fp, filesize($data[$key])); fclose($fp); } - if (!@OCIBindByName($stmt, ':bind' . $i, $data[$key], -1)) { - $tmp = $this->oci8RaiseError($stmt); - return $tmp; - } + /* Oracle especific parameter */ + if ( is_array($pdata[$i]) ) { + if ($pdata[$i][0] == null) { + if ($pdata[$i][1] == OCI_B_CURSOR) { + $pdata[$i][0] = @OCINewCursor($this->connection); + } elseif ($pdata[$i][1] == OCI_B_ROWID) { + $pdata[$i][0] = @OCINewDescriptor($this->connection, OCI_D_ROWID); + } elseif ($pdata[$i][1] == OCI_B_CLOB || $pdata[$i][1] == OCI_B_BLOB ) { + $pdata[$i][0] = @OCINewDescriptor($this->connection, OCI_D_LOB); + } elseif ($pdata[$i][1] == OCI_B_BFILE || $pdata[$i][1] == OCI_B_CFILEE ) { + $pdata[$i][0] = @OCINewDescriptor($this->connection, OCI_D_FILE); + } else { + return $this->raiseError(DB_ERROR_MISMATCH); + } + } + if (!@OCIBindByName($stmt, ":bind" . $i, $pdata[$i][0], -1, + $pdata[$i][1])) { + return $this->oci8RaiseError($stmt); + } + } else /* normal parameter */ + if (!@OCIBindByName($stmt, ':bind' . $i, $data[$key], -1)) { + $tmp = $this->oci8RaiseError($stmt); + return $tmp; + } $i++; } if ($this->autocommit) { Expected result: ---------------- Resource id #n in $cursor Actual result: -------------- DB Error: unknown error in $sth

Comments

 [2006-03-11 09:49 UTC] lsmith
DB is in maintaince mode, any changes should go into MDB2.
 [2007-07-22 16:25 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.