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:
2015-01-27 18:05:33 +00:00
parent e49a5a97af
commit b152996eab

View File

@@ -51,8 +51,6 @@ class dblayer extends PDO
public $unique = null;
/** An array to define the foreign keys of the field */
public $foreign = array ();
/** The db connection */
public $db = null;
/** The verify unitary stack
@param string $field The name 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]))
throw new Exception (_("No valid DSN provided"), 500);
// 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])
{
case "sqlite":
@@ -178,20 +162,6 @@ echo "NEW\n";*/
break;
}
$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 */
@@ -1195,13 +1165,8 @@ echo "NEW\n";*/
"PDO Engine not supported in dbLayer"), 500);
}
$this->debug = true;
if ($this->debug)
echo "$sql\n";
$rc=$this->exec($sql);
var_dump ($rc);
//print_r($this->errorInfo());
return $rc;
return $this->exec($sql);
}