#73 [Opn->Csd]: [PATCH] OCI8 Prepare() does not raise SQL parse error

From: Date: Tue, 07 Oct 2003 12:12:54 +0000
Subject: #73 [Opn->Csd]: [PATCH] OCI8 Prepare() does not raise SQL parse error
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22443@lists.php.net to get a copy of this message
ID: 73 Updated by: cox@php.net Reported By: cjbj at hotmail dot com -Status: Open +Status: Closed Bug Type: DB Operating System: Windows 2000 PHP Version: 4.3.3 New Comment: This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. Previous Comments: ------------------------------------------------------------------------ [2003-10-07 03:23:02] 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. ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=73&edit=1

« previous php.pear.dev (#22443) next »