Changeset 164 in subversion
- Timestamp:
- Mar 14, 2006 4:13:07 PM (7 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 3 edited
-
index.php (modified) (2 diffs)
-
program/include/main.inc (modified) (1 diff)
-
program/include/rcube_db.inc (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/index.php
r162 r164 3 3 +-----------------------------------------------------------------------+ 4 4 | RoundCube Webmail IMAP Client | 5 | Version 0.1-20060 220|5 | Version 0.1-20060314 | 6 6 | | 7 7 | Copyright (C) 2005, RoundCube Dev. - Switzerland | … … 111 111 load_gui(); 112 112 113 114 // check DB connections and exit on failure 115 if ($err_str = $DB->is_error()) 116 { 117 raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, 118 'message' => $err_str), FALSE, TRUE); 119 } 120 121 113 122 // error steps 114 123 if ($_action=='error' && !empty($_GET['_code'])) -
trunk/roundcubemail/program/include/main.inc
r159 r164 75 75 $DB = new rcube_db($CONFIG['db_dsnw'], $CONFIG['db_dsnr']); 76 76 $DB->sqlite_initials = $INSTALL_PATH.'SQL/sqlite.initial.sql'; 77 $DB->db_connect('w'); 78 77 79 78 80 // we can use the database for storing session data 79 81 // session queries do not work with MDB2 80 if ($CONFIG['db_backend']!='mdb2' && is_object($DB))82 if ($CONFIG['db_backend']!='mdb2' && !$DB->is_error()) 81 83 include_once('include/session.inc'); 82 84 -
trunk/roundcubemail/program/include/rcube_db.inc
r137 r164 36 36 * @author David Saez Padros <david@ols.es> 37 37 * @author Thomas Bruederli <roundcube@gmail.com> 38 * @version 1.1 638 * @version 1.17 39 39 * @link http://pear.php.net/package/DB 40 40 */ … … 46 46 var $db_mode = ''; // Connection mode 47 47 var $db_handle = 0; // Connection handle 48 var $db_pconn = false; // Use persistent connections 49 var $db_error = false; 50 var $db_error_msg = ''; 48 51 49 52 var $a_query_results = array('dummy'); … … 57 60 * @param string Optional DSN for read only operations 58 61 */ 59 function __construct($db_dsnw, $db_dsnr='' )62 function __construct($db_dsnw, $db_dsnr='', $pconn=false) 60 63 { 61 64 if ($db_dsnr=='') … … 64 67 $this->db_dsnw = $db_dsnw; 65 68 $this->db_dsnr = $db_dsnr; 69 $this->db_pconn = $pconn; 66 70 67 71 $dsn_array = DB::parseDSN($db_dsnw); … … 75 79 * @see rcube_db::__construct 76 80 */ 77 function rcube_db($db_dsnw, $db_dsnr='')78 { 79 $this->__construct($db_dsnw, $db_dsnr);81 function rcube_db($db_dsnw, $db_dsnr='', $pconn=false) 82 { 83 $this->__construct($db_dsnw, $db_dsnr); 80 84 } 81 85 … … 91 95 { 92 96 // Use persistent connections if available 93 $dbh = DB::connect($dsn, array('persistent' => TRUE));97 $dbh = DB::connect($dsn, array('persistent' => $this->db_pconn)); 94 98 95 99 if (DB::isError($dbh)) 96 100 { 101 $this->db_error = TRUE; 102 $this->db_error_msg = $dbh->getMessage(); 103 97 104 raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, 98 'message' => $dbh->getMessage()), TRUE, FALSE); 105 'message' => $this->db_error_msg), TRUE, FALSE); 106 107 return FALSE; 99 108 } 100 109 … … 143 152 144 153 $this->db_handle = $this->dsn_connect($dsn); 145 $this->db_connected = true; 154 $this->db_connected = $this->db_handle ? TRUE : FALSE; 155 } 156 157 158 /** 159 * Getter for error state 160 * 161 * @param boolean True on error 162 */ 163 function is_error() 164 { 165 return $this->db_error ? $this->db_error_msg : FALSE; 146 166 } 147 167 … … 204 224 205 225 $this->db_connect($mode); 226 227 if (!$this->db_connected) 228 return FALSE; 206 229 207 230 if ($this->db_provider == 'sqlite')
Note: See TracChangeset
for help on using the changeset viewer.
