Check, if the table has an index with the given name

@param string $indexName The name of the index we want to check
@param string $tableName The table to check for the index

@return bool Has the table the given index?
428378
public function hasIndex($indexName, $tableName)
    {
        $result = false;

        foreach ($this->getIndices($tableName) as $index) {
            if ($indexName === $index['Column_name']) {
                $result = true;
            }
        }

        return $result;
    }
795203
public function getIndex($indexName)
    {
    	if (array_key_exists($indexName, $this->indices)) {
	    	return $this->indices[$indexName];
    	}

    	return null;
    }
643289
private function getLuceneIndex($indexName)
    {
        $indexPath = $this->getIndexPath($indexName);

        if (!file_exists($indexPath)) {
            $this->getIndex($indexPath, true);
        }

        return $this->getIndex($indexPath, false);
    }
621608
public function tableExists($name)
    {
        $tables = $this->listTables();
        foreach ($tables as $tableName) {
            if ($tableName == $name) {
                return true;
            }
        }

        return false;
    }
364589
public function getIndexes($tableName)
    {
        $sql = sprintf('SHOW INDEX FROM %s', $this->ident($tableName));
        $rows = $this->pdo->query($sql)->fetchAll();
        $result = [];
        foreach ($rows as $row) {
            if (isset($row['Cardinality'])) {
                unset($row['Cardinality']);
            }
            $name = $row['Key_name'];
            $seq = $row['Seq_in_index'];
            $result[$name][$seq] = $row;
        }

        return $result;
    }
474787
public boolean exists(String indexName) {
        try {
            final JestResult result = jestClient.execute(new GetSettings.Builder().addIndex(indexName).build());
            return result.isSucceeded() && Iterators.contains(result.getJsonObject().fieldNames(), indexName);
        } catch (IOException e) {
            throw new ElasticsearchException("Couldn't check existence of index " + indexName, e);
        }
    }
1326971
public function getTableWhere($tableName)
    {
        if (!empty($this->tableWheres[$tableName])) {
            return $this->tableWheres[$tableName];
        } elseif ($this->dumpSettings['where']) {
            return $this->dumpSettings['where'];
        }

        return false;
    }
1304286
private function fieldExists($tableName, $columnName): bool
    {
        if (!\array_key_exists($tableName, $this->schemaCache)) {
            $this->schemaCache[$tableName] = $this->connection->getSchemaManager()->listTableColumns($tableName);
        }

        return isset($this->schemaCache[$tableName][$columnName]);
    }
1355236
protected static function hasCustomSearch($columnName)
    {
        $methodName = camel_case('laratables_search_'.$columnName);

        if (method_exists(self::$class, $methodName)) {
            return $methodName;
        }

        return false;
    }
297365
protected function tableExists($tableName)
    {
        $tables = $this->connection->getSchemaManager()->listTables();

        foreach ($tables as $table) {
            if ($table->getName() == $tableName) {
                return true;
            }
        }

        return false;
    }
1263453
public function tableExists($tableName) {
        $cache = [];
        if (App::get()->cacheExists('mpf:PDOConnection:tableList')){
            $cache = App::get()->cacheValue('mpf:PDOConnection:tableList');
            if (!is_array($cache)){
                $cache = []; // a fix for old wrong values;
            }
            if (isset($cache[$tableName])){
                return $cache[$tableName];
            }
        }
        $res = $this->queryAssoc("SHOW TABLES LIKE :table", array(':table' => $tableName));
        $cache[$tableName] = (bool)$res;
        App::get()->cacheSet('mpf:PDOConnection:tableList', $cache);
        return (bool)$res;
    }
1316735
public function isTableEmpty($tableName)
	{
		$tableNameQuoted = $this->getDb()->quoteTableName($tableName);
		$cmd = sprintf('SELECT COUNT(*) FROM %s', $tableNameQuoted);

		return $this->getDb()->createCommand($cmd)->queryScalar() === 0;
	}
1220528
public function tableName($tableName = null)
    {
        if ($tableName === null)
        {
            return $this->_tableName;
        }
        $this->_tableName = $tableName;

        return $this;
    }
827954
public function getIndexes($tableName)
    {
        $indexes = [];
        $sql = "SELECT I.[name] AS [index_name], I.[index_id] as [index_id], T.[object_id] as [table_id]
FROM sys.[tables] AS T
  INNER JOIN sys.[indexes] I ON T.[object_id] = I.[object_id]
WHERE T.[is_ms_shipped] = 0 AND I.[type_desc] <> 'HEAP'  AND T.[name] = '{$tableName}'
ORDER BY T.[name], I.[index_id];";

        $rows = $this->fetchAll($sql);
        foreach ($rows as $row) {
            $columns = $this->getIndexColums($row['table_id'], $row['index_id']);
            $indexes[$row['index_name']] = ['columns' => $columns];
        }

        return $indexes;
    }
756458
public function index(string $indexName = null)
    {
        $this->indexName = $indexName ?? $this->tableName . '_' . $this->name . '_index';

        return $this;
    }
867251
public static function hasTable($tableName)
    {
        // Cache the list of all table names to reduce on DB traffic
        if (empty(self::$_cache_all_tables) && DB::is_active()) {
            self::$_cache_all_tables = DB::get_schema()->tableList();
        }
        return !empty(self::$_cache_all_tables[strtolower($tableName)]);
    }
809956
public function isFieldIndexed($fieldName)
    {
        $indexes = $this->getIndexInfo();
        foreach ($indexes as $index) {
            if (isset($index['key']) && isset($index['key'][$fieldName])) {
                return true;
            }
        }
        return false;
    }