#72 [NEW]: OCI8 Execute always requires placeholders

From: Date: Tue, 07 Oct 2003 04:25:50 +0000
Subject: #72 [NEW]: OCI8 Execute always requires placeholders
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22429@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: OCI8 Execute always requires placeholders Description: ------------ There is a problem in PEAR DB's OCI8 "Execute" function. If the statement "prepared" does not have any placeholders (aka bind variables), "execute" does not allow an empty second argument. Patch: The affected file has timestamp: // $Id: oci8.php,v 1.10 2003/06/11 16:42:44 cox Exp $ diff "c:/php/PEAR/DB/oci8.php.orig" "c:/php/PEAR/DB/oci8.php" 378,380c378,384 < $types=&$this->prepare_types[$stmt]; < if (($size = sizeof($types)) != sizeof($data)) { < return $this->raiseError(DB_ERROR_MISMATCH); --- > if (!$data) > $size = 0; > else { > $types = &$this->prepare_types[$stmt]; > if (($size = sizeof($types)) != sizeof($data)) { > return $this->raiseError(DB_ERROR_MISMATCH); > } Reproduce code: --------------- <?php // connect require_once('DB.php'); $db = DB::connect("oci8://scott:tiger@mydb"); if (DB::iserror($db)) { die($db->getMessage()); } echo "Connected\n"; // issue the query $sql = "create table test1 (mycol varchar2(20))"; $q = $db->prepare($sql); if (DB::iserror($q)) { die($q->getMessage()); } $r = $db->execute($q); if (DB::iserror($r)) { die($r->getMessage()); } echo "Table created\n"; // issue the query $sql = "insert into test1 values ('ff')"; $q = $db->prepare($sql); if (DB::iserror($q)) { die($q->getMessage()); } $r = $db->execute($q); if (DB::iserror($r)) { die($r->getMessage()); } echo "Row inserted\n"; ?> Expected result: ---------------- Connected Table created Row inserted (And the table is created with one row inserted.) Actual result: -------------- Connected DB Error: mismatch (And the table is not created) -- Edit bug report at http://pear.php.net/bugs/bug.php?id=72&edit=1 --

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