cvs: pear /DB_QueryTool/QueryTool Query.php
| From: | Wolfram Kriesing | Date: | Mon, 17 Feb 2003 21:59:48 +0000 |
| Subject: | cvs: pear /DB_QueryTool/QueryTool Query.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-8925@lists.php.net to get a copy of this message | ||
cain Mon Feb 17 16:59:48 2003 EDT
Modified files:
/pear/DB_QueryTool/QueryTool Query.php
Log:
- bugfix in update by Uwe Dorl, use fully qualified column name
- bugfix in error handler
Index: pear/DB_QueryTool/QueryTool/Query.php
diff -u pear/DB_QueryTool/QueryTool/Query.php:1.9 pear/DB_QueryTool/QueryTool/Query.php:1.10
--- pear/DB_QueryTool/QueryTool/Query.php:1.9 Mon Feb 10 18:20:12 2003
+++ pear/DB_QueryTool/QueryTool/Query.php Mon Feb 17 16:59:48 2003
@@ -15,7 +15,7 @@
// | Author: Wolfram Kriesing, Paolo Panto, vision:produktion <wk@visionp.de>
// +----------------------------------------------------------------------+
//
-// $Id: Query.php,v 1.9 2003/02/10 23:20:12 cain Exp $
+// $Id: Query.php,v 1.10 2003/02/17 21:59:48 cain Exp $
//
require_once 'PEAR.php';
@@ -108,6 +108,7 @@
var $options = array( 'raw' => false
,'verbose' => true // set this to false in a
productive environment
// it will produce error-logs if set to
true
+ ,'useCache' => false
);
/**
@@ -134,8 +135,11 @@
-
-
+ /**
+ * var array this array caches queries that have already been built once
+ * to reduce the execution time
+ */
+ var $_queryCache = array();
/**
* this is the constructor, as it will be implemented in ZE2 (php5)
@@ -422,7 +426,7 @@
$values = array();
$raw = $this->getOption('raw');
foreach($newData as $key=>$aData) { // quote the data
- $values[] = "$key=". ( $raw ? $aData : $this->_db->quote($aData) );
+ $values[] = "{$this->table}.$key=". ( $raw ? $aData :
$this->_db->quote($aData) );
}
$query = sprintf( 'UPDATE %s SET %s WHERE %s=%s',
@@ -1471,6 +1475,13 @@
*/
function _buildSelectQuery( $query=array() )
{
+/*FIXXXME finish this
+ $cacheKey = md5(serialize(????));
+ if (isset($this->_queryCache[$cacheKey])) {
+ $this->_errorLog('using cached query',__LINE__);
+ return $this->_queryCache[$cacheKey];
+ }
+*/
$where = isset($query['where']) ? $query['where'] :
$this->_buildWhere();
if( $where )
$where = 'WHERE '.$where;
@@ -1490,6 +1501,7 @@
$group,
$order
);
+// $this->_queryCache[$cacheKey] = $queryString;
return $queryString;
}
@@ -1692,7 +1704,7 @@
*/
function _errorLog( $msg , $line='unknown' )
{
- $this->_errorHandler( 'log' , $msg , $line='unknown' );
+ $this->_errorHandler( 'log' , $msg , $line );
/*
if( $this->getOption('verbose') == true )
{
@@ -1707,7 +1719,7 @@
function _errorSet( $msg , $line='unknown' )
{
- $this->_errorHandler( 'set' , $msg , $line='unknown' );
+ $this->_errorHandler( 'set' , $msg , $line );
}
function _errorHandler( $logOrSet , $msg , $line='unknown' )