old mode 100755
new mode 100644
| | |
| | | | program/include/rcube_db.inc | |
| | | | | |
| | | | This file is part of the RoundCube Webmail client | |
| | | | Copyright (C) 2005, RoundCube Dev. - Switzerland | |
| | | | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland | |
| | | | Licensed under the GNU GPL | |
| | | | | |
| | | | PURPOSE: | |
| | |
| | | /** |
| | | * Obtain the PEAR::DB class that is used for abstraction |
| | | */ |
| | | require_once('DB.php'); |
| | | |
| | | require_once 'DB.php'; |
| | | |
| | | /** |
| | | * Database independent query interface |
| | | * |
| | | * This is a wrapper for the PEAR::DB class |
| | | * |
| | | * @package RoundCube Webmail |
| | | * @package Database |
| | | * @author David Saez Padros <david@ols.es> |
| | | * @author Thomas Bruederli <roundcube@gmail.com> |
| | | * @version 1.17 |
| | |
| | | $this->db_error = TRUE; |
| | | $this->db_error_msg = $dbh->getMessage(); |
| | | |
| | | raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, |
| | | raise_error(array('code' => 603, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, |
| | | 'message' => $this->db_error_msg), TRUE, FALSE); |
| | | |
| | | return FALSE; |
| | |
| | | $this->db_handle = $this->dsn_connect($dsn); |
| | | $this->db_connected = $this->db_handle ? TRUE : FALSE; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Activate/deactivate debug mode |
| | | * (not implemented) |
| | | */ |
| | | function set_debug($dbg = true) |
| | | { |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Getter for error state |
| | | * |
| | |
| | | */ |
| | | function _fetch_row($result, $mode) |
| | | { |
| | | if (!$result || !is_object($result) || DB::isError($result)) |
| | | if (!$result || DB::isError($result)) |
| | | { |
| | | raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, |
| | | 'message' => $this->db_link->getMessage()), TRUE, FALSE); |
| | | return FALSE; |
| | | } |
| | | elseif (!is_object($result)) |
| | | return FALSE; |
| | | |
| | | return $result->fetchRow($mode); |
| | | } |
| | |
| | | $this->db_connect('r'); |
| | | |
| | | return $this->db_handle->quoteIdentifier($str); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Escapes a string |
| | | * |
| | | * @param string The string to be escaped |
| | | * @return string The escaped string |
| | | * @access public |
| | | */ |
| | | function escapeSimple($str) |
| | | { |
| | | if (!$this->db_handle) |
| | | $this->db_connect('r'); |
| | | |
| | | return $this->db_handle->escapeSimple($str); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | } // end class rcube_db |
| | | |
| | | ?> |
| | | ?> |