dblayeroo : Add BLOB support

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5430 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2019-08-23 10:11:32 +00:00
parent c280b01ba9
commit 842a96130c

View File

@@ -358,6 +358,10 @@ class dblayeroo
$sql .= "$this->sep$field$this->sep ";
switch ($this->fieldTypeLight ($field))
{
case "blob":
$sql .= "BLOB";
$params = array_slice ($params, 1);
break;
case "datetime":
$sql .= "DATETIME";
$params = array_slice ($params, 1);
@@ -460,6 +464,10 @@ class dblayeroo
$sql .= "$this->sep$field$this->sep ";
switch ($this->fieldTypeLight ($field))
{
case "blob":
$sql .= "BLOB";
$params = array_slice ($params, 1);
break;
case "integer":
$sql .= "INTEGER";
$params = array_slice ($params, 1);
@@ -569,6 +577,10 @@ class dblayeroo
{
switch ($this->fieldTypeLight ($field))
{
case "blob":
$sql .= "BLOB";
$params = array_slice ($params, 1);
break;
case "integer":
$sql .= "INTEGER";
$params = array_slice ($params, 1);
@@ -1159,7 +1171,7 @@ class dblayeroo
if (! array_key_exists (0, $params))
$this->DBException ("Parameter fields invalid: ".
"No type of column provided for '$field'");
if (preg_match ("#^(date|datetime|float|integer|time|".
if (preg_match ("#^(blob|date|datetime|float|integer|time|".
"varchar\(\d+\))$#i",
$params[0]) !== 1)
$this->DBException ("Parameter fields invalid: ".
@@ -2689,6 +2701,7 @@ class dblayeroo
$type = $val["type"];
$text .= "DEBUG BIND WHERE : $hash ($field)->$value ";
if ($value === null) $text .= "NULL (null)\n";
elseif ($type === "blob") $text .= "(blob)\n";
elseif ($type === "integer") $text .= "(integer)\n";
elseif ($type === "float") $text .= "(float)\n";
elseif ($type === "varchar") $text .= "(varchar)\n";
@@ -2703,6 +2716,8 @@ class dblayeroo
{
if ($value === null)
$st->bindValue (":$hash", $value, \PDO::PARAM_NULL);
elseif ($type === "blob")
$st->bindValue (":$hash", $value, \PDO::PARAM_STR);
elseif ($type === "integer")
$st->bindValue (":$hash", $value, \PDO::PARAM_INT);
elseif ($type === "float")
@@ -2727,6 +2742,7 @@ class dblayeroo
$type = $this->setType[$hash];
$text .= "DEBUG BIND SET : $hash ($field)->$value ";
if ($value === null) $text .= "NULL (null)\n";
elseif ($type === "blob") $text .= "(blob)\n";
elseif ($type === "integer") $text .= "(integer)\n";
elseif ($type === "float") $text .= "(float)\n";
elseif ($type === "varchar") $text .= "(varchar)\n";
@@ -2741,6 +2757,8 @@ class dblayeroo
{
if ($value === null)
$st->bindValue (":$hash", $value, \PDO::PARAM_NULL);
elseif ($this->setType[$hash] === "blob")
$st->bindValue (":$hash", "$value", \PDO::PARAM_STR);
elseif ($this->setType[$hash] === "integer")
$st->bindValue (":$hash", $value, \PDO::PARAM_INT);
elseif ($this->setType[$hash] === "float")
@@ -2880,6 +2898,9 @@ class dblayeroo
continue;
switch ($this->fieldTypeLight ($field))
{
case "blob":
// Blob can be anything. Do not test
break;
case "integer":
if (strspn ($values[$field], "0123456789") !== strlen ($values[$field]))
$errors[$field] = dgettext ("domframework",