dblayeroo : debugLog is now with priority parameter
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5485 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -117,7 +117,7 @@ class dblayeroo
|
|||||||
// var_dump (self::$instance);
|
// var_dump (self::$instance);
|
||||||
if (! array_key_exists ($this->dsn, self::$instance))
|
if (! array_key_exists ($this->dsn, self::$instance))
|
||||||
{
|
{
|
||||||
$this->debugLog ("CONNECT TO SQLite DATABASE");
|
$this->debugLog ("CONNECT TO SQLite DATABASE", 2);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
self::$instance[$this->dsn] = new \PDO ($dsn, $username, $password,
|
self::$instance[$this->dsn] = new \PDO ($dsn, $username, $password,
|
||||||
@@ -139,7 +139,7 @@ class dblayeroo
|
|||||||
case "mysql":
|
case "mysql":
|
||||||
if (! array_key_exists ($this->dsn, self::$instance))
|
if (! array_key_exists ($this->dsn, self::$instance))
|
||||||
{
|
{
|
||||||
$this->debugLog ("CONNECT TO MySQL DATABASE");
|
$this->debugLog ("CONNECT TO MySQL DATABASE", 2);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$driver_options[\PDO::MYSQL_ATTR_FOUND_ROWS] = 1;
|
$driver_options[\PDO::MYSQL_ATTR_FOUND_ROWS] = 1;
|
||||||
@@ -173,7 +173,7 @@ class dblayeroo
|
|||||||
case "pgsql":
|
case "pgsql":
|
||||||
if (! array_key_exists ($this->dsn, self::$instance))
|
if (! array_key_exists ($this->dsn, self::$instance))
|
||||||
{
|
{
|
||||||
$this->debugLog ("CONNECT TO PGSQL DATABASE");
|
$this->debugLog ("CONNECT TO PGSQL DATABASE", 2);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
self::$instance[$this->dsn] = new \PDO ($dsn, $username, $password,
|
self::$instance[$this->dsn] = new \PDO ($dsn, $username, $password,
|
||||||
@@ -2863,7 +2863,7 @@ class dblayeroo
|
|||||||
// by the application, so just throw an Exception if the error is raised
|
// by the application, so just throw an Exception if the error is raised
|
||||||
foreach ($this->fields as $field=>$params)
|
foreach ($this->fields as $field=>$params)
|
||||||
{
|
{
|
||||||
$this->debugLog (" verify the field validity [$field]");
|
$this->debugLog (" verify the field validity [$field]", 2);
|
||||||
if ($update !== false && ! array_key_exists ($field, $values))
|
if ($update !== false && ! array_key_exists ($field, $values))
|
||||||
// In case of UPDATE, the values are already stored. We can skip the
|
// In case of UPDATE, the values are already stored. We can skip the
|
||||||
// test if the user don't want to modify a field (and do not provide the
|
// test if the user don't want to modify a field (and do not provide the
|
||||||
@@ -2943,7 +2943,7 @@ class dblayeroo
|
|||||||
|
|
||||||
// - Check the unique entries (if defined)
|
// - Check the unique entries (if defined)
|
||||||
// The primary key is always unique : add it if not set by the user
|
// The primary key is always unique : add it if not set by the user
|
||||||
$this->debugLog (" verify the unique constraint");
|
$this->debugLog (" verify the unique constraint", 2);
|
||||||
$uniques = $this->unique;
|
$uniques = $this->unique;
|
||||||
if (! is_array ($uniques))
|
if (! is_array ($uniques))
|
||||||
$uniques = array ();
|
$uniques = array ();
|
||||||
@@ -2970,7 +2970,7 @@ class dblayeroo
|
|||||||
// One column to set is a unique column : check if the where clause
|
// One column to set is a unique column : check if the where clause
|
||||||
// is filtering more than one entry. If there is more than one
|
// is filtering more than one entry. If there is more than one
|
||||||
// entry, generate an exception
|
// entry, generate an exception
|
||||||
$this->debugLog ("CLONE because of checking update unique fields");
|
$this->debugLog ("CLONE because of checking update unique fields", 2);
|
||||||
$objTmp = clone $this;
|
$objTmp = clone $this;
|
||||||
$objTmp->debugDepth++;
|
$objTmp->debugDepth++;
|
||||||
$objTmp->clearRequest ();
|
$objTmp->clearRequest ();
|
||||||
@@ -2999,7 +2999,7 @@ class dblayeroo
|
|||||||
if (! array_key_exists ($this->primary, $setValues))
|
if (! array_key_exists ($this->primary, $setValues))
|
||||||
$setValues[$this->primary] = null;
|
$setValues[$this->primary] = null;
|
||||||
|
|
||||||
$this->debugLog ("CLONE to check primary and unique constraint");
|
$this->debugLog ("CLONE to check primary and unique constraint", 2);
|
||||||
$objTmp = clone $this;
|
$objTmp = clone $this;
|
||||||
$objTmp->debugDepth++;
|
$objTmp->debugDepth++;
|
||||||
$objTmp->clearRequest ();
|
$objTmp->clearRequest ();
|
||||||
@@ -3009,7 +3009,7 @@ class dblayeroo
|
|||||||
{
|
{
|
||||||
// Multiple columns in unique
|
// Multiple columns in unique
|
||||||
$objTmp->debugLog (" verify the unique multiple [",
|
$objTmp->debugLog (" verify the unique multiple [",
|
||||||
implode (",", $columns),"]");
|
implode (",", $columns),"]", 2);
|
||||||
foreach ($columns as $column)
|
foreach ($columns as $column)
|
||||||
{
|
{
|
||||||
if (! array_key_exists ($column, $setValues))
|
if (! array_key_exists ($column, $setValues))
|
||||||
@@ -3032,7 +3032,7 @@ class dblayeroo
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// One column in unique
|
// One column in unique
|
||||||
$objTmp->debugLog (" verify the unique one column [$columns]");
|
$objTmp->debugLog (" verify the unique one column [$columns]", 2);
|
||||||
if (! array_key_exists ($columns, $setValues))
|
if (! array_key_exists ($columns, $setValues))
|
||||||
$errors[$columns] = sprintf (dgettext ("domframework",
|
$errors[$columns] = sprintf (dgettext ("domframework",
|
||||||
"No column '%s' defined but must be unique !"), $columns);
|
"No column '%s' defined but must be unique !"), $columns);
|
||||||
@@ -3093,7 +3093,7 @@ class dblayeroo
|
|||||||
! in_array ("not null", $this->fields[$field]))
|
! in_array ("not null", $this->fields[$field]))
|
||||||
$values[$field] = null;
|
$values[$field] = null;
|
||||||
}
|
}
|
||||||
$this->debugLog ("CLONE to check foreign constraint [$fields]");
|
$this->debugLog ("CLONE to check foreign constraint [$fields]", 2);
|
||||||
$objTmp = clone $this->setForeignObj[$params[0]];
|
$objTmp = clone $this->setForeignObj[$params[0]];
|
||||||
$objTmp->debug = $this->debug;
|
$objTmp->debug = $this->debug;
|
||||||
$objTmp->debugDepth++;
|
$objTmp->debugDepth++;
|
||||||
@@ -3143,10 +3143,11 @@ class dblayeroo
|
|||||||
$errors = array_merge ($this->verify ($values, $update),
|
$errors = array_merge ($this->verify ($values, $update),
|
||||||
$this->checkRealTypes ($values, $update));
|
$this->checkRealTypes ($values, $update));
|
||||||
if (count ($errors) === 0)
|
if (count ($errors) === 0)
|
||||||
$this->debugLog ("End of checkValues (",$update,") : Nothing in error");
|
$this->debugLog ("End of checkValues (",$update,") : Nothing in error",
|
||||||
|
2);
|
||||||
else
|
else
|
||||||
$this->debugLog ("End of checkValues (",$update,") : ".count ($errors).
|
$this->debugLog ("End of checkValues (",$update,") : ".count ($errors).
|
||||||
"errors");
|
"errors", 2);
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
@@ -3203,7 +3204,7 @@ class dblayeroo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->debugLog ("End checkRealTypes (", $values, ",", $allowEmpty, ") : ",
|
$this->debugLog ("End checkRealTypes (", $values, ",", $allowEmpty, ") : ",
|
||||||
$errors);
|
$errors, 2);
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|||||||
Reference in New Issue
Block a user