cvs: pear /MDB_QueryTool QueryTool.php /MDB_QueryTool/QueryTool Query.php
| From: | Lorenzo Alberton | Date: | Sat, 08 Apr 2006 10:39:23 +0000 |
| Subject: | cvs: pear /MDB_QueryTool QueryTool.php /MDB_QueryTool/QueryTool Query.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-39488@lists.php.net to get a copy of this message | ||
quipo Sat Apr 8 10:39:23 2006 UTC
Modified files:
/pear/MDB_QueryTool QueryTool.php
/pear/MDB_QueryTool/QueryTool Query.php
Log:
- renamed $version to $MDBversion
- cosmetic fixes
http://cvs.php.net/viewcvs.cgi/pear/MDB_QueryTool/QueryTool.php?r1=1.9&r2=1.10&diff_format=u
Index: pear/MDB_QueryTool/QueryTool.php
diff -u pear/MDB_QueryTool/QueryTool.php:1.9 pear/MDB_QueryTool/QueryTool.php:1.10
--- pear/MDB_QueryTool/QueryTool.php:1.9 Tue Mar 28 16:43:16 2006
+++ pear/MDB_QueryTool/QueryTool.php Sat Apr 8 10:39:23 2006
@@ -32,7 +32,7 @@
* @author Lorenzo Alberton <l dot alberton at quipo dot it>
* @copyright 2003-2006 Lorenzo Alberton
* @license http://www.debian.org/misc/bsd.license BSD
License (3 Clause)
- * @version CVS: $Id: QueryTool.php,v 1.9 2006/03/28 16:43:16 lsmith Exp $
+ * @version CVS: $Id: QueryTool.php,v 1.10 2006/04/08 10:39:23 quipo Exp $
* @link http://pear.php.net/package/MDB_QueryTool
*/
@@ -63,11 +63,11 @@
* call parent constructor
* @param mixed $dsn DSN string, DSN array or MDB object
* @param array $options
- * @param integer $version
+ * @param integer $MDBversion 1=MDB, 2=MDB2
*/
- function MDB_QueryTool($dsn=false, $options=array(), $version = 1)
+ function MDB_QueryTool($dsn=false, $options=array(), $MDBversion = 1)
{
- parent::__construct($dsn, $options, $version);
+ parent::__construct($dsn, $options, $MDBversion);
}
// }}}
http://cvs.php.net/viewcvs.cgi/pear/MDB_QueryTool/QueryTool/Query.php?r1=1.51&r2=1.52&diff_format=u
Index: pear/MDB_QueryTool/QueryTool/Query.php
diff -u pear/MDB_QueryTool/QueryTool/Query.php:1.51 pear/MDB_QueryTool/QueryTool/Query.php:1.52
--- pear/MDB_QueryTool/QueryTool/Query.php:1.51 Tue Mar 28 16:44:18 2006
+++ pear/MDB_QueryTool/QueryTool/Query.php Sat Apr 8 10:39:23 2006
@@ -32,7 +32,7 @@
* @author Lorenzo Alberton <l dot alberton at quipo dot it>
* @copyright 2004-2006 Lorenzo Alberton
* @license http://www.debian.org/misc/bsd.license BSD
License (3 Clause)
- * @version CVS: $Id: Query.php,v 1.51 2006/03/28 16:44:18 lsmith Exp $
+ * @version CVS: $Id: Query.php,v 1.52 2006/04/08 10:39:23 quipo Exp $
* @link http://pear.php.net/package/MDB_QueryTool
*/
@@ -157,13 +157,13 @@
* i.e. 'raw' means no quoting before saving/updating data
* @access private
*/
- 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,
- 'logFile' => false
-
- );
+ 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,
+ 'logFile' => false
+ );
/**
* this array contains information about the tables
@@ -196,7 +196,6 @@
*/
var $_queryCache = array();
-
/**
* The object that contains the log-instance
* @access private
@@ -213,7 +212,8 @@
* MDB version
* @access private
*/
- var $_version = 1;
+ var $_MDBversion = 1;
+
// }}}
// {{{ __construct
@@ -258,10 +258,10 @@
/**
* @param mixed $dsn DSN string, DSN array or MDB object
* @param array $options
- * @param integer $version
+ * @param integer $MDBversion 1=MDB, 2=MDB2
* @access public
*/
- function MDB_QueryTool_Query($dsn=false, $options=array(), $version = 1)
+ function MDB_QueryTool_Query($dsn = false, $options = array(), $MDBversion = 1)
{
//$this->__construct($dsn, $options);
@@ -285,7 +285,7 @@
}
if ($autoConnect && $dsn) {
- $this->connect($dsn, $options, $version);
+ $this->connect($dsn, $options, $MDBversion);
}
if (is_null($this->sequenceName)) {
@@ -300,13 +300,13 @@
* use this method if you want to connect manually
* @param mixed $dsn DSN string, DSN array or MDB object
* @param array $options
- * @param integer $version
+ * @param integer $MDBversion 1=MDB, 2=MDB2
*/
- function connect($dsn, $options=array(), $version = 1)
+ function connect($dsn, $options=array(), $MDBversion = 1)
{
if (is_object($dsn)) {
$res =& $dsn;
- } elseif ($version == 2) {
+ } elseif ($MDBversion == 2) {
require_once 'MDB2.php';
$res = &MDB2::connect($dsn, $options);
} else {
@@ -347,8 +347,8 @@
function setDbInstance(&$dbh)
{
$this->db =& $dbh;
- $this->_version = is_a($this->db, 'mdb2_driver_common') ? 2 : 1;
- if ($this->_version == 2) {
+ $this->_MDBversion = is_a($this->db, 'mdb2_driver_common') ? 2 : 1;
+ if ($this->_MDBversion == 2) {
$this->db->setFetchMode(MDB2_FETCHMODE_ASSOC);
} else {
$this->db->setFetchMode(MDB_FETCHMODE_ASSOC);
@@ -1418,7 +1418,8 @@
{
if ($this->getOption('raw')) {
return $data;
- } elseif ($this->_version == 2) {
+ }
+ if ($this->_MDBversion == 2) {
switch(gettype($data)) {
case 'array':
return $this->_quoteArray($data);
@@ -1562,7 +1563,7 @@
if (!is_object($this->db)) {
return false;
}
- if ($this->_version == 2) {
+ if ($this->_MDBversion == 2) {
$this->db->loadModule('Reverse');
$res = $this->db->reverse->tableInfo($table);
} else {
@@ -1578,7 +1579,7 @@
foreach ($res as $key => $val) {
$ret[$val['name']] = $val;
}
- if ($this->_version == 2) {
+ if ($this->_MDBversion == 2) {
if ($this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE)
{
$ret = array_change_key_case($ret,
$this->db->options['field_case']);
}
@@ -2001,13 +2002,15 @@
// $query['limit'] has preference!
$limit = isset($query['limit']) ? $query['limit'] : $this->_limit;
if (!$isCalledViaGetCount && !empty($limit[1])) { // is there a count set?
- if ($this->_version == 2) {
+ if ($this->_MDBversion == 2) {
+ $func = 'setLimit';
$error = $this->db->setLimit($limit[1], $limit[0]);
} else {
+ $func = 'setSelectedRowRange';
$error = $this->db->setSelectedRowRange($limit[0], $limit[1]);
}
if (PEAR::isError($error)) {
- $this->_errorSet('MDB_QueryTool_Common::_buildSelectQuery
setSelectedRowRange failed '.$error->getMessage());
+ $this->_errorSet('MDB_QueryTool_Common::_buildSelectQuery
'.$func.' failed '.$error->getMessage());
$this->_errorLog($error->getUserInfo());
return false;
}
@@ -2080,7 +2083,6 @@
$method = 'query'.substr($method, 3);
}
if (PEAR::isError($res = $this->db->$method($query))) {
-
if ($this->getOption('verbose')) {
//$this->_errorSet($this->db->errorMessage($res->getCode()));
$this->_errorSet($res->getMessage() .'-'. $res->getUserInfo());