diff --git a/dblayer.php b/dblayer.php index b0af1ee..020a486 100644 --- a/dblayer.php +++ b/dblayer.php @@ -559,6 +559,10 @@ class dblayer if ($this->sep === "") throw new Exception (dgettext("domframework", "Database not connected"), 500); + if ($this->table === null) + throw new \Exception (dgettext("domframework", + "No table name defined to insert in the table"), + 500); if ($this->unique === null) throw new Exception (dgettext("domframework", "Unique fields of table are not defined"), 500); @@ -657,6 +661,9 @@ class dblayer if ($this->sep === "") throw new Exception (dgettext("domframework", "Database not connected"), 500); + if ($this->table === null) + throw new \Exception (dgettext("domframework", + "No table name defined to read the table"), 500); if ($select !== null && !is_array ($select)) throw new Exception (dgettext("domframework", "Select information provided is not an array"), @@ -824,6 +831,10 @@ class dblayer if ($this->sep === "") throw new Exception (dgettext("domframework", "Database not connected"), 500); + if ($this->table === null) + throw new \Exception (dgettext("domframework", + "No table name defined to update in the table"), + 500); if (count ($this->fields) === 0) throw new Exception (dgettext("domframework", "No Field defined"), 500); if ($this->primary === null) @@ -920,6 +931,10 @@ class dblayer if ($this->debug) echo "== Entering delete\n"; if ($this->sep === "") throw new Exception (dgettext("domframework", "Database not connected")); + if ($this->table === null) + throw new \Exception (dgettext("domframework", + "No table name defined to delete in the table"), + 500); $deletekey = $this->hookpredelete ($deletekey); $req = "DELETE FROM $this->sep$this->tableprefix$this->table$this->sep "; $req .= "WHERE $this->primary = :primary"; @@ -960,6 +975,9 @@ class dblayer if ($this->debug) echo "== Entering dropTables\n"; if ($this->sep === "") throw new Exception (dgettext("domframework", "Database not connected")); + if ($this->table === null) + throw new \Exception (dgettext("domframework", + "No table name defined to drop the table"), 500); $sql = "DROP TABLE $this->sep$this->tableprefix$this->table$this->sep"; if ($this->debug) echo "$sql\n"; @@ -990,6 +1008,9 @@ class dblayer 500); if (count ($this->fields) === 0) throw new Exception (dgettext("domframework", "No Field defined"), 500); + if ($this->table === null) + throw new \Exception (dgettext("domframework", + "No table name defined to create the table"), 500); switch (self::$instance[$this->dsn]->getAttribute(PDO::ATTR_DRIVER_NAME)) { case "sqlite":