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

Bug #73 [PATCH] OCI8 Prepare() does not raise SQL parse error
Submitted: 2003-10-07 07:23 UTC
From: cjbj at hotmail dot com Assigned: cox
Status: Closed Package: DB
PHP Version: 4.3.3 OS: Windows 2000
Roadmaps: (Not assigned)    
Subscription  


 [2003-10-07 07:23 UTC] cjbj at hotmail dot com
Description: ------------ SQL parse errors in PEAR DB's OCI8 "Prepare" function are not raised. A subsequent call to DB::iserror($db) returns false as if the statement was successful. A patch to prepare() fixed the problem for me. The affected file has timestamp: // $Id: oci8.php,v 1.10 2003/06/11 16:42:44 cox Exp $ *** oci8.php.orig Tue Sep 02 15:21:20 2003 --- oci8.php Tue Oct 07 17:10:44 2003 *************** *** 354,360 **** $newquery .= $tokens[$i]; $this->last_query = $query; $newquery = $this->modifyQuery($newquery); ! $stmt = @OCIParse($this->connection, $newquery); $this->prepare_types[$stmt] = $types; $this->manip_query[(int)$stmt] = DB::isManip($query); return $stmt; --- 354,361 ---- $newquery .= $tokens[$i]; $this->last_query = $query; $newquery = $this->modifyQuery($newquery); ! if (!$stmt = @OCIParse($this->connection, $newquery)) ! return $this->oci8RaiseError(); $this->prepare_types[$stmt] = $types; $this->manip_query[(int)$stmt] = DB::isManip($query); return $stmt; Reproduce code: --------------- <?php require_once('DB.php'); $db = DB::connect("oci8://scott:tiger@MYDB"); if (DB::iserror($db)) { echo $db->getDebugInfo(); die(); } $s = $db->prepare("select 'x from dual"); if (DB::isError($s)) { echo $s->getDebugInfo(); } else { echo "No error\n"; } ?> Expected result: ---------------- After patching oci8.php, the error below should be displayed: select 'x from dual [nativecode=ORA-01756: quoted string not properly terminated ] Actual result: -------------- Currently the text "No error" is displayed.

Comments

 [2003-10-07 12:12 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!