本文整理汇总了PHP中Index::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Index::setName方法的具体用法?PHP Index::setName怎么用?PHP Index::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Index
的用法示例。
在下文中一共展示了Index::setName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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];
}
}
示例2: addExtraIndices
/**
* Adds extra indices for reverse foreign keys
* This is required for MySQL databases,
* and is called from Database::doFinalInitialization()
*/
public function addExtraIndices()
{
/**
* A collection of indexed columns. The keys is the column name
* (concatenated with a comma in the case of multi-col index), the value is
* an array with the names of the indexes that index these columns. We use
* it to determine which additional indexes must be created for foreign
* keys. It could also be used to detect duplicate indexes, but this is not
* implemented yet.
* @var array
*/
$_indices = array();
$this->collectIndexedColumns('PRIMARY', $this->getPrimaryKey(), $_indices);
$_tableIndices = array_merge($this->getIndices(), $this->getUnices());
foreach ($_tableIndices as $_index) {
$this->collectIndexedColumns($_index->getName(), $_index->getColumns(), $_indices);
}
// we're determining which tables have foreign keys that point to this table,
// since MySQL needs an index on any column that is referenced by another table
// (yep, MySQL _is_ a PITA)
$counter = 0;
foreach ($this->getReferrers() as $foreignKey) {
$referencedColumns = $foreignKey->getForeignColumnObjects();
$referencedColumnsHash = $this->getColumnList($referencedColumns);
if (!array_key_exists($referencedColumnsHash, $_indices)) {
// no matching index defined in the schema, so we have to create one
$index = new Index();
$index->setName(sprintf('I_referenced_%s_%s', $foreignKey->getName(), ++$counter));
$index->setColumns($referencedColumns);
$index->resetColumnSize();
$this->addIndex($index);
// Add this new index to our collection, otherwise we might add it again (bug #725)
$this->collectIndexedColumns($index->getName(), $referencedColumns, $_indices);
}
}
// we're adding indices for this table foreign keys
foreach ($this->getForeignKeys() as $foreignKey) {
$localColumns = $foreignKey->getLocalColumnObjects();
$localColumnsHash = $this->getColumnList($localColumns);
if (!array_key_exists($localColumnsHash, $_indices)) {
// no matching index defined in the schema, so we have to create one. MySQL needs indices on any columns that serve as foreign keys. these are not auto-created prior to 4.1.2
$index = new Index();
$index->setName(substr_replace($foreignKey->getName(), 'FI_', strrpos($foreignKey->getName(), 'FK_'), 3));
$index->setColumns($localColumns);
$index->resetColumnSize();
$this->addIndex($index);
$this->collectIndexedColumns($index->getName(), $localColumns, $_indices);
}
}
}
示例3: getData
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
include "prepend.inc.php";
$Server = getData("Server", "integer");
$User = getData("User");
$Indexname = getData("Indexname");
$html = "<h1> Database " . $DB->Name($Server) . " - Index " . $Indexname . "</h1>";
if ($Indexname) {
$ind = new Index($Server);
$ind->setOwner($User);
$ind->setName($Indexname);
$ind->getData();
$html .= "<table border=0><tr><th>Tag</th><th>Value</th></tr>";
$html .= "<tr><td>Name</td><td>" . $ind->name . "</td></tr>";
$html .= "<tr><td>Owner</td><td>" . $ind->owner . "</td></tr>";
$html .= "<tr><td>Table</td><td>" . $ind->table_owner . "." . $ind->table_name . "</td></tr>";
$html .= "<tr><td>Tablespace</td><td>" . $ind->tablespace_name . "</td></tr>";
$html .= "<tr><td>Table Type</td><td>" . $ind->table_type . "</td></tr>";
$html .= "<tr><td>Uniqueness</td><td>" . $ind->uniqueness . "</td></tr>";
$html .= "<tr><td>Initial Trans</td><td>" . $ind->ini_trans . "</td></tr>";
$html .= "<tr><td>Max Trans</td><td>" . $ind->max_trans . "</td></tr>";
$html .= "<tr><td>Initial Extents</td><td>" . $ind->initial_extent . "</td></tr>";
$html .= "<tr><td>Next Extents</td><td>" . $ind->next_extent . "</td></tr>";
$html .= "<tr><td>Min Extents</td><td>" . $ind->min_extents . "</td></tr>";
$html .= "<tr><td>Max Extents</td><td>" . $ind->max_extents . "</td></tr>";
$html .= "<tr><td>% Increase</td><td>" . $ind->pct_increase . "</td></tr>";