cvs: pear /MDB common.php
| From: | Lukas Smith | Date: | Sun, 21 Jul 2002 00:15:06 +0000 |
| Subject: | cvs: pear /MDB common.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5229@lists.php.net to get a copy of this message | ||
lsmith Sat Jul 20 20:15:06 2002 EDT
Modified files:
/pear/MDB common.php
Log:
extended query*() methods to be able tp process a passed fetchmode
extended queryCol() method to be able tp process a passed column number
set fetchmode to DB_FETCHMODE_ORDERED in several places where the default mode would be
undesireable
Index: pear/MDB/common.php
diff -u pear/MDB/common.php:1.33 pear/MDB/common.php:1.34
--- pear/MDB/common.php:1.33 Sat Jul 20 19:39:39 2002
+++ pear/MDB/common.php Sat Jul 20 20:15:05 2002
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@dybnet.de> |
// +----------------------------------------------------------------------+
//
-// $Id: common.php,v 1.33 2002/07/20 23:39:39 lsmith Exp $
+// $Id: common.php,v 1.34 2002/07/21 00:15:05 lsmith Exp $
//
// Base class for DB implementations.
//
@@ -3911,7 +3911,7 @@
*
* @access public
*/
- function queryOne($query, $type = NULL)
+ function queryOne($query, $type = NULL, $fetchmode = DB_FETCHMODE_DEFAULT)
{
if($type != NULL) {
$types = array($type);
@@ -3920,7 +3920,7 @@
if (MDB::isError($result)) {
return $result;
}
- return ($this->fetchOne($result));
+ return ($this->fetchOne($result, $fetchmode));
}
// }}}
@@ -3936,18 +3936,19 @@
* expected datatypes of the result set columns, so that the eventual
* conversions may be performed. The default list of datatypes is
* empty, meaning that no conversion is performed.
+ * @param int $fetchmode how the array data should be indexed
*
* @return mixed data array on success, a DB error on failure
*
* @access public
*/
- function queryRow($query, $types = NULL)
+ function queryRow($query, $types = NULL, $fetchmode = DB_FETCHMODE_DEFAULT)
{
$result = $this->query($query, $types);
if (MDB::isError($result)) {
return $result;
}
- return ($this->fetchRow($result));
+ return ($this->fetchRow($result, $fetchmode));
}
// }}}
@@ -3962,12 +3963,14 @@
* datatype of the result set field, so that an eventual conversion
* may be performed. The default datatype is text, meaning that no
* conversion is performed
+ * @param int $fetchmode how the array data should be indexed
+ * @param int $colnum the row number to fetch
*
* @return mixed data array on success, a DB error on failure
*
* @access public
*/
- function queryCol($query, $type = NULL)
+ function queryCol($query, $type = NULL, $fetchmode = DB_FETCHMODE_DEFAULT, $colnum =
'0')
{
if($type != NULL) {
$types = array($type);
@@ -3976,7 +3979,7 @@
if (MDB::isError($result)) {
return $result;
}
- return ($this->fetchCol($result));
+ return ($this->fetchCol($result, $fetchmode, $colnum));
}
// }}}
@@ -3991,17 +3994,18 @@
* expected datatypes of the result set columns, so that the eventual
* conversions may be performed. The default list of datatypes is
* empty, meaning that no conversion is performed.
+ * @param int $fetchmode how the array data should be indexed
*
* @return mixed data array on success, a DB error on failure
*
* @access public
*/
- function queryAll($query, $types = NULL)
+ function queryAll($query, $types = NULL, $fetchmode = DB_FETCHMODE_DEFAULT)
{
if (MDB::isError($result = $this->query($query, $types))) {
return $result;
}
- return ($this->fetchAll($result));
+ return ($this->fetchAll($result, $fetchmode));
}
// }}}