mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-24 07:46:20 +00:00
Disable connection cache workaround
This commit is contained in:
parent
330aa32c97
commit
4deda41e19
1 changed files with 13 additions and 13 deletions
|
@ -29,13 +29,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
$PDOCache = array();
|
||||
// $PDOCache = array();
|
||||
|
||||
class DBLayer {
|
||||
|
||||
private $PDO;
|
||||
private $host;
|
||||
private $dbname;
|
||||
// private $host;
|
||||
// private $dbname;
|
||||
|
||||
/**
|
||||
* The PDO object, instantiated by the constructor
|
||||
|
@ -51,15 +51,15 @@ class DBLayer {
|
|||
function __construct($db, $dbn = null)
|
||||
{
|
||||
global $cfg;
|
||||
$this->host = $cfg['db'][$db]['host'];
|
||||
$this->dbname = $cfg['db'][$db]['name'];
|
||||
global $PDOCache;
|
||||
// $this->host = $cfg['db'][$db]['host'];
|
||||
// $this->dbname = $cfg['db'][$db]['name'];
|
||||
/*global $PDOCache;
|
||||
if (isset($PDOCache[$this->host])) {
|
||||
$this->PDO = $PDOCache[$this->host]['pdo'];
|
||||
} else {
|
||||
} else {*/
|
||||
$dsn = "mysql:";
|
||||
$dsn .= "host=" . $cfg['db'][$db]['host'] . ";";
|
||||
// $dsn .= "dbname=" . $cfg['db'][$db]['name'] . ";";
|
||||
$dsn .= "dbname=" . $cfg['db'][$db]['name'] . ";"; // Comment this out when using the cache
|
||||
$dsn .= "port=" . $cfg['db'][$db]['port'] . ";";
|
||||
|
||||
$opt = array(
|
||||
|
@ -68,11 +68,11 @@ class DBLayer {
|
|||
PDO::ATTR_PERSISTENT => true
|
||||
);
|
||||
$this->PDO = new PDO($dsn, $cfg['db'][$db]['user'], $cfg['db'][$db]['pass'], $opt);
|
||||
$PDOCache[$this->host] = array();
|
||||
/* $PDOCache[$this->host] = array();
|
||||
$PDOCache[$this->host]['pdo'] = $this->PDO;
|
||||
$PDOCache[$this->host]['use'] = $this->dbname;
|
||||
$this->PDO->query('USE ' . $this->dbname . ';'); // FIXME safety
|
||||
}
|
||||
*/ //$this->PDO->query('USE ' . $this->dbname . ';'); // FIXME safety
|
||||
/*}*/
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
|
@ -80,11 +80,11 @@ class DBLayer {
|
|||
}
|
||||
|
||||
function useDb() {
|
||||
global $PDOCache;
|
||||
/*global $PDOCache;
|
||||
if ($PDOCache[$this->host]['use'] != $this->dbname) {
|
||||
$PDOCache[$this->host]['use'] = $this->dbname;
|
||||
$this->PDO->query('USE ' . $this->dbname . ';'); // FIXME safety
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue