Update gettext : add spaces
DomCi : remove line too longs on all the files git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5280 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
192
dblayer.php
192
dblayer.php
@@ -133,10 +133,10 @@ class dblayer
|
||||
|
||||
$driver = @explode (":", $dsn);
|
||||
if (! isset ($driver[0]))
|
||||
throw new Exception (dgettext("domframework", "No valid DSN provided"),
|
||||
throw new \Exception (dgettext ("domframework", "No valid DSN provided"),
|
||||
500);
|
||||
if (! in_array ($driver[0], pdo_drivers ()))
|
||||
throw new \Exception (sprintf (dgettext("domframework",
|
||||
throw new \Exception (sprintf (dgettext ("domframework",
|
||||
"Driver PDO '%s' not available in PHP"),
|
||||
$driver[0]), 500);
|
||||
// Force specifics initialisations
|
||||
@@ -147,11 +147,11 @@ class dblayer
|
||||
// Look at the right to write in database and in the directory
|
||||
$file = substr ($dsn, 7);
|
||||
if (! is_writeable (dirname ($file)))
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"The directory for SQLite database is write protected"),
|
||||
500);
|
||||
if (file_exists ($file) && ! is_writeable ($file))
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"The SQLite database file is write protected"),
|
||||
500);
|
||||
if (function_exists ("posix_getuid") &&
|
||||
@@ -170,9 +170,9 @@ class dblayer
|
||||
self::$instance[$this->dsn]->setAttribute (PDO::ATTR_ERRMODE,
|
||||
PDO::ERRMODE_EXCEPTION);
|
||||
}
|
||||
catch (Exception $e)
|
||||
catch (\Exception $e)
|
||||
{
|
||||
throw new Exception ("PDO error : ".$e->getMessage(), 500);
|
||||
throw new \Exception ("PDO error : ".$e->getMessage(), 500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,9 +192,9 @@ class dblayer
|
||||
self::$instance[$this->dsn]->setAttribute (PDO::ATTR_ERRMODE,
|
||||
PDO::ERRMODE_EXCEPTION);
|
||||
}
|
||||
catch (Exception $e)
|
||||
catch (\Exception $e)
|
||||
{
|
||||
throw new Exception ("PDO error : ".$e->getMessage(), 500);
|
||||
throw new \Exception ("PDO error : ".$e->getMessage(), 500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,9 +213,9 @@ class dblayer
|
||||
self::$instance[$this->dsn]->setAttribute (PDO::ATTR_ERRMODE,
|
||||
PDO::ERRMODE_EXCEPTION);
|
||||
}
|
||||
catch (Exception $e)
|
||||
catch (\Exception $e)
|
||||
{
|
||||
throw new Exception ("PDO error : ".$e->getMessage(), 500);
|
||||
throw new \Exception ("PDO error : ".$e->getMessage(), 500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ class dblayer
|
||||
$this->sep = "\"";
|
||||
break;
|
||||
default:
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Unknown PDO driver provided"), 500);
|
||||
}
|
||||
return self::$instance[$this->dsn];
|
||||
@@ -235,7 +235,7 @@ class dblayer
|
||||
public function databasename ()
|
||||
{
|
||||
if ($this->sep === "")
|
||||
throw new Exception (dgettext("domframework", "Database not connected"),
|
||||
throw new \Exception (dgettext ("domframework", "Database not connected"),
|
||||
500);
|
||||
$vals = explode (";", substr (strstr ($this->dsn, ":"), 1));
|
||||
$dsnExplode = array ();
|
||||
@@ -254,7 +254,7 @@ class dblayer
|
||||
public function listTables ()
|
||||
{
|
||||
if ($this->sep === "")
|
||||
throw new Exception (dgettext("domframework", "Database not connected"),
|
||||
throw new \Exception (dgettext ("domframework", "Database not connected"),
|
||||
500);
|
||||
switch (self::$instance[$this->dsn]->getAttribute(PDO::ATTR_DRIVER_NAME))
|
||||
{
|
||||
@@ -287,7 +287,7 @@ class dblayer
|
||||
$res[] = $d["tablename"];
|
||||
break;
|
||||
default:
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Unknown database driver in listTables"), 500);
|
||||
}
|
||||
return $res;
|
||||
@@ -313,14 +313,14 @@ class dblayer
|
||||
$data[$key] = null;
|
||||
if (in_array ("not null", $params) && !array_key_exists ($key, $data))
|
||||
{
|
||||
$errors[$key] = array ("error", sprintf (dgettext("domframework",
|
||||
$errors[$key] = array ("error", sprintf (dgettext ("domframework",
|
||||
"Mandatory field '%s' not provided"),
|
||||
$key));
|
||||
continue;
|
||||
}
|
||||
if (in_array ("not null", $params) && $data[$key] === "")
|
||||
{
|
||||
$errors[$key] = array ("error", sprintf (dgettext("domframework",
|
||||
$errors[$key] = array ("error", sprintf (dgettext ("domframework",
|
||||
"Mandatory field '%s' is empty"),
|
||||
$key));
|
||||
continue;
|
||||
@@ -336,7 +336,7 @@ class dblayer
|
||||
if (is_array ($verify) && count ($verify))
|
||||
{
|
||||
$errors[$key] = array ($verify[0], $verify[1]);
|
||||
//." ". dgettext("domframework","in")." ".$key);
|
||||
//." ". dgettext ("domframework","in")." ".$key);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ class dblayer
|
||||
elseif (! is_string ($data[$key]) && ! is_integer ($data[$key]))
|
||||
{
|
||||
$errors[$key] = array ("error", sprintf (
|
||||
dgettext("domframework",
|
||||
dgettext ("domframework",
|
||||
"Errors in consistency : '%s' is not an integer or a string [is %s]"),
|
||||
$key, gettype ($data[$key])));
|
||||
continue;
|
||||
@@ -359,7 +359,7 @@ class dblayer
|
||||
if (strspn ($data[$key], "0123456789") !== strlen ($data[$key]))
|
||||
{
|
||||
$errors[$key] = array ("error", sprintf (
|
||||
dgettext("domframework",
|
||||
dgettext ("domframework",
|
||||
"Errors in consistency : '%s' is not an integer"),
|
||||
$key));
|
||||
continue;
|
||||
@@ -370,7 +370,7 @@ class dblayer
|
||||
if (! isset ($params[1]))
|
||||
{
|
||||
$errors[$key] = array ("error", sprintf (
|
||||
dgettext("domframework",
|
||||
dgettext ("domframework",
|
||||
"The length of varchar field '%s' is not provided"),
|
||||
$key));
|
||||
continue;
|
||||
@@ -378,7 +378,7 @@ class dblayer
|
||||
if (mb_strlen ($data[$key]) > $params[1])
|
||||
{
|
||||
$errors[$key] = array ("error", sprintf (
|
||||
dgettext("domframework",
|
||||
dgettext ("domframework",
|
||||
"Errors in consistency : '%s' data is too long"),
|
||||
$key));
|
||||
continue;
|
||||
@@ -391,7 +391,7 @@ class dblayer
|
||||
if (!$d || $d->format("Y-m-d H:i:s") !== $data[$key])
|
||||
{
|
||||
$errors[$key] = array ("error", sprintf (
|
||||
dgettext("domframework",
|
||||
dgettext ("domframework",
|
||||
"Incorrect datetime provided for field '%s'"),
|
||||
$key));
|
||||
continue;
|
||||
@@ -404,7 +404,7 @@ class dblayer
|
||||
if (!$d || $d->format("Y-m-d") !== $data[$key])
|
||||
{
|
||||
$errors[$key] = array ("error", sprintf (
|
||||
dgettext("domframework",
|
||||
dgettext ("domframework",
|
||||
"Incorrect date provided for field '%s'"),
|
||||
$key));
|
||||
continue;
|
||||
@@ -412,7 +412,7 @@ class dblayer
|
||||
}
|
||||
elseif ($data[$key] !== "")
|
||||
{
|
||||
$errors[$key] = array ("error", sprintf (dgettext("domframework",
|
||||
$errors[$key] = array ("error", sprintf (dgettext ("domframework",
|
||||
"Unknown field type for '%s'"), $key));
|
||||
continue;
|
||||
}
|
||||
@@ -445,7 +445,7 @@ class dblayer
|
||||
// 1. Read the actual state
|
||||
$before = $this->read (array (array ($this->primary, $updatekey)));
|
||||
if (count ($before) === 0)
|
||||
return array ("error", dgettext("domframework",
|
||||
return array ("error", dgettext ("domframework",
|
||||
"Entry to modify unavailable"));
|
||||
$before = reset ($before);
|
||||
// 2. Map the proposal entries into the before state
|
||||
@@ -469,7 +469,7 @@ class dblayer
|
||||
{
|
||||
if ($this->primary === null)
|
||||
{
|
||||
return array (dgettext("domframework",
|
||||
return array (dgettext ("domframework",
|
||||
"No field primary defined for tests in primary"));
|
||||
}
|
||||
|
||||
@@ -491,7 +491,7 @@ class dblayer
|
||||
$rc = $this->read ($select, array ($this->primary));
|
||||
if (count ($rc) > 0)
|
||||
{
|
||||
$errors[] = array ("error", dgettext("domframework",
|
||||
$errors[] = array ("error", dgettext ("domframework",
|
||||
"An entry with these values already exists"));
|
||||
continue;
|
||||
}
|
||||
@@ -513,7 +513,7 @@ class dblayer
|
||||
array ($this->primary));
|
||||
if (count ($rc) > 0)
|
||||
{
|
||||
$errors[] = array ("error", dgettext("domframework",
|
||||
$errors[] = array ("error", dgettext ("domframework",
|
||||
"An entry with this value already exists"));
|
||||
continue;
|
||||
}
|
||||
@@ -530,14 +530,14 @@ class dblayer
|
||||
if ($this->debug) echo " verify foreign $foreign\n";
|
||||
if (! isset ($data[$foreign]))
|
||||
{
|
||||
$errors[] = array ("error", sprintf (dgettext("domframework",
|
||||
$errors[] = array ("error", sprintf (dgettext ("domframework",
|
||||
"The foreign column '%s' is not provided"),
|
||||
$foreign));
|
||||
return $errors;
|
||||
}
|
||||
if (! isset ($data[$foreign][0]))
|
||||
{
|
||||
$errors[] = array ("error", sprintf (dgettext("domframework",
|
||||
$errors[] = array ("error", sprintf (dgettext ("domframework",
|
||||
"The field type for column '%s' is not provided"),
|
||||
$foreign));
|
||||
return $errors;
|
||||
@@ -573,7 +573,7 @@ class dblayer
|
||||
$st->bindValue (":".md5 ($key), $val, PDO::PARAM_STR);
|
||||
else
|
||||
{
|
||||
throw new Exception ("TO BE DEVELOPPED : ".$this->fields[$foreign][0],
|
||||
throw new \Exception ("TO BE DEVELOPPED : ".$this->fields[$foreign][0],
|
||||
500);
|
||||
}
|
||||
$st->execute ();
|
||||
@@ -582,7 +582,7 @@ class dblayer
|
||||
$res[] = $d;
|
||||
if (count ($res) === 0)
|
||||
{
|
||||
$errors[] = array ("error", sprintf (dgettext("domframework",
|
||||
$errors[] = array ("error", sprintf (dgettext ("domframework",
|
||||
"The foreign key '%s' doesn't exists"),
|
||||
$column));
|
||||
continue;
|
||||
@@ -598,20 +598,20 @@ class dblayer
|
||||
{
|
||||
if ($this->debug) echo "== Entering insert\n";
|
||||
if ($this->sep === "")
|
||||
throw new Exception (dgettext("domframework", "Database not connected"),
|
||||
throw new \Exception (dgettext ("domframework", "Database not connected"),
|
||||
500);
|
||||
if ($this->table === null)
|
||||
throw new \Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"No table name defined to insert in the table"),
|
||||
500);
|
||||
if ($this->unique === null)
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Unique fields of table are not defined"), 500);
|
||||
if (! is_array ($this->unique))
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"The unique configuration is not an array"), 500);
|
||||
if (!is_array ($data))
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"The data provided to create are not array"),
|
||||
405);
|
||||
foreach ($this->fields as $key=>$params)
|
||||
@@ -628,7 +628,7 @@ class dblayer
|
||||
$errors = reset ($errors);
|
||||
if (! is_array ($errors))
|
||||
$errors = array (0=>"error", 1=>$errors);
|
||||
throw new Exception ($errors[1], 405);
|
||||
throw new \Exception ($errors[1], 405);
|
||||
}
|
||||
foreach ($this->fields as $field=>$desc)
|
||||
{
|
||||
@@ -663,14 +663,15 @@ class dblayer
|
||||
elseif ($this->fields[$key][0] === "date")
|
||||
$st->bindValue (":".md5 ($key), $val, PDO::PARAM_STR);
|
||||
else
|
||||
throw new Exception ("TO BE DEVELOPPED : ".$this->fields[$key][0], 500);
|
||||
throw new \Exception ("TO BE DEVELOPPED : ".$this->fields[$key][0],
|
||||
500);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$st->execute ();
|
||||
}
|
||||
catch (Exception $e)
|
||||
catch (\Exception $e)
|
||||
{
|
||||
echo "dblayer execute exception : ".$e->getMessage()."\n";
|
||||
exit;
|
||||
@@ -709,21 +710,21 @@ class dblayer
|
||||
{
|
||||
if ($this->debug) echo "== Entering read\n";
|
||||
if ($this->sep === "")
|
||||
throw new Exception (dgettext("domframework", "Database not connected"),
|
||||
throw new \Exception (dgettext ("domframework", "Database not connected"),
|
||||
500);
|
||||
if ($this->table === null)
|
||||
throw new \Exception (dgettext("domframework",
|
||||
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",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Select information provided is not an array"),
|
||||
405);
|
||||
if ($display !== null && !is_array ($display))
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Display information provided is not an array"),
|
||||
405);
|
||||
if ($order !== null && !is_array ($order))
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Order information provided is not an array"),
|
||||
405);
|
||||
if ($display !== null)
|
||||
@@ -731,7 +732,7 @@ class dblayer
|
||||
foreach ($display as $f)
|
||||
{
|
||||
if (!in_array ($f, array_keys ($this->fields)))
|
||||
throw new Exception (sprintf (dgettext("domframework",
|
||||
throw new \Exception (sprintf (dgettext ("domframework",
|
||||
"Field '%s' not allowed"), $f), 500);
|
||||
}
|
||||
}
|
||||
@@ -763,14 +764,14 @@ class dblayer
|
||||
foreach ($select as $n=>$s)
|
||||
{
|
||||
if (! is_array ($s))
|
||||
throw new Exception ("Select not an array for element $n", 500);
|
||||
throw new \Exception ("Select not an array for element $n", 500);
|
||||
// The foreign keys can not be in the select too (conflict)
|
||||
if (in_array ($s[0],$foreignSelectCols))
|
||||
continue;
|
||||
if (! array_key_exists (0, $s))
|
||||
throw new Exception ("Select field for key $n not provided", 406);
|
||||
throw new \Exception ("Select field for key $n not provided", 406);
|
||||
if (! array_key_exists (1, $s))
|
||||
throw new Exception ("Select value for key $n not provided", 406);
|
||||
throw new \Exception ("Select value for key $n not provided", 406);
|
||||
if ($n > 0)
|
||||
{
|
||||
if ($whereOr === false)
|
||||
@@ -781,7 +782,7 @@ class dblayer
|
||||
if (!isset ($s[2]))
|
||||
$s[2] = "=";
|
||||
if (!isset ($s[0]))
|
||||
throw new Exception (sprintf (dgettext("domframework",
|
||||
throw new \Exception (sprintf (dgettext ("domframework",
|
||||
"Select not found for id=%d"), $n), 500);
|
||||
// The double-quotes are added for sqlite to escape the column if its
|
||||
// name is 'group'
|
||||
@@ -803,9 +804,9 @@ class dblayer
|
||||
foreach ($foreignSelect as $n=>$s)
|
||||
{
|
||||
if (! array_key_exists (0, $s))
|
||||
throw new Exception ("Foreign field for key $n not provided", 406);
|
||||
throw new \Exception ("Foreign field for key $n not provided", 406);
|
||||
if (! array_key_exists (1, $s))
|
||||
throw new Exception ("Foreign value for key $n not provided", 406);
|
||||
throw new \Exception ("Foreign value for key $n not provided", 406);
|
||||
if ($n > 0)
|
||||
{
|
||||
$req .= " AND";
|
||||
@@ -837,11 +838,11 @@ class dblayer
|
||||
{
|
||||
$st = self::$instance[$this->dsn]->prepare ($req);
|
||||
}
|
||||
catch (Exception $e)
|
||||
catch (\Exception $e)
|
||||
{
|
||||
if ($this->debug) echo "DEBUG : PREPARE ERROR ! Return FALSE".
|
||||
$e->getMessage()."\n";
|
||||
throw new Exception ($e->getMessage(), 500);
|
||||
throw new \Exception ($e->getMessage(), 500);
|
||||
}
|
||||
|
||||
if ($select !== NULL)
|
||||
@@ -890,18 +891,19 @@ class dblayer
|
||||
{
|
||||
if ($this->debug) echo "== Entering update\n";
|
||||
if ($this->sep === "")
|
||||
throw new Exception (dgettext("domframework", "Database not connected"),
|
||||
throw new \Exception (dgettext ("domframework", "Database not connected"),
|
||||
500);
|
||||
if ($this->table === null)
|
||||
throw new \Exception (dgettext("domframework",
|
||||
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);
|
||||
throw new \Exception (dgettext ("domframework", "No Field defined"), 500);
|
||||
if ($this->primary === null)
|
||||
throw new Exception (dgettext("domframework", "No Primary defined"), 500);
|
||||
throw new \Exception (dgettext ("domframework", "No Primary defined"),
|
||||
500);
|
||||
if (count ($data) === 0)
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"No data to update provided"), 500);
|
||||
$dataOK = array ();
|
||||
$errors = $this->verify ($data, $updatekey);
|
||||
@@ -910,11 +912,11 @@ class dblayer
|
||||
if (is_array ($errors))
|
||||
{
|
||||
if (isset ($errors[0][1]))
|
||||
throw new Exception ($errors[0][1], 405);
|
||||
throw new \Exception ($errors[0][1], 405);
|
||||
$err = reset ($errors);
|
||||
throw new Exception ($err[1], 405);
|
||||
throw new \Exception ($err[1], 405);
|
||||
}
|
||||
throw new Exception ($errors[1], 405);
|
||||
throw new \Exception ($errors[1], 405);
|
||||
}
|
||||
foreach ($this->fields as $field=>$desc)
|
||||
{
|
||||
@@ -973,7 +975,7 @@ class dblayer
|
||||
else
|
||||
{
|
||||
if ($this->debug) echo "(UNKNOWN)\n";
|
||||
throw new Exception ("TO BE DEVELOPPED : ".$fields[$key][0], 500);
|
||||
throw new \Exception ("TO BE DEVELOPPED : ".$fields[$key][0], 500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -992,9 +994,10 @@ class dblayer
|
||||
{
|
||||
if ($this->debug) echo "== Entering delete\n";
|
||||
if ($this->sep === "")
|
||||
throw new Exception (dgettext("domframework", "Database not connected"));
|
||||
throw new \Exception (dgettext ("domframework", "Database not connected"),
|
||||
500);
|
||||
if ($this->table === null)
|
||||
throw new \Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"No table name defined to delete in the table"),
|
||||
500);
|
||||
$deletekey = call_user_func ($this->hookpredeleteFunc, $deletekey);
|
||||
@@ -1009,7 +1012,7 @@ class dblayer
|
||||
{
|
||||
$st->execute ();
|
||||
}
|
||||
catch (Exception $e)
|
||||
catch (\Exception $e)
|
||||
{
|
||||
throw new \Exception ($e->getMessage (), 500);
|
||||
}
|
||||
@@ -1025,7 +1028,7 @@ class dblayer
|
||||
{
|
||||
if ($this->debug) echo "== Entering titles\n";
|
||||
if (count ($this->fields) === 0)
|
||||
throw new Exception (dgettext("domframework", "No Field defined"), 500);
|
||||
throw new \Exception (dgettext ("domframework", "No Field defined"), 500);
|
||||
$arr = array ();
|
||||
if (count ($this->titles) !== 0)
|
||||
{
|
||||
@@ -1046,9 +1049,10 @@ class dblayer
|
||||
{
|
||||
if ($this->debug) echo "== Entering dropTables\n";
|
||||
if ($this->sep === "")
|
||||
throw new Exception (dgettext("domframework", "Database not connected"));
|
||||
throw new \Exception (dgettext ("domframework", "Database not connected"),
|
||||
500);
|
||||
if ($this->table === null)
|
||||
throw new \Exception (dgettext("domframework",
|
||||
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)
|
||||
@@ -1076,12 +1080,12 @@ class dblayer
|
||||
{
|
||||
if ($this->debug) echo "== Entering createTable\n";
|
||||
if ($this->sep === "")
|
||||
throw new Exception (dgettext("domframework", "Database not connected"),
|
||||
throw new \Exception (dgettext ("domframework", "Database not connected"),
|
||||
500);
|
||||
if (count ($this->fields) === 0)
|
||||
throw new Exception (dgettext("domframework", "No Field defined"), 500);
|
||||
throw new \Exception (dgettext ("domframework", "No Field defined"), 500);
|
||||
if ($this->table === null)
|
||||
throw new \Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"No table name defined to create the table"), 500);
|
||||
switch (self::$instance[$this->dsn]->getAttribute(PDO::ATTR_DRIVER_NAME))
|
||||
{
|
||||
@@ -1098,8 +1102,8 @@ class dblayer
|
||||
$sql .= "$this->sep$field$this->sep ";
|
||||
// Type of field : in $params[0]
|
||||
if (!isset ($params[0]))
|
||||
throw new Exception (sprintf (
|
||||
dgettext("domframework",
|
||||
throw new \Exception (sprintf (
|
||||
dgettext ("domframework",
|
||||
"No database type defined for field '%s'"),
|
||||
$field), 500);
|
||||
|
||||
@@ -1111,7 +1115,7 @@ class dblayer
|
||||
break;
|
||||
case "varchar":
|
||||
if (!isset ($params[1]))
|
||||
throw new Exception (sprintf (dgettext("domframework",
|
||||
throw new \Exception (sprintf (dgettext ("domframework",
|
||||
"No Size provided for varchar field '%s'"),
|
||||
$field), 500);
|
||||
$sql .= "VARCHAR(".$params[1].")";
|
||||
@@ -1126,8 +1130,8 @@ class dblayer
|
||||
$params = array_slice ($params, 1);
|
||||
break;
|
||||
default:
|
||||
throw new Exception (sprintf (
|
||||
dgettext("domframework",
|
||||
throw new \Exception (sprintf (
|
||||
dgettext ("domframework",
|
||||
"Unknown type '%s' provided for field '%s'"),
|
||||
$params[0], $field), 500);
|
||||
}
|
||||
@@ -1145,7 +1149,7 @@ class dblayer
|
||||
case "not null": $sql .= " NOT NULL"; break;
|
||||
case "autoincrement": $sql .= " AUTOINCREMENT";break;
|
||||
default:
|
||||
throw new Exception (sprintf (dgettext("domframework",
|
||||
throw new \Exception (sprintf (dgettext ("domframework",
|
||||
"Unknown additionnal parameter for field '%s'"),
|
||||
$field), 500);
|
||||
}
|
||||
@@ -1156,7 +1160,7 @@ class dblayer
|
||||
if ($this->unique !== null)
|
||||
{
|
||||
if (!is_array ($this->unique))
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"The Unique field definition is not an array"),
|
||||
500);
|
||||
foreach ($this->unique as $u)
|
||||
@@ -1195,7 +1199,7 @@ class dblayer
|
||||
$sql .= "$this->sep$field$this->sep ";
|
||||
// Type of field : in $params[0]
|
||||
if (!isset ($params[0]))
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"No database type defined for field"), 500);
|
||||
switch ($params[0])
|
||||
{
|
||||
@@ -1205,7 +1209,7 @@ class dblayer
|
||||
break;
|
||||
case "varchar":
|
||||
if (!isset ($params[1]))
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"No Size provided for varchar field"), 500);
|
||||
$sql .= "VARCHAR(".$params[1].")";
|
||||
$params = array_slice ($params, 2);
|
||||
@@ -1219,8 +1223,8 @@ class dblayer
|
||||
$params = array_slice ($params, 1);
|
||||
break;
|
||||
default:
|
||||
throw new Exception (sprintf (
|
||||
dgettext("domframework",
|
||||
throw new \Exception (sprintf (
|
||||
dgettext ("domframework",
|
||||
"Unknown type provided for field '%s'"),
|
||||
$field), 500);
|
||||
}
|
||||
@@ -1238,8 +1242,8 @@ class dblayer
|
||||
case "not null": $sql .= " NOT NULL"; break;
|
||||
case "autoincrement": $sql .= " AUTO_INCREMENT";break;
|
||||
default:
|
||||
throw new Exception (sprintf (
|
||||
dgettext("domframework",
|
||||
throw new \Exception (sprintf (
|
||||
dgettext ("domframework",
|
||||
"Unknown additionnal parameter for field '%s'"),
|
||||
$field), 500);
|
||||
}
|
||||
@@ -1290,8 +1294,8 @@ class dblayer
|
||||
{
|
||||
// Type of field : in $params[0]
|
||||
if (!isset ($params[0]))
|
||||
throw new Exception (sprintf (
|
||||
dgettext("domframework",
|
||||
throw new \Exception (sprintf (
|
||||
dgettext ("domframework",
|
||||
"No database type defined for field '%s'"),
|
||||
$field), 500);
|
||||
switch ($params[0])
|
||||
@@ -1302,8 +1306,8 @@ class dblayer
|
||||
break;
|
||||
case "varchar":
|
||||
if (!isset ($params[1]))
|
||||
throw new Exception (sprintf (
|
||||
dgettext("domframework",
|
||||
throw new \Exception (sprintf (
|
||||
dgettext ("domframework",
|
||||
"No Size provided for varchar field '%s'"),
|
||||
$field), 500);
|
||||
$sql .= "VARCHAR(".$params[1].")";
|
||||
@@ -1318,8 +1322,8 @@ class dblayer
|
||||
$params = array_slice ($params, 1);
|
||||
break;
|
||||
default:
|
||||
throw new Exception (sprintf (
|
||||
dgettext("domframework",
|
||||
throw new \Exception (sprintf (
|
||||
dgettext ("domframework",
|
||||
"Unknown type provided for field '%s'"),
|
||||
$field), 500);
|
||||
}
|
||||
@@ -1336,8 +1340,8 @@ class dblayer
|
||||
{
|
||||
case "not null": $sql .= " NOT NULL"; break;
|
||||
default:
|
||||
throw new Exception (sprintf (
|
||||
dgettext("domframework",
|
||||
throw new \Exception (sprintf (
|
||||
dgettext ("domframework",
|
||||
"Unknown additionnal parameter for field '%s'"),
|
||||
$field), 500);
|
||||
}
|
||||
@@ -1373,7 +1377,7 @@ class dblayer
|
||||
$sql .=")";
|
||||
break;
|
||||
default:
|
||||
throw new Exception (dgettext("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"PDO Engine not supported in dbLayer"), 500);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user