• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/db/connection.php
  • Класс: BitrixMainDBConnection
  • Вызов: Connection::getIndexName
public function getIndexName($tableName, array $columns, $strict = false);

/**
 * Returns fields objects according to the columns of a table.
 * Table must exist.
 *
 * @param string $tableName The table name.
 *
 * @return ScalarField[] An array of objects with columns information.
 * @throws SqlQueryException
 */
abstract public function getTableFields($tableName);

/**
 * @param string $tableName Name of the new table.
 * @param ScalarField[] $fields Array with columns descriptions.
 * @param string[] $primary Array with primary key column names.
 * @param string[] $autoincrement Which columns will be auto incremented ones.
 *
 * @return void
 * @throws SqlQueryException
 */
abstract public function createTable($tableName, $fields, $primary = array(), $autoincrement = array());

/**
 * Creates primary index on column(s)
 * @api
 *
 * @param string $tableName Name of the table.
 * @param string|string[] $columnNames Name of the column or array of column names to be included into the index.
 *
 * @return Result
 * @throws SqlQueryException
 */
public function createPrimaryIndex($tableName, $columnNames)
{
	if (!is_array($columnNames))
	{
		$columnNames = array($columnNames);
	}

	foreach ($columnNames as &$columnName)
	{
		$columnName = $this->getSqlHelper()->quote($columnName);
	}

	$sql = 'ALTER TABLE '.$this->getSqlHelper()->quote($tableName).' ADD PRIMARY KEY('.join(', ', $columnNames).')';

	return $this->query($sql);
}