dblayer : Add dropTable support
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1644 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
26
dblayer.php
26
dblayer.php
@@ -689,6 +689,32 @@ class dblayer extends PDO
|
|||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Drop the table */
|
||||||
|
public function dropTable ()
|
||||||
|
{
|
||||||
|
if ($this->db === null)
|
||||||
|
throw new Exception (_("Database not connected"));
|
||||||
|
switch ($this->db->getAttribute(PDO::ATTR_DRIVER_NAME))
|
||||||
|
{
|
||||||
|
case "sqlite":
|
||||||
|
$sql = "DROP TABLE `$this->tableprefix$this->table`";
|
||||||
|
break;
|
||||||
|
case "mysql":
|
||||||
|
$sql = "DROP TABLE `$this->tableprefix$this->table`";
|
||||||
|
break;
|
||||||
|
case "pgsql":
|
||||||
|
$sql = "DROP TABLE `$this->tableprefix$this->table`";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception (sprintf (_("Unknown DB engine for drop table '%s'"),
|
||||||
|
$this->db->getAttribute(PDO::ATTR_DRIVER_NAME)),
|
||||||
|
500);
|
||||||
|
}
|
||||||
|
if ($this->debug)
|
||||||
|
echo "$sql\n";
|
||||||
|
return $this->db->exec($sql);
|
||||||
|
}
|
||||||
|
|
||||||
/** Create the table defined by the differents fields.
|
/** Create the table defined by the differents fields.
|
||||||
Define the SQL syntax based on SQL engines
|
Define the SQL syntax based on SQL engines
|
||||||
$table = "dns zones";
|
$table = "dns zones";
|
||||||
|
|||||||
Reference in New Issue
Block a user