當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XMLDBIndex::arr2XMLDBIndex方法代碼示例

本文整理匯總了PHP中XMLDBIndex::arr2XMLDBIndex方法的典型用法代碼示例。如果您正苦於以下問題:PHP XMLDBIndex::arr2XMLDBIndex方法的具體用法?PHP XMLDBIndex::arr2XMLDBIndex怎麽用?PHP XMLDBIndex::arr2XMLDBIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XMLDBIndex的用法示例。


在下文中一共展示了XMLDBIndex::arr2XMLDBIndex方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: trim


//.........這裏部分代碼省略.........
             $this->debug($this->errormsg);
             $result = false;
         }
     }
     /// Iterate over keys
     if (isset($xmlarr['#']['KEYS']['0']['#']['KEY'])) {
         foreach ($xmlarr['#']['KEYS']['0']['#']['KEY'] as $xmlkey) {
             if (!$result) {
                 //Skip on error
                 continue;
             }
             $name = trim($xmlkey['@']['NAME']);
             $key = new XMLDBKey($name);
             $key->arr2XMLDBKey($xmlkey);
             $this->keys[] = $key;
             if (!$key->isLoaded()) {
                 $this->errormsg = 'Problem loading key ' . $name;
                 $this->debug($this->errormsg);
                 $result = false;
             }
         }
     } else {
         $this->errormsg = 'Missing KEYS section (at least one PK must exist)';
         $this->debug($this->errormsg);
         $result = false;
     }
     /// Perform some general checks over keys
     if ($result && $this->keys) {
         /// Check keys names are ok (lowercase, a-z _-)
         if (!$this->checkNameValues($this->keys)) {
             $this->errormsg = 'Some KEYS name values are incorrect';
             $this->debug($this->errormsg);
             $result = false;
         }
         /// Check previous & next are ok (duplicates and existing keys)
         $this->fixPrevNext($this->keys);
         if ($result && !$this->checkPreviousNextValues($this->keys)) {
             $this->errormsg = 'Some KEYS previous/next values are incorrect';
             $this->debug($this->errormsg);
             $result = false;
         }
         /// Order keys
         if ($result && !$this->orderKeys($this->keys)) {
             $this->errormsg = 'Error ordering the keys';
             $this->debug($this->errormsg);
             $result = false;
         }
         /// TODO: Only one PK
         /// TODO: Not keys with repeated fields
         /// TODO: Check fields and reffieds exist in table
     }
     /// Iterate over indexes
     if (isset($xmlarr['#']['INDEXES']['0']['#']['INDEX'])) {
         foreach ($xmlarr['#']['INDEXES']['0']['#']['INDEX'] as $xmlindex) {
             if (!$result) {
                 //Skip on error
                 continue;
             }
             $name = trim($xmlindex['@']['NAME']);
             $index = new XMLDBIndex($name);
             $index->arr2XMLDBIndex($xmlindex);
             $this->indexes[] = $index;
             if (!$index->isLoaded()) {
                 $this->errormsg = 'Problem loading index ' . $name;
                 $this->debug($this->errormsg);
                 $result = false;
             }
         }
     }
     /// Perform some general checks over indexes
     if ($result && $this->indexes) {
         /// Check field names are ok (lowercase, a-z _-)
         if (!$this->checkNameValues($this->indexes)) {
             $this->errormsg = 'Some INDEXES name values are incorrect';
             $this->debug($this->errormsg);
             $result = false;
         }
         /// Check previous & next are ok (duplicates and existing INDEXES)
         $this->fixPrevNext($this->indexes);
         if ($result && !$this->checkPreviousNextValues($this->indexes)) {
             $this->errormsg = 'Some INDEXES previous/next values are incorrect';
             $this->debug($this->errormsg);
             $result = false;
         }
         /// Order indexes
         if ($result && !$this->orderIndexes($this->indexes)) {
             $this->errormsg = 'Error ordering the indexes';
             $this->debug($this->errormsg);
             $result = false;
         }
         /// TODO: Not indexes with repeated fields
         /// TODO: Check fields exist in table
     }
     /// Set some attributes
     if ($result) {
         $this->loaded = true;
     }
     $this->calculateHash();
     return $result;
 }
開發者ID:JackCanada,項目名稱:moodle-hacks,代碼行數:101,代碼來源:XMLDBTable.class.php


注:本文中的XMLDBIndex::arr2XMLDBIndex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。