@param string $tableName

@return integer
554123
public function getNextId(string $tableName)
    {
        if (!array_key_exists($tableName, $this->primaryIds)) {
            $this->primaryIds[$tableName] = 1;
        } else {
            $this->primaryIds[$tableName]++;
        }

        return $this->primaryIds[$tableName];
    }
37418
public function getColumns(string $tableName): array
    {
        $sql = 'SELECT
            column_name,
            column_default,
            is_nullable,
            data_type,
            character_maximum_length,
            character_octet_length,
            numeric_precision,
            numeric_scale,
            character_set_name,
            collation_name,
            column_type,
            column_key,
            extra,
            `privileges`,
            column_comment
            FROM information_schema.columns
            WHERE table_schema = %s
            AND table_name = %s;';

        [$dbName, $tableName] = $this->parseTableName($tableName);
        $sql = sprintf($sql, $dbName, $tableName);

        $result = $this->db->query($sql)->fetchAll(PDO::FETCH_ASSOC);

        return $result ?: [];
    }
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;
    }
474123
public function listTableForeignKeys(string $tableName) : array
    {
        $tableName = $this->tableMaybeInvalid($tableName);
        return $this->getSchemaManager()->listTableForeignKeys($tableName);
    }
1183717
public function count($tableName, $condition = '') {
		if ($condition != '')
			$condition = " WHERE " . $condition;
		return $this->query ( "SELECT COUNT(*) FROM " . $tableName . $condition )->fetchColumn ();
	}
973299
public function getTableColumns($tableName)
    {
        $db = $this->getDb();

        $allColumns = $db->fetchAll("SHOW COLUMNS FROM " . $tableName);

        $fields = array();
        foreach ($allColumns as $column) {
            $fields[trim($column['Field'])] = $column;
        }

        return $fields;
    }
649429
protected static function checkTableName($tableName, $con=NULL)
    {
        $connection = self::checkConnection($con);

        $query = $connection->query("SELECT 1 FROM {$tableName} LIMIT 1");
        if($query !== false)
        {
            return $tableName;
        }
        throw new TableDoesNotExistException();
    }
722751
public function cuGetFieldInfo($tableName, $fieldName)
    {

        /** @noinspection SqlNoDataSourceInspection */
        $query  = 'SELECT `%s` FROM `%s`;';
        $query  = sprintf($query, $fieldName, $tableName);
        $result = $this->query($query);

        return $result->fetch_field_direct(0);
    }
843596
public function getIndices($tableName)
    {
        $result = [];

        if ($this->tableExists($tableName)) {
            $result = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC)->getAll("SHOW INDEX FROM $tableName");
        }

        return $result;
    }
91476
public function getPrimaryKey($tableName)
    {
        $indexes = $this->query("EXEC sp_helpindex '$tableName';");
        $indexName = '';
        foreach ($indexes as $index) {
            if ($index['index_keys'] == 'ID') {
                $indexName = $index['index_name'];
                break;
            }
        }

        return $indexName;
    }
372780
public function getColumnStmt($tableName)
    {
        $colStmt = array();
        foreach ($this->tableColumnTypes[$tableName] as $colName => $colType) {
            if ($colType['type'] == 'bit' && $this->dumpSettings['hex-blob']) {
                $colStmt[] = "LPAD(HEX(`${colName}`),2,'0') AS `${colName}`";
            } elseif ($colType['is_blob'] && $this->dumpSettings['hex-blob']) {
                $colStmt[] = "HEX(`${colName}`) AS `${colName}`";
            } elseif ($colType['is_virtual']) {
                $this->dumpSettings['complete-insert'] = true;
                continue;
            } else {
                $colStmt[] = "`${colName}`";
            }
        }

        return $colStmt;
    }
1082482
protected function getModelName($tableName)
    {
        $modelName = ResourceMapper::pluckFirst($tableName, 'table-name', 'model-name');

        return $modelName ?: $this->makeModelName($tableName);
    }
113828
protected function getIndexes($tableName): array
    {
        $sql = sprintf('SHOW INDEX FROM %s', $this->ident($tableName));
        $rows = $this->queryFetchAll($sql);
        $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;
    }
1353348
protected function getIndexes($tableName)
    {
        $indexes = [];
        $rows = $this->fetchAll(sprintf('SHOW INDEXES FROM %s', $this->quoteTableName($tableName)));
        foreach ($rows as $row) {
            if (!isset($indexes[$row['Key_name']])) {
                $indexes[$row['Key_name']] = ['columns' => []];
            }
            $indexes[$row['Key_name']]['columns'][] = strtolower($row['Column_name']);
        }

        return $indexes;
    }
1136023
public function getTable($tableName)
    {
        $table = new Table($tableName);

        $columns = $this->_getColumns($tableName);
        foreach ($columns as $col) {
            $table->addColumn($this->_createColumn($col));
        }

        $constraints = $this->_getConstraints($tableName);
        foreach ($constraints as $constraint) {
            $object = $this->_createConstraint($constraint);
            if ($object) {
                $table->addConstraint($object);
            }
        }

        return $table;
    }
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;
    }
296988
public function delete($tableName)
    {
        $sql = new Delete($tableName);
        $sql->setAdapter($this->_adapter);
        return $sql;
    }