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


PHP Index::getColumns方法代码示例

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


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

示例1: testAddIndexedColumns

 /**
  * @dataProvider provideColumnDefinitions
  *
  */
 public function testAddIndexedColumns($columns)
 {
     $index = new Index();
     $index->setColumns($columns);
     $this->assertTrue($index->hasColumns());
     $this->assertCount(3, $index->getColumns());
     $this->assertSame(100, $index->getColumnSize('foo'));
     $this->assertTrue($index->hasColumnSize('foo'));
     $this->assertSame(5, $index->getColumnSize('bar'));
     $this->assertTrue($index->hasColumnSize('bar'));
     $this->assertNull($index->getColumnSize('baz'));
 }
开发者ID:robin850,项目名称:Propel2,代码行数:16,代码来源:IndexTest.php

示例2: computeDiff

 /**
  * Computes the difference between two index objects.
  *
  * @param  Index   $fromIndex
  * @param  Index   $toIndex
  * @param  boolean $caseInsensitive
  * @return boolean
  */
 public static function computeDiff(Index $fromIndex, Index $toIndex, $caseInsensitive = false)
 {
     // Check for removed index columns in $toIndex
     $fromIndexColumns = $fromIndex->getColumns();
     $max = count($fromIndexColumns);
     for ($i = 0; $i < $max; $i++) {
         $indexColumn = $fromIndexColumns[$i];
         if (!$toIndex->hasColumnAtPosition($i, $indexColumn, $fromIndex->getColumnSize($indexColumn), $caseInsensitive)) {
             return true;
         }
     }
     // Check for new index columns in $toIndex
     $toIndexColumns = $toIndex->getColumns();
     $max = count($toIndexColumns);
     for ($i = 0; $i < $max; $i++) {
         $indexColumn = $toIndexColumns[$i];
         if (!$fromIndex->hasColumnAtPosition($i, $indexColumn, $toIndex->getColumnSize($indexColumn), $caseInsensitive)) {
             return true;
         }
     }
     // Check for difference in unicity
     return $fromIndex->isUnique() !== $toIndex->isUnique();
 }
开发者ID:disider,项目名称:Propel2,代码行数:31,代码来源:IndexComparator.php

示例3: getIndexColumnListDDL

 /**
  * Creates a comma-separated list of column names for the index.
  * For MySQL unique indexes there is the option of specifying size, so we cannot simply use
  * the getColumnsList() method.
  * @param  Index  $index
  * @return string
  */
 protected function getIndexColumnListDDL(Index $index)
 {
     $list = array();
     foreach ($index->getColumns() as $col) {
         $list[] = $this->quoteIdentifier($col) . ($index->hasColumnSize($col) ? '(' . $index->getColumnSize($col) . ')' : '');
     }
     return implode(', ', $list);
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:15,代码来源:MysqlPlatform.php

示例4: getAddIndexDDL

 /**
  * Builds the DDL SQL to add an Index.
  *
  * @param      Index $index
  * @return     string
  */
 public function getAddIndexDDL(Index $index)
 {
     // don't create index form primary key
     if ($this->getPrimaryKeyName($index->getTable()) == $this->quoteIdentifier($index->getName())) {
         return "";
     }
     $pattern = "\nCREATE %sINDEX %s ON %s (%s)%s;\n";
     return sprintf($pattern, $index->getIsUnique() ? 'UNIQUE ' : '', $this->quoteIdentifier($index->getName()), $this->quoteIdentifier($index->getTable()->getName()), $this->getColumnListDDL($index->getColumns()), $this->generateBlockStorage($index));
 }
开发者ID:norfil,项目名称:Propel2,代码行数:15,代码来源:OraclePlatform.php

示例5: getIndexDDL

 /**
  * Builds the DDL SQL for an Index object.
  *
  * @param      Index $index
  * @return     string
  */
 public function getIndexDDL(Index $index)
 {
     return sprintf('%sINDEX %s (%s)', $index->getIsUnique() ? 'UNIQUE ' : '', $this->quoteIdentifier($index->getName()), $this->getColumnListDDL($index->getColumns()));
 }
开发者ID:rouffj,项目名称:Propel2,代码行数:10,代码来源:DefaultPlatform.php

示例6: addIndex

 /**
  * Adds a new index to the indices list and set the
  * parent table of the column to the current table.
  *
  * @param  Index|array $index
  * @return Index
  *
  * @throw  InvalidArgumentException
  */
 public function addIndex($index)
 {
     if ($index instanceof Index) {
         if ($this->hasIndex($index->getName())) {
             throw new InvalidArgumentException(sprintf('Index "%s" already exist.', $index->getName()));
         }
         if (!$index->getColumns()) {
             throw new InvalidArgumentException(sprintf('Index "%s" has no columns.', $index->getName()));
         }
         $index->setTable($this);
         // force the name to be created if empty.
         $this->indices[] = $index;
         return $index;
     }
     $idx = new Index();
     $idx->loadMapping($index);
     foreach ((array) @$index['columns'] as $column) {
         $idx->addColumn($column);
     }
     return $this->addIndex($idx);
 }
开发者ID:disider,项目名称:Propel2,代码行数:30,代码来源:Table.php

示例7: appendGenericIndexNode

 /**
  * Appends a generice <index> or <unique> XML node to its parent node.
  *
  * @param string   $nodeType   The node type (index or unique)
  * @param Index    $index      The Index model instance
  * @param \DOMNode $parentNode The parent DOMNode object
  */
 private function appendGenericIndexNode($nodeType, Index $index, \DOMNode $parentNode)
 {
     $indexNode = $parentNode->appendChild($this->document->createElement($nodeType));
     $indexNode->setAttribute('name', $index->getName());
     foreach ($index->getColumns() as $columnName) {
         $indexColumnNode = $indexNode->appendChild($this->document->createElement($nodeType . '-column'));
         $indexColumnNode->setAttribute('name', $columnName);
         if ($size = $index->getColumnSize($columnName)) {
             $indexColumnNode->setAttribute('size', $size);
         }
     }
     foreach ($index->getVendorInformation() as $vendorInformation) {
         $this->appendVendorInformationNode($vendorInformation, $indexNode);
     }
 }
开发者ID:SwissalpS,项目名称:Propel2,代码行数:22,代码来源:XmlDumper.php


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