cvs: /php4/pear/DB common.php
| From: | Stig Bakken | Date: | Sun, 12 Dec 1999 09:27:29 +0000 |
| Subject: | cvs: /php4/pear/DB common.php | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-7810@lists.php.net to get a copy of this message | ||
ssb Sun Dec 12 04:27:29 1999 EDT
Modified files:
/php4/pear/DB common.php
Log:
Renamed (doOne doRow doAssoc) to (getOne getRow getAssoc).
Index: php4/pear/DB/common.php
diff -u php4/pear/DB/common.php:1.2 php4/pear/DB/common.php:1.3
--- php4/pear/DB/common.php:1.2 Wed Dec 8 08:49:35 1999
+++ php4/pear/DB/common.php Sun Dec 12 04:26:58 1999
@@ -79,7 +79,7 @@
// }}}
- // {{{ doOne()
+ // {{{ getOne()
/**
* Fetch the first column of the first row of data returned from
@@ -88,7 +88,7 @@
*
* @param $query the SQL query
*/
- function doOne($query) {
+ function getOne($query) {
$sth = $this->query($query);
if (DB::isError($sth)) {
return $sth;
@@ -102,7 +102,7 @@
}
// }}}
- // {{{ doRow()
+ // {{{ getRow()
/**
* Fetch the first row of data returned from a query. Takes care
@@ -112,7 +112,7 @@
* @return array the first row of results as an array indexed from
* 0, or a DB error code.
*/
- function doRow($query) {
+ function getRow($query) {
$sth = $this->query($query);
if (DB::isError($sth)) {
return $sth;
@@ -123,7 +123,7 @@
}
// }}}
- // {{{ doAssoc()
+ // {{{ getAssoc()
/**
* Fetch the entire result set of a query and return it as an
@@ -143,8 +143,33 @@
* array with the $force_array parameter). A DB error code is
* returned on errors. If the result set contains fewer than two
* columns, DB_ERROR_TRUNCATED is returned.
+ *
+ * For example, if the table "mytable" contains:
+ *
+ * ID TEXT DATE
+ * --------------------------------
+ * 1 'one' 944679408
+ * 2 'two' 944679408
+ * 3 'three' 944679408
+ *
+ * Then the call getAssoc('SELECT id,text FROM mytable') returns:
+ * array(
+ * '1' => 'one',
+ * '2' => 'two',
+ * '3' => 'three',
+ * )
+ *
+ * ...while the call getAssoc('SELECT id,text,date FROM mydate') returns:
+ * array(
+ * '1' => array('one', '944679408'),
+ * '2' => array('two', '944679408'),
+ * '3' => array('three', '944679408')
+ * )
+ *
+ * Keep in mind that database functions in PHP usually return string
+ * values regardless of the DBMS type.
*/
- function doAssoc($query, $force_array = false) {
+ function getAssoc($query, $force_array = false) {
$sth = $this->query($query);
if (DB::isError($sth)) {
return $sth;