cvs: php4 /pear/DB common.php
| From: | Thomas V.V.Cox | Date: | Fri, 31 Aug 2001 18:26:38 +0000 |
| Subject: | cvs: php4 /pear/DB common.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-708@lists.php.net to get a copy of this message | ||
cox Fri Aug 31 14:26:38 2001 EDT
Modified files:
/php4/pear/DB common.php
Log:
make prepare to also register the last query (gives the right error reporting
in case of fail)
Index: php4/pear/DB/common.php
diff -u php4/pear/DB/common.php:1.61 php4/pear/DB/common.php:1.62
--- php4/pear/DB/common.php:1.61 Wed Aug 22 22:36:55 2001
+++ php4/pear/DB/common.php Fri Aug 31 14:26:38 2001
@@ -17,7 +17,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: common.php,v 1.61 2001/08/23 02:36:55 cox Exp $
+// $Id: common.php,v 1.62 2001/08/31 18:26:38 cox Exp $
//
// Base class for DB implementations.
//
@@ -36,6 +36,7 @@
var $type; // DB type (mysql, oci8, odbc etc.)
var $prepare_tokens;
var $prepare_types;
+ var $prepared_queries;
var $prepare_maxstmt = 0;
var $last_query = '';
var $fetchmode = DB_FETCHMODE_ORDERED;
@@ -314,6 +315,7 @@
$k = key($this->prepare_tokens);
$this->prepare_types[$k] = $types;
+ $this->prepared_queries[$k] = &$query;
return $k;
}
@@ -323,6 +325,7 @@
function execute($stmt, $data = false)
{
+ $this->last_query = @$this->prepared_queries[$stmt];
$realquery = $this->executeEmulateQuery($stmt, $data);
if (DB::isError($realquery)) {
return $realquery;
@@ -349,7 +352,8 @@
if (!isset($this->prepare_tokens[$stmt]) ||
!is_array($this->prepare_tokens[$stmt]) ||
- !sizeof($this->prepare_tokens[$stmt])) {
+ !sizeof($this->prepare_tokens[$stmt]))
+ {
return $this->raiseError(DB_ERROR_INVALID);
}
@@ -358,7 +362,8 @@
if ((!$data && $qp > 0) ||
(!is_array($data) && $qp > 1) ||
- (is_array($data) && $qp > sizeof($data))) {
+ (is_array($data) && $qp > sizeof($data)))
+ {
return $this->raiseError(DB_ERROR_NEED_MORE_DATA);
}