diff --git a/oss/vtiger/trunk/include/database/PearDatabase.php b/oss/vtiger/trunk/include/database/PearDatabase.php index 9bcc07fb..30c15248 100644 --- a/oss/vtiger/trunk/include/database/PearDatabase.php +++ b/oss/vtiger/trunk/include/database/PearDatabase.php @@ -196,17 +196,10 @@ class PearDatabase{ static function &getInstance() { global $adb, $log; - $multiConnection = PerformancePrefs::getBoolean('ALLOW_MULTI_DB_CONNECTION_PER_REQUEST', true); - if(!$multiConnection) { - // Reuse the instance - if(!isset($adb)) { - $adb = new self(); - } - return $adb; - } else { - // Create new instance - return (new self()); + if(!isset($adb)) { + $adb = new self(); } + return $adb; } // END @@ -275,6 +268,14 @@ class PearDatabase{ function checkError($msg='', $dieOnError=false) { if($this->dieOnError || $dieOnError) { + $bt = debug_backtrace(); + $ut = array(); + foreach ($bt as $t) { + $ut[] = array('file'=>$t['file'],'line'=>$t['line'],'function'=>$t['function']); + } + echo '
';
+			var_export($ut);
+			echo '
'; $this->println("ADODB error ".$msg."->[".$this->database->ErrorNo()."]".$this->database->ErrorMsg()); die ($msg."ADODB error ".$msg."->".$this->database->ErrorMsg()); } else { @@ -1137,6 +1138,15 @@ class PearDatabase{ } return $last_insert_id; } + + // Function to escape the special characters in database name based on database type. + function escapeDbName($dbName='') { + if ($dbName == '') $dbName = $this->dbName; + if($this->isMySql()) { + $dbName = "`{$dbName}`"; + } + return $dbName; + } } /* End of class */ if(empty($adb)) { @@ -1145,4 +1155,4 @@ if(empty($adb)) { } //$adb->database->setFetchMode(ADODB_FETCH_NUM); -?> +?> \ No newline at end of file