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

Bug #91 OCI8 Prepare() does not allow '!' as placeholder
Submitted: 2003-10-13 05:30 UTC
From: cjbj at hotmail dot com Assigned: danielc
Status: Closed Package: DB
PHP Version: 4.3.3 OS: Windows 2000
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 : 10 + 22 = ?

 
 [2003-10-13 05:30 UTC] cjbj at hotmail dot com
Description: ------------ The PEAR DB documentation for Execute [see http://pear.php.net/manual/en/package.database.db.intro-execute.php] says three placeholders are allowed: question mark, exclamation point and ampersand. The common.php implementation of Prepare() does support all three. However the oci8.php implementation only recognizes question marks and ampersands. This potentially impacts script migration to the oci8 driver. If I read the code correctly, the fix is to make oci8.php's Prepare() recognize exclamation points like common.php's. The affected file has timestamp: // $Id: oci8.php,v 1.10 2003/06/11 16:42:44 cox Exp$ (which is pre-bug 53: http://pear.php.net/bugs/bug.php?id=53) Potential patch: *** oci8.php.orig Tue Sep 02 15:21:20 2003 --- oci8.php Mon Oct 13 14:37:48 2003 *************** *** 332,338 **** */ function prepare($query) { ! $tokens = split('[\&\?]', $query); $token = 0; $types = array(); $qlen = strlen($query); --- 332,338 ---- */ function prepare($query) { ! $tokens = split("[\&\?\!]", $query); $token = 0; $types = array(); $qlen = strlen($query); *************** *** 343,348 **** --- 343,351 ---- break; case '&': $types[$token++] = DB_PARAM_OPAQUE; + break; + case '!': + $types[$token++] = DB_PARAM_MISC; break; } } This makes the exclamation and ampersands have the same behavior. Reproduce code: --------------- In SQL*Plus execute: connect scott/tiger@mydb CREATE TABLE MYTAB (C1 NUMBER) Then run this PHP script: <?php require_once('DB.php'); echo "<p>Connecting . . . </p>"; $db = DB::connect("oci8://scott:tiger@MYDB"); if (DB::iserror($db)) die($db->getDebugInfo()); // Note: an exclamation point is used as the place holder $stid = $db->prepare("INSERT INTO MYTAB (C1) VALUES (!)"); if (DB::isError($stid)) { echo "Prepare failed:\n"; die($stid->getDebugInfo()); } $bn = 8; $res = $db->execute($stid, array($bn)); if (DB::isError($res)) { echo "Execute failed:\n"; die($res->getDebugInfo()); } echo "Insert complete."; ?> Expected result: ---------------- After applying the patch the screen output is: Connecting . . . Insert complete. Querying the table "MYTAB" from SQL*Plus shows one row with value '8'. Actual result: -------------- Without the patch, no row is inserted. The screen output is: Connecting . . . Execute failed: INSERT INTO MYTAB (C1) VALUES (!)

Comments

 [2004-01-03 21:03 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!