From 66e90a2cb6b1967caa695ed8aa2ce1fa6788cf64 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Sat, 21 Aug 2010 17:37:49 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=B0=205.2=20=E5=90=8E?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=20SVN=20=E6=8F=90=E4=BA=A4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit yuchenghu@hawebs.net git-svn-id: https://svn.code.sf.net/p/hawebs/svn@548 a2543c7e-f6e9-4f8a-8bff-1ffc34733512 --- .../trunk/include/database/PearDatabase.php | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) 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