dblayeroo: the connect process need now the database name and generate an Exception if not provided in the DSN
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3725 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -115,10 +115,11 @@ class dblayeroo
|
||||
$this->DBException ("PDO error : ".$e->getMessage ());
|
||||
}
|
||||
}
|
||||
|
||||
// Force ForeignKeys support (disabled by default)
|
||||
self::$instance[$this->dsn]->exec ("PRAGMA foreign_keys = ON");
|
||||
$this->sep = "`";
|
||||
if ($this->databasename () === null)
|
||||
$this->DBException ("No Database provided in DSN");
|
||||
break;
|
||||
case "mysql":
|
||||
if (! array_key_exists ($this->dsn, self::$instance))
|
||||
@@ -141,6 +142,8 @@ class dblayeroo
|
||||
// Set the coding to UTF8
|
||||
self::$instance[$this->dsn]->exec ("SET CHARACTER SET utf8");
|
||||
$this->sep = "`";
|
||||
if ($this->databasename () === null)
|
||||
$this->DBException ("No Database provided in DSN");
|
||||
break;
|
||||
case "pgsql":
|
||||
if (! array_key_exists ($this->dsn, self::$instance))
|
||||
@@ -162,6 +165,8 @@ class dblayeroo
|
||||
// Set the coding to UTF8
|
||||
self::$instance[$this->dsn]->exec ("SET NAMES 'utf8'");
|
||||
$this->sep = "\"";
|
||||
if ($this->databasename () === null)
|
||||
$this->DBException ("No Database provided in DSN");
|
||||
break;
|
||||
default:
|
||||
$this->DBException (dgettext ("domframework",
|
||||
@@ -216,6 +221,13 @@ class dblayeroo
|
||||
{
|
||||
if ($this->sep === "")
|
||||
$this->DBException (dgettext ("domframework", "Database not connected"));
|
||||
if ($this->driver === "sqlite")
|
||||
{
|
||||
$dbFile = substr (strstr ($this->dsn, ":"), 1);
|
||||
if (trim ($dbFile) !== "")
|
||||
return $dbFile;
|
||||
return null;
|
||||
}
|
||||
$vals = explode (";", substr (strstr ($this->dsn, ":"), 1));
|
||||
$dsnExplode = array ();
|
||||
foreach ($vals as $val)
|
||||
|
||||
Reference in New Issue
Block a user