#73 [NEW]: [PATCH] OCI8 Prepare() does not raise SQL parse error

From: Date: Tue, 07 Oct 2003 07:23:02 +0000
Subject: #73 [NEW]: [PATCH] OCI8 Prepare() does not raise SQL parse error
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22432@lists.php.net to get a copy of this message
From: cjbj at hotmail dot com Operating system: Windows 2000 PHP version: 4.3.3 PHP Bug Type: DB Bug description: [PATCH] OCI8 Prepare() does not raise SQL parse error 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 bug report at http://pear.php.net/bugs/bug.php?id=73&edit=1 --

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