diff --git a/dblayer.php b/dblayer.php index 7f69487..f6d3cdb 100644 --- a/dblayer.php +++ b/dblayer.php @@ -167,7 +167,7 @@ class dblayer extends PDO /** Return the connected database name from DSN used to connect */ public function databasename () { - if ($this === null) + if ($this->sep === "") throw new Exception (dgettext("domframework", "Database not connected"), 500); $vals = explode (";", substr (strstr ($this->dsn, ":"), 1)); @@ -185,7 +185,7 @@ class dblayer extends PDO /** Return all the tables available in the database */ public function listTables () { - if ($this === null) + if ($this->sep === "") throw new Exception (dgettext("domframework", "Database not connected"), 500); switch ($this->getAttribute(PDO::ATTR_DRIVER_NAME)) @@ -515,7 +515,7 @@ class dblayer extends PDO public function insert ($datas) { if ($this->debug) echo "== Entering insert\n"; - if ($this === null) + if ($this->sep === "") throw new Exception (dgettext("domframework", "Database not connected"), 500); if ($this->unique === null) @@ -605,7 +605,7 @@ class dblayer extends PDO $whereOr=false) { if ($this->debug) echo "== Entering read\n"; - if ($this === null) + if ($this->sep === "") throw new Exception (dgettext("domframework", "Database not connected"), 500); if ($select !== null && !is_array ($select)) @@ -721,7 +721,7 @@ class dblayer extends PDO public function update ($updatekey, $datas) { if ($this->debug) echo "== Entering update\n"; - if ($this === null) + if ($this->sep === "") throw new Exception (dgettext("domframework", "Database not connected"), 500); if (count ($this->fields) === 0) @@ -806,7 +806,7 @@ class dblayer extends PDO public function delete ($deletekey) { if ($this->debug) echo "== Entering delete\n"; - if ($this === null) + if ($this->sep === "") throw new Exception (dgettext("domframework", "Database not connected")); $req = "DELETE FROM $this->sep$this->tableprefix$this->table$this->sep "; $req .= "WHERE $this->primary = :primary"; @@ -843,7 +843,7 @@ class dblayer extends PDO public function dropTable () { if ($this->debug) echo "== Entering dropTables\n"; - if ($this === null) + if ($this->sep === "") throw new Exception (dgettext("domframework", "Database not connected")); $sql = "DROP TABLE $this->sep$this->tableprefix$this->table$this->sep"; if ($this->debug) @@ -870,7 +870,7 @@ class dblayer extends PDO public function createTable () { if ($this->debug) echo "== Entering createTable\n"; - if ($this === null) + if ($this->sep === "") throw new Exception (dgettext("domframework", "Database not connected"), 500); if (count ($this->fields) === 0)