当前位置: 首页>>代码示例>>PHP>>正文


PHP xmldb_index::setChanged方法代码示例

本文整理汇总了PHP中xmldb_index::setChanged方法的典型用法代码示例。如果您正苦于以下问题:PHP xmldb_index::setChanged方法的具体用法?PHP xmldb_index::setChanged怎么用?PHP xmldb_index::setChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xmldb_index的用法示例。



在下文中一共展示了xmldb_index::setChanged方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: addIndex

 /**
  * Add one index to the table, allowing to specify the desired  order
  * If it's not specified, then the index is added at the end
  * @param xmldb_index $index
  * @param xmldb_object $after
  */
 public function addIndex($index, $after = null)
 {
     // Detect duplicates first
     if ($this->getIndex($index->getName())) {
         throw new coding_exception('Duplicate index ' . $index->getName() . ' specified in table ' . $this->getName());
     }
     // Make sure there are no keys with the index column specs because they would collide.
     $newfields = $index->getFields();
     $allkeys = $this->getKeys();
     foreach ($allkeys as $key) {
         $fields = $key->getFields();
         if ($fields === $newfields) {
             throw new coding_exception('Key ' . $key->getName() . ' collides with index' . $index->getName() . ' specified in table ' . $this->getName());
         }
     }
     // Calculate the previous and next indexes
     $previndex = null;
     $nextindex = null;
     if (!$after) {
         $allindexes = $this->getIndexes();
         if (!empty($allindexes)) {
             end($allindexes);
             $previndex = $allindexes[key($allindexes)];
         }
     } else {
         $previndex = $this->getIndex($after);
     }
     if ($previndex && $previndex->getNext()) {
         $nextindex = $this->getIndex($previndex->getNext());
     }
     // Set current index previous and next attributes
     if ($previndex) {
         $index->setPrevious($previndex->getName());
         $previndex->setNext($index->getName());
     }
     if ($nextindex) {
         $index->setNext($nextindex->getName());
         $nextindex->setPrevious($index->getName());
     }
     // Some more attributes
     $index->setLoaded(true);
     $index->setChanged(true);
     // Add the new index
     $this->indexes[] = $index;
     // Reorder the indexes
     $this->orderIndexes($this->indexes);
     // Recalculate the hash
     $this->calculateHash(true);
     // We have one new index, so the table has changed
     $this->setChanged(true);
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:57,代码来源:xmldb_table.php


示例2: addIndex

    /**
     * Add one index to the table, allowing to specify the desired  order
     * If it's not specified, then the index is added at the end
     * @param xmldb_index $index
     * @param xmldb_object $after
     */
    public function addIndex($index, $after=null) {

        // Detect duplicates first
        if ($this->getIndex($index->getName())) {
            throw new coding_exception('Duplicate index '.$index->getName().' specified in table '.$this->getName());
        }

        // Calculate the previous and next indexes
        $previndex = null;
        $nextindex = null;

        if (!$after) {
            $allindexes = $this->getIndexes();
            if (!empty($allindexes)) {
                end($allindexes);
                $previndex = $allindexes[key($allindexes)];
            }
        } else {
            $previndex = $this->getIndex($after);
        }
        if ($previndex && $previndex->getNext()) {
            $nextindex = $this->getIndex($previndex->getNext());
        }

        // Set current index previous and next attributes
        if ($previndex) {
            $index->setPrevious($previndex->getName());
            $previndex->setNext($index->getName());
        }
        if ($nextindex) {
            $index->setNext($nextindex->getName());
            $nextindex->setPrevious($index->getName());
        }

        // Some more attributes
        $index->setLoaded(true);
        $index->setChanged(true);
        // Add the new index
        $this->indexes[] = $index;
        // Reorder the indexes
        $this->orderIndexes($this->indexes);
        // Recalculate the hash
        $this->calculateHash(true);
        // We have one new index, so the table has changed
        $this->setChanged(true);
    }
开发者ID:Burick,项目名称:moodle,代码行数:52,代码来源:xmldb_table.php



注:本文中的xmldb_index::setChanged方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。