dblayer : Removing the unused singleton
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1951 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
35
dblayer.php
35
dblayer.php
@@ -51,8 +51,6 @@ class dblayer extends PDO
|
|||||||
public $unique = null;
|
public $unique = null;
|
||||||
/** An array to define the foreign keys of the field */
|
/** An array to define the foreign keys of the field */
|
||||||
public $foreign = array ();
|
public $foreign = array ();
|
||||||
/** The db connection */
|
|
||||||
public $db = null;
|
|
||||||
/** The verify unitary stack
|
/** The verify unitary stack
|
||||||
@param string $field The name of the field to test
|
@param string $field The name of the field to test
|
||||||
@param string $val The value of the field to test */
|
@param string $val The value of the field to test */
|
||||||
@@ -101,20 +99,6 @@ class dblayer extends PDO
|
|||||||
if (! isset ($driver[0]))
|
if (! isset ($driver[0]))
|
||||||
throw new Exception (_("No valid DSN provided"), 500);
|
throw new Exception (_("No valid DSN provided"), 500);
|
||||||
// Force specifics initialisations
|
// Force specifics initialisations
|
||||||
/* $oldInst = self::getInstance($dsn, $username);
|
|
||||||
|
|
||||||
if ($oldInst !== null)
|
|
||||||
{
|
|
||||||
$this = $oldInst["db"];
|
|
||||||
$this->setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
||||||
$this->exec("PRAGMA foreign_keys = ON");
|
|
||||||
$this->sep = $oldInst["sep"];
|
|
||||||
$this->dsn = $oldInst["dsn"];
|
|
||||||
echo "OLD\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "NEW\n";*/
|
|
||||||
switch ($driver[0])
|
switch ($driver[0])
|
||||||
{
|
{
|
||||||
case "sqlite":
|
case "sqlite":
|
||||||
@@ -178,20 +162,6 @@ echo "NEW\n";*/
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->dsn = $dsn;
|
$this->dsn = $dsn;
|
||||||
self::$instance["$dsn-$username"]["db"] = $this;
|
|
||||||
self::$instance["$dsn-$username"]["dsn"] = $this->dsn;
|
|
||||||
self::$instance["$dsn-$username"]["sep"] = $this->sep;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Singleton function to open one connection to each database/user wanted */
|
|
||||||
private function getInstance ($dsn, $username)
|
|
||||||
{
|
|
||||||
if (self::$instance === null ||
|
|
||||||
array_key_exists ("$dsn-$username", self::$instance) === false)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return self::$instance["$dsn-$username"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the connected database name from DSN used to connect */
|
/** Return the connected database name from DSN used to connect */
|
||||||
@@ -1195,13 +1165,8 @@ echo "NEW\n";*/
|
|||||||
"PDO Engine not supported in dbLayer"), 500);
|
"PDO Engine not supported in dbLayer"), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->debug = true;
|
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
echo "$sql\n";
|
echo "$sql\n";
|
||||||
$rc=$this->exec($sql);
|
|
||||||
var_dump ($rc);
|
|
||||||
//print_r($this->errorInfo());
|
|
||||||
return $rc;
|
|
||||||
return $this->exec($sql);
|
return $this->exec($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user