本文整理汇总了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;
}