mirror of
https://github.com/e107inc/e107.git
synced 2025-01-29 10:38:08 +01:00
Support multiple database connections for the same mysql-user.
This commit is contained in:
parent
f4e3564c72
commit
d110d8d4e9
@ -328,7 +328,10 @@ class e_db_mysql
|
||||
$this->db_Set_Charset();
|
||||
$this->setSQLMode();
|
||||
|
||||
if ($db_ConnectionID == NULL){ $db_ConnectionID = $this->mySQLaccess; }
|
||||
//if ($db_ConnectionID == NULL){
|
||||
$db_ConnectionID = $this->mySQLaccess;
|
||||
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -347,18 +350,26 @@ class e_db_mysql
|
||||
|
||||
/**
|
||||
* Select the database to use.
|
||||
* @param string database name
|
||||
* @param string table prefix . eg. e107_
|
||||
* @param string $database name
|
||||
* @param string $table prefix . eg. e107_
|
||||
* @param boolean $multiple set to maintain connection to a secondary database.
|
||||
* @return boolean true when database selection was successful otherwise false.
|
||||
*/
|
||||
public function database($database, $prefix = MPREFIX)
|
||||
public function database($database, $prefix = MPREFIX, $multiple=false)
|
||||
{
|
||||
$this->mySQLdefaultdb = $database;
|
||||
$this->mySQLPrefix = $prefix;
|
||||
|
||||
|
||||
if($multiple === true)
|
||||
{
|
||||
$this->mySQLPrefix = "`".$database."`.".$prefix;
|
||||
return true;
|
||||
}
|
||||
|
||||
if($this->pdo)
|
||||
{
|
||||
try
|
||||
|
||||
try
|
||||
{
|
||||
$this->mySQLaccess->query("use ".$database);
|
||||
// $this->mySQLaccess->select_db($database); $dbh->query("use newdatabase");
|
||||
@ -1816,7 +1827,8 @@ class e_db_mysql
|
||||
$this->mySQLcurTable = $table;
|
||||
$this->tabset = true;
|
||||
}
|
||||
return ' `'.$this->mySQLPrefix.$table.'`'.substr($matches[0],-1);
|
||||
|
||||
return " ".$this->mySQLPrefix.$table.substr($matches[0],-1);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user