更新到 5.2 后第一次 SVN 提交。

yuchenghu@hawebs.net



git-svn-id: https://svn.code.sf.net/p/hawebs/svn@548 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-08-21 17:37:49 +00:00
parent ef8a057ac6
commit 66e90a2cb6
@@ -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 '<pre>';
var_export($ut);
echo '</pre>';
$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);
?>
?>