diff --git a/dblayeroo.php b/dblayeroo.php index eaa7ef3..167afa5 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -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)