[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.db.inc.php
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.db.inc.php |
Date: |
Fri, 16 Mar 2007 09:14:49 +0000 |
CVSROOT: /sources/phpgwapi
Module name: phpgwapi
Changes by: Sigurd Nes <sigurdne> 07/03/16 09:14:49
Modified files:
inc : class.db.inc.php
Log message:
allows connection to second database on different server / servertype.
Better error reporting.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.db.inc.php?cvsroot=phpgwapi&r1=1.33&r2=1.34
Patches:
Index: class.db.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.db.inc.php,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- class.db.inc.php 11 Mar 2007 18:54:55 -0000 1.33
+++ class.db.inc.php 16 Mar 2007 09:14:49 -0000 1.34
@@ -9,7 +9,7 @@
* @link http://www.sanisoft.com/phplib/manual/DB_sql.php
* @package phpgwapi
* @subpackage database
- * @version $Id: class.db.inc.php,v 1.33 2007/03/11 18:54:55 sigurdne
Exp $
+ * @version $Id: class.db.inc.php,v 1.34 2007/03/16 09:14:49 sigurdne
Exp $
*/
if (empty($GLOBALS['phpgw_info']['server']['db_type']))
@@ -90,10 +90,15 @@
* Constructor
* @param string $query query to be executed (optional)
*/
- function db($query = '')
+ function db($query = '',$db_type = '')
{
+ if(!$db_type)
+ {
+ $db_type = $this->Type ? $this->Type :
$GLOBALS['phpgw_info']['server']['db_type'];
+ }
+
// We do it this way to allow it to be easily extended
in the future
- switch ( $GLOBALS['phpgw_info']['server']['db_type'] )
+ switch ( $db_type )
{
case 'postgres':
$this->join = " JOIN ";
@@ -103,7 +108,7 @@
//do nothing for now
}
- $this->adodb =
newADOConnection($GLOBALS['phpgw_info']['server']['db_type']);
+ $this->adodb = newADOConnection($db_type);
$this->adodb->SetFetchMode(3);
if($query != '')
{
@@ -253,7 +258,14 @@
$this->resultSet = $this->adodb->Execute($Query_String);
if(!$this->resultSet && $this->Halt_On_Error == 'yes')
{
- trigger_error("$Query_String\n" .
$this->adodb->ErrorMsg(), E_USER_ERROR);
+ if($file)
+ {
+ trigger_error("$Query_String\n in File:
" . $file . "\n on Line: " . $line ."\n". $this->adodb->ErrorMsg(),
E_USER_ERROR);
+ }
+ else
+ {
+ trigger_error("$Query_String\n".
$this->adodb->ErrorMsg(), E_USER_ERROR);
+ }
}
else
{