From f5121b5639992fc9e51fd551bac2254429b638fa Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Sat, 04 Mar 2006 08:43:25 -0500 Subject: [PATCH] Updated localizations --- program/include/rcube_db.inc | 44 +++++++++++++++++++++++++++++++------------- 1 files changed, 31 insertions(+), 13 deletions(-) diff --git a/program/include/rcube_db.inc b/program/include/rcube_db.inc index e54dcc9..7cc29d2 100755 --- a/program/include/rcube_db.inc +++ b/program/include/rcube_db.inc @@ -35,7 +35,7 @@ * @package RoundCube Webmail * @author David Saez Padros <david@ols.es> * @author Thomas Bruederli <roundcube@gmail.com> - * @version 1.14 + * @version 1.16 * @link http://pear.php.net/package/DB */ class rcube_db @@ -78,16 +78,6 @@ { $this->__construct($db_dsnw,$db_dsnr); } - - - /** - * Object destructor - */ - function __destruct() - { - // before closing the database connection, write session data - session_write_close(); - } /** @@ -314,7 +304,35 @@ function fetch_assoc($res_id=NULL) { $result = $this->_get_result($res_id); + return $this->_fetch_row($result, DB_FETCHMODE_ASSOC); + } + + /** + * Get an index array for one row + * If no query handle is specified, the last query will be taken as reference + * + * @param number Optional query handle identifier + * @return mixed Array with col values or FALSE on failure + * @access public + */ + function fetch_array($res_id=NULL) + { + $result = $this->_get_result($res_id); + return $this->_fetch_row($result, DB_FETCHMODE_ORDERED); + } + + + /** + * Get co values for a result row + * + * @param object Query result handle + * @param number Fetch mode identifier + * @return mixed Array with col values or FALSE on failure + * @access private + */ + function _fetch_row($result, $mode) + { if (DB::isError($result)) { raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, @@ -322,9 +340,9 @@ return FALSE; } - return $result->fetchRow(DB_FETCHMODE_ASSOC); + return $result->fetchRow($mode); } - + /** * Formats input so it can be safely used in a query -- Gitblit v1.9.1