本文整理汇总了PHP中xmldb_index::arr2xmldb_index方法的典型用法代码示例。如果您正苦于以下问题:PHP xmldb_index::arr2xmldb_index方法的具体用法?PHP xmldb_index::arr2xmldb_index怎么用?PHP xmldb_index::arr2xmldb_index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmldb_index
的用法示例。
在下文中一共展示了xmldb_index::arr2xmldb_index方法的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 xmldb_key($name);
$key->arr2xmldb_key($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 xmldb_index($name);
$index->arr2xmldb_index($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;
}