本文整理汇总了PHP中Propel\Generator\Model\Index::getColumnSize方法的典型用法代码示例。如果您正苦于以下问题:PHP Index::getColumnSize方法的具体用法?PHP Index::getColumnSize怎么用?PHP Index::getColumnSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Generator\Model\Index
的用法示例。
在下文中一共展示了Index::getColumnSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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'));
}
示例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();
}
示例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);
}
示例4: 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);
}
}