thomascube
2008-04-05 e70d6ea64e711096af36b1234f8545b870ea5f45
program/include/rcube_db.inc
old mode 100755 new mode 100644
@@ -5,7 +5,7 @@
 | 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:                                                              |
@@ -25,15 +25,14 @@
/**
 * 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
@@ -102,7 +101,7 @@
      $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;
@@ -154,8 +153,18 @@
    $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
   *
@@ -360,12 +369,14 @@
   */
  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);
    }
@@ -421,6 +432,22 @@
      $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);
    }
@@ -578,4 +605,4 @@
  }  // end class rcube_db
?>
?>