diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-10-04 15:15:40 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-10-04 15:15:40 +0000 |
commit | 26aba1a1f170ac51a56fe86bbc19588e0efee3c3 (patch) | |
tree | a92878b658c325297e5054d5622d642934b189df /phpBB/includes/db/dbal.php | |
parent | f7f6e9bcde7a1508109146f462d4627a484eb594 (diff) | |
download | forums-26aba1a1f170ac51a56fe86bbc19588e0efee3c3.tar forums-26aba1a1f170ac51a56fe86bbc19588e0efee3c3.tar.gz forums-26aba1a1f170ac51a56fe86bbc19588e0efee3c3.tar.bz2 forums-26aba1a1f170ac51a56fe86bbc19588e0efee3c3.tar.xz forums-26aba1a1f170ac51a56fe86bbc19588e0efee3c3.zip |
- finally removed sql_numrows
- sql_fetchfield now in dbal.php
- check query id correctly as well as other tiny fixes
git-svn-id: file:///svn/phpbb/trunk@6439 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/db/dbal.php')
-rw-r--r-- | phpBB/includes/db/dbal.php | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index 5dedc3e940..732ecdfed6 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -110,12 +110,12 @@ class dbal */ function sql_fetchrowset($query_id = false) { - if (!$query_id) + if ($query_id === false) { $query_id = $this->query_result; } - if ($query_id) + if ($query_id !== false) { $result = array(); while ($row = $this->sql_fetchrow($query_id)) @@ -130,6 +130,38 @@ class dbal } /** + * Fetch field + * if rownum is false, the current row is used, else it is pointing to the row (zero-based) + */ + function sql_fetchfield($field, $rownum = false, $query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($query_id !== false) + { + if ($rownum !== false) + { + $this->sql_rowseek($rownum, $query_id); + } + + if (!is_object($query_id) && isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_fetchfield($query_id, $field); + } + + $row = $this->sql_fetchrow($query_id); + return (isset($row[$field])) ? $row[$field] : false; + } + + return false; + } + + /** * SQL Transaction * @access private */ |