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

Bug #72 OCI8 Execute always requires placeholders
Submitted: 2003-10-07 04:25 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 04:25 UTC] cjbj at hotmail dot com
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)

Comments

 [2003-10-07 12:11 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!
 [2003-10-07 13:47 UTC] cjbj at hotmail dot com
Your new fix also resolves the problem.
 [2003-10-07 13:56 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!