本文整理汇总了PHP中Doctrine\DBAL\Schema\AbstractSchemaManager::_getPortableTableIndexesList方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractSchemaManager::_getPortableTableIndexesList方法的具体用法?PHP AbstractSchemaManager::_getPortableTableIndexesList怎么用?PHP AbstractSchemaManager::_getPortableTableIndexesList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\AbstractSchemaManager
的用法示例。
在下文中一共展示了AbstractSchemaManager::_getPortableTableIndexesList方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getPortableTableIndexesList
/**
* {@inheritdoc}
*/
protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null)
{
foreach ($tableIndexRows as &$tableIndex) {
$tableIndex['non_unique'] = (bool) $tableIndex['non_unique'];
$tableIndex['primary'] = (bool) $tableIndex['primary'];
$tableIndex['flags'] = $tableIndex['flags'] ? array($tableIndex['flags']) : null;
}
return parent::_getPortableTableIndexesList($tableIndexRows, $tableName);
}
示例2: _getPortableTableIndexesList
/**
* {@inheritdoc}
*/
protected function _getPortableTableIndexesList($tableIndexes, $tableName = null)
{
$indexes = array();
foreach ($tableIndexes as $k) {
$k['primary'] = (bool) $k['primary'];
$indexes[] = $k;
}
return parent::_getPortableTableIndexesList($indexes, $tableName);
}
示例3: _getPortableTableIndexesList
/**
* {@inheritdoc}
*/
protected function _getPortableTableIndexesList($tableIndexes, $tableName = null)
{
foreach ($tableIndexes as $k => $v) {
$v = array_change_key_case($v, CASE_LOWER);
if ($v['key_name'] == 'PRIMARY') {
$v['primary'] = true;
} else {
$v['primary'] = false;
}
if (strpos($v['index_type'], 'FULLTEXT') !== false) {
$v['flags'] = array('FULLTEXT');
}
$tableIndexes[$k] = $v;
}
return parent::_getPortableTableIndexesList($tableIndexes, $tableName);
}
示例4: _getPortableTableIndexesList
protected function _getPortableTableIndexesList($tableIndexes, $tableName = null)
{
//return array();// @todo метод должен возвращать индексы (как я понял исключая Первичные ключи)
foreach ($tableIndexes as $k => $v) {
$v = array_change_key_case($v, CASE_LOWER);
if ($v['key_name'] == 'PRIMARY') {
$v['primary'] = true;
} else {
$v['primary'] = false;
}
if (strpos($v['index_type'], 'FULLTEXT') !== false) {
$v['flags'] = array('FULLTEXT');
}
$tableIndexes[$k] = $v;
}
return parent::_getPortableTableIndexesList($tableIndexes, $tableName);
}
示例5: _getPortableTableIndexesList
/**
* {@inheritdoc}
*
* @license New BSD License
* @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html
*/
protected function _getPortableTableIndexesList($tableIndexes, $tableName = null)
{
$indexBuffer = array();
foreach ($tableIndexes as $tableIndex) {
$tableIndex = \array_change_key_case($tableIndex, CASE_LOWER);
$keyName = strtolower($tableIndex['name']);
if (strtolower($tableIndex['is_primary']) == "p") {
$keyName = 'primary';
$buffer['primary'] = true;
$buffer['non_unique'] = false;
} else {
$buffer['primary'] = false;
$buffer['non_unique'] = $tableIndex['is_unique'] == 0 ? true : false;
}
$buffer['key_name'] = $keyName;
$buffer['column_name'] = $this->getQuotedIdentifierName($tableIndex['column_name']);
$indexBuffer[] = $buffer;
}
return parent::_getPortableTableIndexesList($indexBuffer, $tableName);
}
示例6: _getPortableTableIndexesList
/**
* {@inheritdoc}
*
* @license New BSD License
* @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html
*/
protected function _getPortableTableIndexesList($tableIndexes, $tableName = null)
{
$indexBuffer = array();
// fetch primary
$stmt = $this->_conn->executeQuery("PRAGMA TABLE_INFO ('{$tableName}')");
$indexArray = $stmt->fetchAll(\PDO::FETCH_ASSOC);
usort($indexArray, function ($a, $b) {
if ($a['pk'] == $b['pk']) {
return $a['cid'] - $b['cid'];
}
return $a['pk'] - $b['pk'];
});
foreach ($indexArray as $indexColumnRow) {
if ($indexColumnRow['pk'] != "0") {
$indexBuffer[] = array('key_name' => 'primary', 'primary' => true, 'non_unique' => false, 'column_name' => $indexColumnRow['name']);
}
}
// fetch regular indexes
foreach ($tableIndexes as $tableIndex) {
// Ignore indexes with reserved names, e.g. autoindexes
if (strpos($tableIndex['name'], 'sqlite_') !== 0) {
$keyName = $tableIndex['name'];
$idx = array();
$idx['key_name'] = $keyName;
$idx['primary'] = false;
$idx['non_unique'] = $tableIndex['unique'] ? false : true;
$stmt = $this->_conn->executeQuery("PRAGMA INDEX_INFO ('{$keyName}')");
$indexArray = $stmt->fetchAll(\PDO::FETCH_ASSOC);
foreach ($indexArray as $indexColumnRow) {
$idx['column_name'] = $indexColumnRow['name'];
$indexBuffer[] = $idx;
}
}
}
return parent::_getPortableTableIndexesList($indexBuffer, $tableName);
}
示例7: _getPortableTableIndexesList
/**
* {@inheritdoc}
*
* @license New BSD License
* @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html
*/
protected function _getPortableTableIndexesList($tableIndexes, $tableName = null)
{
$buffer = array();
foreach ($tableIndexes as $row) {
$colNumbers = explode(' ', $row['indkey']);
$colNumbersSql = 'IN (' . join(' ,', $colNumbers) . ' )';
$columnNameSql = "SELECT attnum, attname FROM pg_attribute\n WHERE attrelid={$row['indrelid']} AND attnum {$colNumbersSql} ORDER BY attnum ASC;";
$stmt = $this->_conn->executeQuery($columnNameSql);
$indexColumns = $stmt->fetchAll();
// required for getting the order of the columns right.
foreach ($colNumbers as $colNum) {
foreach ($indexColumns as $colRow) {
if ($colNum == $colRow['attnum']) {
$buffer[] = array('key_name' => $row['relname'], 'column_name' => trim($colRow['attname']), 'non_unique' => !$row['indisunique'], 'primary' => $row['indisprimary'], 'where' => $row['where']);
}
}
}
}
return parent::_getPortableTableIndexesList($buffer, $tableName);
}
示例8: _getPortableTableIndexesList
/**
* {@inheritdoc}
*/
protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null)
{
foreach ($tableIndexRows as &$tableIndex) {
$tableIndex['primary'] = (bool) $tableIndex['primary'];
$tableIndex['flags'] = array();
if ($tableIndex['clustered']) {
$tableIndex['flags'][] = 'clustered';
}
if ($tableIndex['with_nulls_not_distinct']) {
$tableIndex['flags'][] = 'with_nulls_not_distinct';
}
if ($tableIndex['for_olap_workload']) {
$tableIndex['flags'][] = 'for_olap_workload';
}
}
return parent::_getPortableTableIndexesList($tableIndexRows, $tableName);
}
示例9: _getPortableTableIndexesList
/**
* {@inheritdoc}
*/
protected function _getPortableTableIndexesList($tableIndexes, $tableName = null)
{
$indexesByColumns = array();
foreach ($tableIndexes as $k => $v) {
$v = array_change_key_case($v, CASE_LOWER);
foreach (range(1, 16) as $i) {
if (!empty($v["col{$i}"])) {
$indexesByColumns[] = array('column_name' => $v["col{$i}"], 'key_name' => $v['constrname'] ?: $v['idxname'], 'non_unique' => $v['idxtype'] == 'D', 'primary' => $v['constrtype'] == 'P');
}
}
}
return parent::_getPortableTableIndexesList($indexesByColumns, $tableName);
}
示例10: _getPortableTableIndexesList
/**
* @param array $tableIndexes
* @param string $tableName
* @return array
*/
protected function _getPortableTableIndexesList($tableIndexes, $tableName = null)
{
$indexBuffer = array();
foreach ($tableIndexes as $tableIndex) {
if ($tableIndex['index_type'] === "PRIMARY") {
$keyName = 'primary';
$buffer['primary'] = true;
$buffer['non_unique'] = false;
} else {
$buffer['primary'] = false;
$buffer['non_unique'] = $tableIndex['is_unique'] === 'NO';
}
$buffer['key_name'] = $tableIndex['index_name'];
$buffer['column_name'] = $tableIndex['column_name'];
$indexBuffer[] = $buffer;
}
return parent::_getPortableTableIndexesList($indexBuffer, $tableName);
}