diff --git a/dblayer.php b/dblayer.php index 3ad8ccb..4b86e45 100644 --- a/dblayer.php +++ b/dblayer.php @@ -956,7 +956,8 @@ class dblayer extends PDO switch ($this->getAttribute(PDO::ATTR_DRIVER_NAME)) { case "sqlite": - $sql = "CREATE TABLE $this->sep$this->tableprefix$this->table$this->sep ". + $sql = "CREATE TABLE IF NOT EXISTS ". + "$this->sep$this->tableprefix$this->table$this->sep ". "(\n"; $i = 0; foreach ($this->fields as $field=>$params) @@ -1051,7 +1052,8 @@ class dblayer extends PDO $sql .=")"; break; case "mysql": - $sql = "CREATE TABLE $this->sep$this->tableprefix$this->table$this->sep ". + $sql = "CREATE TABLE IF NOT EXISTS ". + "$this->sep$this->tableprefix$this->table$this->sep ". "(\n"; $i = 0; foreach ($this->fields as $field=>$params) @@ -1142,7 +1144,8 @@ class dblayer extends PDO $sql .=") ENGINE=InnoDB DEFAULT CHARSET=utf8;"; break; case "pgsql": - $sql = "CREATE TABLE \"$this->tableprefix$this->table\" (\n"; + $sql = "CREATE TABLE IF NOT EXISTS ". + "\"$this->tableprefix$this->table\" (\n"; $i = 0; foreach ($this->fields as $field=>$params) {