dblayer : create table : add "if not exists"
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2241 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user