]> git.mjollnir.org Git - moodle.git/commitdiff
Now, on error, the new XMLDB->debug($msg) function is called.
authorstronk7 <stronk7>
Sat, 28 Oct 2006 15:18:40 +0000 (15:18 +0000)
committerstronk7 <stronk7>
Sat, 28 Oct 2006 15:18:40 +0000 (15:18 +0000)
It provides the facility to hook to one external function, if
available: xmldb_debug($message, $xmldb_object) to perform
custom debugging/logging. MDL-7261

lib/xmldb/classes/XMLDBField.class.php
lib/xmldb/classes/XMLDBIndex.class.php
lib/xmldb/classes/XMLDBKey.class.php
lib/xmldb/classes/XMLDBObject.class.php
lib/xmldb/classes/XMLDBStatement.class.php
lib/xmldb/classes/XMLDBStructure.class.php
lib/xmldb/classes/XMLDBTable.class.php

index 9c19d76d351bf1608da31743307a880c25cb2bf3..1d77b12dfe42ffd47d964f62ab7d2d9aba9eed51 100644 (file)
@@ -252,7 +252,7 @@ class XMLDBField extends XMLDBObject {
             $this->name = trim($xmlarr['@']['NAME']);
         } else {
             $this->errormsg = 'Missing NAME attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
 
@@ -263,12 +263,12 @@ class XMLDBField extends XMLDBObject {
                 $this->type = $type;
             } else {
                 $this->errormsg = 'Invalid TYPE attribute';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         } else {
             $this->errormsg = 'Missing TYPE attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
 
@@ -280,11 +280,11 @@ class XMLDBField extends XMLDBObject {
                 $this->type == XMLDB_TYPE_CHAR) {
                 if (!(is_numeric($length)&&(intval($length)==floatval($length)))) {
                     $this->errormsg = 'Incorrect LENGTH attribute for int, number or char fields';
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 } else if (!$length) {
                     $this->errormsg = 'Zero LENGTH attribute';
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 }
             }
@@ -298,7 +298,7 @@ class XMLDBField extends XMLDBObject {
                     $length != 'medium' &&
                     $length != 'small') {
                     $this->errormsg = 'Incorrect LENGTH attribute for text and binary fields (only big, medium and small allowed)';
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 }
             }
@@ -314,7 +314,7 @@ class XMLDBField extends XMLDBObject {
                 $this->unsigned = false;
             } else {
                 $this->errormsg = 'Incorrect UNSIGNED attribute (true/false allowed)';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         }
@@ -327,7 +327,7 @@ class XMLDBField extends XMLDBObject {
                 $this->notnull = false;
             } else {
                 $this->errormsg = 'Incorrect NOTNULL attribute (true/false allowed)';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         }
@@ -340,7 +340,7 @@ class XMLDBField extends XMLDBObject {
                 $this->sequence = false;
             } else {
                 $this->errormsg = 'Incorrect SEQUENCE attribute (true/false allowed)';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         }
@@ -357,7 +357,7 @@ class XMLDBField extends XMLDBObject {
                 $this->enum = false;
             } else {
                 $this->errormsg = 'Incorrect ENUM attribute (true/false allowed)';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         }
@@ -366,7 +366,7 @@ class XMLDBField extends XMLDBObject {
             $enumvalues = strtolower(trim($xmlarr['@']['ENUMVALUES']));
             if (!$this->enum) {
                 $this->errormsg = 'Wrong ENUMVALUES attribute (not ENUM)';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
                 $this->enumvalues = $enumvalues;
             } else {
@@ -385,19 +385,19 @@ class XMLDBField extends XMLDBObject {
                         if (substr($enumelement, 0, 1) != "'" ||
                             substr($enumelement, -1, 1) != "'") {
                             $this->errormsg = 'Incorrect ENUMVALUES attribute (some value is not properly quoted)';
-                            xmldb_dbg($this->errormsg);
+                            $this->debug($this->errormsg);
                             $result = false;
                         }
                     }
                 } else {
                     $this->errormsg = 'Incorrect ENUMVALUES attribute (comma separated of quoted values)';
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 }
             }
         } else if ($this->enum) {
             $this->errormsg = 'Incorrect ENUMVALUES attribute (field is not declared as ENUM)';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
     /// Finally, set the value
@@ -413,16 +413,16 @@ class XMLDBField extends XMLDBObject {
                 $this->type == XMLDB_TYPE_FLOAT) {
                 if (!(is_numeric($decimals)&&(intval($decimals)==floatval($decimals)))) {
                     $this->errormsg = 'Incorrect DECIMALS attribute for number field';
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 } else if ($this->length <= $decimals){
                     $this->errormsg = 'Incorrect DECIMALS attribute (bigget than length)';
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 }
             } else {
                 $this->errormsg = 'Incorrect DECIMALS attribute for non-number field';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         } else {
index 680830c937119a757ad1c5267320d8a83fbc9719..8ae4d692f8da346860931b8a00c1b9da1d4f8461 100644 (file)
@@ -96,7 +96,7 @@ class XMLDBIndex extends XMLDBObject {
             $this->name = trim($xmlarr['@']['NAME']);
         } else {
             $this->errormsg = 'Missing NAME attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
 
@@ -108,12 +108,12 @@ class XMLDBIndex extends XMLDBObject {
                 $this->unique = false;
             } else {
                 $this->errormsg = 'Incorrect UNIQUE attribute (true/false allowed)';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         } else {
                 $this->errormsg = 'Undefined UNIQUE attribute';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
         }
 
@@ -127,17 +127,17 @@ class XMLDBIndex extends XMLDBObject {
                     }
                 } else {
                     $this->errormsg = 'Incorrect FIELDS attribute (comma separated of fields)';
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 }
             } else {
                 $this->errormsg = 'Empty FIELDS attribute';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         } else {
             $this->errormsg = 'Missing FIELDS attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
     /// Finally, set the array of fields
index be6d8b6b0a0382cdb13f0446777ebaca14dce78f..9d6ec5636eca674f791fda2ce984a140a19cb595 100644 (file)
@@ -133,7 +133,7 @@ class XMLDBKey extends XMLDBObject {
             $this->name = trim($xmlarr['@']['NAME']);
         } else {
             $this->errormsg = 'Missing NAME attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
 
@@ -144,12 +144,12 @@ class XMLDBKey extends XMLDBObject {
                 $this->type = $type;
             } else {
                 $this->errormsg = 'Invalid TYPE attribute';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         } else {
             $this->errormsg = 'Missing TYPE attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
 
@@ -163,17 +163,17 @@ class XMLDBKey extends XMLDBObject {
                     }
                 } else {
                     $this->errormsg = 'Incorrect FIELDS attribute (comma separated of fields)';
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 }
             } else {
                 $this->errormsg = 'Empty FIELDS attribute';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         } else {
             $this->errormsg = 'Missing FIELDS attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
     /// Finally, set the array of fields
@@ -186,18 +186,18 @@ class XMLDBKey extends XMLDBObject {
                 $reftable = strtolower(trim($xmlarr['@']['REFTABLE']));
                 if (!$reftable) {
                     $this->errormsg = 'Empty REFTABLE attribute';
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 }
             } else {
                 $this->errormsg = 'Wrong REFTABLE attribute (only FK can have it)';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         } else if ($this->type == XMLDB_KEY_FOREIGN ||
                    $this->type == XMLDB_KEY_FOREIGN_UNIQUE) {
             $this->errormsg = 'Missing REFTABLE attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
     /// Finally, set the reftable
@@ -219,23 +219,23 @@ class XMLDBKey extends XMLDBObject {
                         }
                     } else {
                         $this->errormsg = 'Incorrect REFFIELDS attribute (comma separated of fields)';
-                        xmldb_dbg($this->errormsg);
+                        $this->debug($this->errormsg);
                         $result = false;
                     }
                 } else {
                     $this->errormsg = 'Empty REFFIELDS attribute';
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 }
             } else {
                 $this->errormsg = 'Wrong REFFIELDS attribute (only FK can have it)';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         } else if ($this->type == XMLDB_KEY_FOREIGN ||
                    $this->type == XMLDB_KEY_FOREIGN_UNIQUE) {
             $this->errormsg = 'Missing REFFIELDS attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
     /// Finally, set the array of reffields
index 41c3cab554097dd86673ed55a3471f0b065be3ba..a365f863bcc4a7bea715b1d5e4796c7263760c7a 100644 (file)
@@ -331,6 +331,27 @@ class XMLDBObject {
         return get_class($this);
     }
 
+    /**
+     * This function will perform the central debug of all the XMLDB classes
+     * being called automatically every time one error is found. Apart from 
+     * the main actions performed in it (XMLDB agnostic) it looks for one
+     * function called xmldb_debug() and invokes it, passing both the
+     * message code and the whole object. 
+     * So, to perform custom debugging just add such function to your libs.
+     * 
+     * Call to the external hook function can be disabled by request by
+     * defining XMLDB_SKIP_DEBUG_HOOK
+     */
+    function debug($message) {
+
+    /// Check for xmldb_debug($message, $xmldb_object)
+        $funcname = 'xmldb_debug';
+    /// If exists and XMLDB_SKIP_DEBUG_HOOK is undefined
+        if (function_exists($funcname) && !defined('XMLDB_SKIP_DEBUG_HOOK')) {
+            $funcname($message, $this);
+        }
+    }
+
     /**
      * Returns one array of elements from one comma separated string,
      * supporting quoted strings containing commas and concat function calls
index b761b47b344ecf71d9c7d7bf9dafa014265a1cf4..47e933cd369b8d0ad60a2deb98d34810559589f8 100644 (file)
@@ -103,7 +103,7 @@ class XMLDBStatement extends XMLDBObject {
             $this->table = strtolower(trim($xmlarr['@']['TABLE']));
         } else {
             $this->errormsg = 'Missing TABLE attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
 
@@ -114,12 +114,12 @@ class XMLDBStatement extends XMLDBObject {
                 $this->type = $type;
             } else {
                 $this->errormsg = 'Invalid TYPE attribute';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         } else {
             $this->errormsg = 'Missing TYPE attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
 
@@ -134,7 +134,7 @@ class XMLDBStatement extends XMLDBObject {
                         $sentencesarr[] = trim($sentence['@']['TEXT']);
                     } else {
                         $this->errormsg = 'Missing TEXT attribute in sentence';
-                        xmldb_dbg($this->errormsg);
+                        $this->debug($this->errormsg);
                         $result = false;
                     }
                 }
@@ -155,22 +155,22 @@ class XMLDBStatement extends XMLDBObject {
                 /// Check that we aren't inserting the id field
                     if (in_array('id', $fields)) {
                         $this->errormsg = 'Cannot insert the "id" field. It is an autonumeric column';
-                        xmldb_dbg($this->errormsg);
+                        $this->debug($this->errormsg);
                         $result = false;
                     }
                     if ($result && count($fields) == 0) {
                         $this->errormsg = 'Missing fields in sentence "' . $sentence . '"';
-                        xmldb_dbg($this->errormsg);
+                        $this->debug($this->errormsg);
                         $result = false;
                     }
                     if ($result && count($values) == 0) {
                         $this->errormsg = 'Missing values in sentence "' . $sentence . '"';
-                        xmldb_dbg($this->errormsg);
+                        $this->debug($this->errormsg);
                         $result = false;
                     }
                     if ($result && count($fields) != count($values)) {
                         $this->errormsg = 'Incorrect number of fields (' .implode(', ', $fields) . ') or values (' . implode(', ', $values) . ')';
-                        xmldb_dbg($this->errormsg);
+                        $this->debug($this->errormsg);
                         $result = false;
                     }
                 }
@@ -178,7 +178,7 @@ class XMLDBStatement extends XMLDBObject {
         } else {
         /// Sentences different from INSERT are not valid for now
             $this->errormsg = 'Only INSERT statements are supported';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
 
index 57dc4b46cbbef0efade397a750867121f1882996..3d051a5e858b1d422463f485c9d0b00f3dbe8845 100644 (file)
@@ -342,21 +342,21 @@ class XMLDBStructure extends XMLDBObject {
             $this->path = trim($xmlarr['XMLDB']['@']['PATH']);
         } else {
             $this->errormsg = 'Missing PATH attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
         if (isset($xmlarr['XMLDB']['@']['VERSION'])) {
             $this->version = trim($xmlarr['XMLDB']['@']['VERSION']);
         } else {
             $this->errormsg = 'Missing VERSION attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
         if (isset($xmlarr['XMLDB']['@']['COMMENT'])) {
             $this->comment = trim($xmlarr['XMLDB']['@']['COMMENT']);
         } else {
             $this->errormsg = 'Missing COMMENT attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
 
@@ -372,13 +372,13 @@ class XMLDBStructure extends XMLDBObject {
                 $this->tables[] = $table;
                 if (!$table->isLoaded()) {
                     $this->errormsg = 'Problem loading table ' . $name;
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 }
             }
         } else {
             $this->errormsg = 'Missing TABLES section';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
 
@@ -387,19 +387,19 @@ class XMLDBStructure extends XMLDBObject {
         /// Check tables names are ok (lowercase, a-z _-)
             if (!$this->checkNameValues($this->tables)) {
                 $this->errormsg = 'Some TABLES name values are incorrect';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         /// Check previous & next are ok (duplicates and existing tables)
             if ($result && !$this->checkPreviousNextValues($this->tables)) {
                 $this->errormsg = 'Some TABLES previous/next values are incorrect';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         /// Order tables
             if ($result && !$this->orderTables($this->tables)) {
                 $this->errormsg = 'Error ordering the tables';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         }
@@ -416,7 +416,7 @@ class XMLDBStructure extends XMLDBObject {
                 $this->statements[] = $statement;
                 if (!$statement->isLoaded()) {
                     $this->errormsg = 'Problem loading statement ' . $name;
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 }
             }
@@ -427,19 +427,19 @@ class XMLDBStructure extends XMLDBObject {
         /// Check statements names are ok (lowercase, a-z _-)
             if (!$this->checkNameValues($this->statements)) {
                 $this->errormsg = 'Some STATEMENTS name values are incorrect';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         /// Check previous & next are ok (duplicates and existing statements)
             if ($result && !$this->checkPreviousNextValues($this->statements)) {
                 $this->errormsg = 'Some STATEMENTS previous/next values are incorrect';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         /// Order statements
             if ($result && !$this->orderStatements($this->statements)) {
                 $this->errormsg = 'Error ordering the statements';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         }
index c2c353b5a3988831a70c62863416e736f00acec6..0b5497aed9900d5a808706bde9ffd8b12768cad5 100644 (file)
@@ -444,14 +444,14 @@ class XMLDBTable extends XMLDBObject {
             $this->name = trim($xmlarr['@']['NAME']);
         } else {
             $this->errormsg = 'Missing NAME attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
         if (isset($xmlarr['@']['COMMENT'])) {
             $this->comment = trim($xmlarr['@']['COMMENT']);
         } else {
             $this->errormsg = 'Missing COMMENT attribute';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
         if (isset($xmlarr['@']['PREVIOUS'])) {
@@ -473,13 +473,13 @@ class XMLDBTable extends XMLDBObject {
                 $this->fields[] = $field;
                 if (!$field->isLoaded()) {
                     $this->errormsg = 'Problem loading field ' . $name;
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 }
             }
         } else {
             $this->errormsg = 'Missing FIELDS section';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
 
@@ -488,19 +488,19 @@ class XMLDBTable extends XMLDBObject {
         /// Check field names are ok (lowercase, a-z _-)
             if (!$this->checkNameValues($this->fields)) {
                 $this->errormsg = 'Some FIELDS name values are incorrect';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         /// Check previous & next are ok (duplicates and existing fields)
             if ($result && !$this->checkPreviousNextValues($this->fields)) {
                 $this->errormsg = 'Some FIELDS previous/next values are incorrect';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         /// Order fields
             if ($result && !$this->orderFields($this->fields)) {
                 $this->errormsg = 'Error ordering the fields';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         }
@@ -517,13 +517,13 @@ class XMLDBTable extends XMLDBObject {
                 $this->keys[] = $key;
                 if (!$key->isLoaded()) {
                     $this->errormsg = 'Problem loading key ' . $name;
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 }
             }
         } else {
             $this->errormsg = 'Missing KEYS section (at least one PK must exist)';
-            xmldb_dbg($this->errormsg);
+            $this->debug($this->errormsg);
             $result = false;
         }
 
@@ -532,19 +532,19 @@ class XMLDBTable extends XMLDBObject {
         /// Check keys names are ok (lowercase, a-z _-)
             if (!$this->checkNameValues($this->keys)) {
                 $this->errormsg = 'Some KEYS name values are incorrect';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         /// Check previous & next are ok (duplicates and existing keys)
             if ($result && !$this->checkPreviousNextValues($this->keys)) {
                 $this->errormsg = 'Some KEYS previous/next values are incorrect';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         /// Order keys
             if ($result && !$this->orderKeys($this->keys)) {
                 $this->errormsg = 'Error ordering the keys';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         /// TODO: Only one PK
@@ -564,7 +564,7 @@ class XMLDBTable extends XMLDBObject {
                 $this->indexes[] = $index;
                 if (!$index->isLoaded()) {
                     $this->errormsg = 'Problem loading index ' . $name;
-                    xmldb_dbg($this->errormsg);
+                    $this->debug($this->errormsg);
                     $result = false;
                 }
             }
@@ -575,19 +575,19 @@ class XMLDBTable extends XMLDBObject {
         /// Check field names are ok (lowercase, a-z _-)
             if (!$this->checkNameValues($this->indexes)) {
                 $this->errormsg = 'Some INDEXES name values are incorrect';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         /// Check previous & next are ok (duplicates and existing INDEXES)
             if ($result && !$this->checkPreviousNextValues($this->indexes)) {
                 $this->errormsg = 'Some INDEXES previous/next values are incorrect';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         /// Order indexes
             if ($result && !$this->orderIndexes($this->indexes)) {
                 $this->errormsg = 'Error ordering the indexes';
-                xmldb_dbg($this->errormsg);
+                $this->debug($this->errormsg);
                 $result = false;
             }
         /// TODO: Not indexes with repeated fields