dblayer : Simplify the prefix table code (all the calls are the same)

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1592 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-07-30 08:24:12 +00:00
parent 7c935b49ef
commit 8f9e540a4a

View File

@@ -255,7 +255,7 @@ class dblayer extends PDO
{
$table = $data[0];
$column = $data[1];
$req = "SELECT $column FROM `$table` WHERE $column=:$column";
$req = "SELECT $column FROM `$this->prefix$table` WHERE $column=:$column";
if ($this->debug) echo "DEBUG : $req\n";
$st = $this->db->prepare ($req);
$val = $datasOK[$foreign];
@@ -281,7 +281,7 @@ class dblayer extends PDO
$column), 405);
}
$req = "INSERT INTO `".$this->prefix.$this->table."` ";
$req = "INSERT INTO `$this->prefix$this->table` ";
$req .= "(".implode (",", array_keys ($datasOK)).")";
$req .= " VALUES ";
$req .= "(:".implode (",:", array_keys ($datasOK)).")";
@@ -344,7 +344,7 @@ class dblayer extends PDO
$req = "SELECT ";
$req .= implode (",", $display);
$req .= " FROM `".$this->prefix.$this->table."`";
$req .= " FROM `$this->prefix$this->table`";
if ($select !== null)
{
$req .= " WHERE ";
@@ -477,7 +477,7 @@ class dblayer extends PDO
{
$table = $data[0];
$column = $data[1];
$req = "SELECT $column FROM `$table` WHERE $column=:$column";
$req = "SELECT $column FROM `$this->prefix$table` WHERE $column=:$column";
if ($this->debug) echo "DEBUG : $req\n";
$st = $this->db->prepare ($req);
$val = $datasOK[$foreign];
@@ -504,7 +504,7 @@ class dblayer extends PDO
}
$datasOK[$this->primary] = $updatekey;
$req = "UPDATE `".$this->prefix.$this->table."` SET ";
$req = "UPDATE `".$this->prefix."$this->table` SET ";
$i = 0;
foreach ($datasOK as $key=>$val)
{
@@ -557,7 +557,7 @@ class dblayer extends PDO
{
if ($this->db === null)
throw new Exception ("Database not connected");
$req = "DELETE FROM `".$this->prefix.$this->table."` ";
$req = "DELETE FROM `$this->prefix$this->table` ";
$req .= "WHERE $this->primary = :primary";
$st = $this->db->prepare ($req);
if ($this->debug) echo "DEBUG : $req\n";
@@ -600,7 +600,7 @@ class dblayer extends PDO
switch ($this->db->getAttribute(PDO::ATTR_DRIVER_NAME))
{
case "sqlite":
$sql = "CREATE TABLE `$this->prefix.$this->table` (\n";
$sql = "CREATE TABLE `$this->prefix$this->table` (\n";
$i = 0;
foreach ($this->fields as $field=>$params)
{
@@ -681,7 +681,7 @@ class dblayer extends PDO
$sql .=")";
break;
case "mysql":
$sql = "CREATE TABLE `$this->prefix.$this->table` (\n";
$sql = "CREATE TABLE `$this->prefix$this->table` (\n";
$i = 0;
foreach ($this->fields as $field=>$params)
{
@@ -760,7 +760,7 @@ class dblayer extends PDO
$sql .=") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
break;
case "pgsql":
$sql = "CREATE TABLE \"$this->prefix.$this->table\" (\n";
$sql = "CREATE TABLE \"$this->prefix$this->table\" (\n";
$i = 0;
foreach ($this->fields as $field=>$params)
{