• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/db/mysqlcommonconnection.php
  • Класс: BitrixMainDBMysqlCommonConnection
  • Вызов: MysqlCommonConnection::getIndexName
public function getIndexName($tableName, array $columns, $strict = false)
{
	if (empty($columns))
	{
		return null;
	}

	$tableName = preg_replace("/[^a-z0-9_]+/i", "", $tableName);
	$tableName = trim($tableName);

	$rs = $this->query("SHOW INDEX FROM `".$this->getSqlHelper()->forSql($tableName)."`");
	if (!$rs)
	{
		return null;
	}

	$indexes = array();
	while ($ar = $rs->fetch())
	{
		$indexes[$ar["Key_name"]][$ar["Seq_in_index"] - 1] = $ar["Column_name"];
	}

	return static::findIndex($indexes, $columns, $strict);
}