本文整理汇总了PHP中Index::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Index::getName方法的具体用法?PHP Index::getName怎么用?PHP Index::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Index
的用法示例。
在下文中一共展示了Index::getName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDropIndexDDL
/**
* Builds the DDL SQL to drop an Index.
*
* @param Index $index
* @return string
*/
public function getDropIndexDDL(Index $index)
{
$pattern = "\nDROP INDEX %s ON %s;\n";
return sprintf($pattern, $this->quoteIdentifier($index->getName()), $this->quoteIdentifier($index->getTable()->getName()));
}
示例2: parse
/**
* @param string $stmt
* @return $this
*/
public function parse($stmt)
{
$lines = array_map('trim', explode(PHP_EOL, $stmt));
$this->first = array_shift($lines);
$last = array_pop($lines);
//remove AUTO_INCREMENT bit from raw statement
$this->last = preg_replace('/AUTO_INCREMENT=\\d+ ?/', '', $last);
$this->statement = str_replace($last, $this->last, $stmt);
if ($this->name === null) {
if (!preg_match('/`([^`]+)/', $this->first, $match)) {
throw new \RuntimeException(sprintf('Unable to extract name from %s (looked at line %s)', $stmt, $lines[0]));
}
$this->name = $match[1];
}
foreach ($lines as $ln) {
if (mb_substr($ln, -1) == ',') {
$ln = mb_substr($ln, 0, -1);
}
//field lines start with back-tick
switch ($ln[0]) {
case '`':
$field = new Field($ln);
$this->fields[$field->getName()] = $field;
break;
case 'P':
$this->primary = new Primary($ln);
break;
case 'S':
//spatial
//spatial
case 'U':
//unique
//unique
case 'F':
//fulltext
//fulltext
case 'I':
//index
//index
case 'K':
//Key
$idx = new Index($ln);
$this->indexes[$idx->getName()] = $idx;
break;
case 'C':
$constraint = new ForeignKey($ln);
$this->constraints[$constraint->getName()] = $constraint;
break;
default:
throw new \LogicException(sprintf('Unable to parse line %s in %s', $ln, $stmt));
}
}
return $this;
}
示例3: getDropIndexDDL
/**
* Overrides the implementation from DefaultPlatform
*
* @author Niklas Närhinen <niklas@narhinen.net>
* @return string
* @see DefaultPlatform::getDropIndexDDL
*/
public function getDropIndexDDL(Index $index)
{
if ($index instanceof Unique) {
$pattern = "\n ALTER TABLE %s DROP CONSTRAINT %s;\n ";
return sprintf($pattern, $this->quoteIdentifier($index->getTable()->getName()), $this->quoteIdentifier($index->getName()));
} else {
return parent::getDropIndexDDL($index);
}
}
示例4: singleton
/**
* Creates(if not already created) and returns the corresponding Index object
*
* @param string $schema database name
* @param string $table table name
* @param string $index_name index name
*
* @return Index corresponding Index object
*/
public static function singleton($schema, $table, $index_name = '')
{
Index::_loadIndexes($table, $schema);
if (!isset(Index::$_registry[$schema][$table][$index_name])) {
$index = new Index();
if (mb_strlen($index_name)) {
$index->setName($index_name);
Index::$_registry[$schema][$table][$index->getName()] = $index;
}
return $index;
} else {
return Index::$_registry[$schema][$table][$index_name];
}
}
示例5: 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 = "\r\nCREATE %sINDEX %s ON %s (%s)%s;\r\n";
return sprintf($pattern, $index->getIsUnique() ? 'UNIQUE ' : '', $this->quoteIdentifier($index->getName()), $this->quoteIdentifier($index->getTable()->getName()), $this->getColumnListDDL($index->getColumns()), $this->generateBlockStorage($index));
}
示例6: 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()));
}
示例7: addIndex
/**
* @param Index $index
*/
public function addIndex(Index $index)
{
$index->setParentTable($this);
$this->indexes[$index->getName()] = $index;
}
示例8: addIndex
/**
* Add index
*
* @param \deco\essentials\database\util\Index $index
*/
public function addIndex(Index $index)
{
$this->indexes[$index->getName()] = $index;
}
示例9: addIndexToModel
/**
* Adds index to table
* @param Index $index
*/
public function addIndexToModel($index)
{
$this->query('insert into [indexes] values( null, %s, %s, %s, %s)', $index->getName(), $index->getModel()->getTableName(), $index->getHash(), $index->isUnique());
PerfORMController::getBuilder()->createIndex($index);
}
示例10: addChangedIndex
/**
* @param Index $changedIndex
*/
public function addChangedIndex(Index $changedIndex)
{
$this->changedIndexes[$changedIndex->getName()] = $changedIndex;
}