From affa15e3650d9f924eaf055cfb6bc14e4a7232f6 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Tue, 17 Sep 2019 08:15:11 +0000 Subject: [PATCH] dblayeroo : debugLog is now with priority parameter git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5485 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- dblayeroo.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/dblayeroo.php b/dblayeroo.php index f7a3772..2d719de 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -117,7 +117,7 @@ class dblayeroo // var_dump (self::$instance); if (! array_key_exists ($this->dsn, self::$instance)) { - $this->debugLog ("CONNECT TO SQLite DATABASE"); + $this->debugLog ("CONNECT TO SQLite DATABASE", 2); try { self::$instance[$this->dsn] = new \PDO ($dsn, $username, $password, @@ -139,7 +139,7 @@ class dblayeroo case "mysql": if (! array_key_exists ($this->dsn, self::$instance)) { - $this->debugLog ("CONNECT TO MySQL DATABASE"); + $this->debugLog ("CONNECT TO MySQL DATABASE", 2); try { $driver_options[\PDO::MYSQL_ATTR_FOUND_ROWS] = 1; @@ -173,7 +173,7 @@ class dblayeroo case "pgsql": if (! array_key_exists ($this->dsn, self::$instance)) { - $this->debugLog ("CONNECT TO PGSQL DATABASE"); + $this->debugLog ("CONNECT TO PGSQL DATABASE", 2); try { 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 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)) // 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 @@ -2943,7 +2943,7 @@ class dblayeroo // - Check the unique entries (if defined) // 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; if (! is_array ($uniques)) $uniques = array (); @@ -2970,7 +2970,7 @@ class dblayeroo // 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 // 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->debugDepth++; $objTmp->clearRequest (); @@ -2999,7 +2999,7 @@ class dblayeroo if (! array_key_exists ($this->primary, $setValues)) $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->debugDepth++; $objTmp->clearRequest (); @@ -3009,7 +3009,7 @@ class dblayeroo { // Multiple columns in unique $objTmp->debugLog (" verify the unique multiple [", - implode (",", $columns),"]"); + implode (",", $columns),"]", 2); foreach ($columns as $column) { if (! array_key_exists ($column, $setValues)) @@ -3032,7 +3032,7 @@ class dblayeroo else { // 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)) $errors[$columns] = sprintf (dgettext ("domframework", "No column '%s' defined but must be unique !"), $columns); @@ -3093,7 +3093,7 @@ class dblayeroo ! in_array ("not null", $this->fields[$field])) $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->debug = $this->debug; $objTmp->debugDepth++; @@ -3143,10 +3143,11 @@ class dblayeroo $errors = array_merge ($this->verify ($values, $update), $this->checkRealTypes ($values, $update)); if (count ($errors) === 0) - $this->debugLog ("End of checkValues (",$update,") : Nothing in error"); + $this->debugLog ("End of checkValues (",$update,") : Nothing in error", + 2); else $this->debugLog ("End of checkValues (",$update,") : ".count ($errors). - "errors"); + "errors", 2); return $errors; } /* }}} */ @@ -3203,7 +3204,7 @@ class dblayeroo } } $this->debugLog ("End checkRealTypes (", $values, ",", $allowEmpty, ") : ", - $errors); + $errors, 2); return $errors; } // }}}