Adds rows

@param string $tableName
@return string
431971
public function handle(string $tableName)
    {
        /** @var RecordFinder $recordFinder */
        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);

        // tx_styleguide_staticdata is used in other TCA demo fields. We need some default
        // rows to later connect other fields to these rows.
        $pid = $recordFinder->findPidOfMainTableRecord('tx_styleguide_staticdata');
        $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tx_styleguide_staticdata');
        $connection->bulkInsert(
            'tx_styleguide_staticdata',
            [
                [ $pid, 'foo' ],
                [ $pid, 'bar' ],
                [ $pid, 'foofoo' ],
                [ $pid, 'foobar' ],
            ],
            [ 'pid', 'value_1' ]
        );
    }
480365
public function cuGetColNamesFromTable($tableName)
    {

        $sql        = 'DESCRIBE ' . $tableName;
        $result     = $this->query($sql);
        $field_name = [];
        $data_array = [];
        while ($data = $result->fetch_assoc()) {
            $data_array[] = $data;
        }

        foreach ($data_array as $val) {
            $field_name[] = $val['Field'];
        }

        return $field_name;
    }
4459
public function addRows($data)
    {
        foreach ($data as $key => $row) {
            $this->addRow($row, isset($row['id']) ? $row['id'] : $key);
        }

        return $this;
    }
252847
function &addCell($name = null) {
        if (!$name) {
            $name = uniqid(microtime(true), true);
        }
        $this->cells[$name] = new TableRowCell();
        return $this->cells[$name];
    }
798708
public function getTableColumns($tableName): array
    {
        $schema  = $this->getSchema();
        $columns = $schema->listTableColumns($tableName);

        return $columns;
    }
567652
public function createInserts(string $tableName, array $fields, array $rows): string
    {
        $sql = "INSERT " . "INTO {$tableName} (" . implode(',', $fields) . ') VALUES ';
        foreach ($rows as $row) {
            $sql .= '(' . implode(',', $row) . '),';
        }
        return trim($sql, ',');
    }
1146086
public function addRow(array $row)
    {
        if (is_array($this->fields)) {
            $assoc = $row;
            $row = [];
            foreach ($this->fields as $field) {
                $row[] = isset($assoc[$field]) ? $assoc[$field] : "";
            }
        }

        $this->data[] = $row;

        return $this;
    }
232944
public function insert($tableName, array $data){
        $cleanColumns = array();
        foreach ($data as $columnName => $value) {
            $cleanColumns[$this->getPlatForm()->quoteIdentifier($columnName)] = $value;
        }
        return $this->connection->insert($tableName, $cleanColumns);
    }
474123
public function listTableForeignKeys(string $tableName) : array
    {
        $tableName = $this->tableMaybeInvalid($tableName);
        return $this->getSchemaManager()->listTableForeignKeys($tableName);
    }
301840
public function getTableColumnList($tableName) {

        if (!array_key_exists($tableName, $this->tableList)) {

            $this->addColumnMap($tableName, $this->getColumnMappingsFromConfig($tableName));
        }

        return $this->tableList[$tableName];
    }
294862
public function getFields($tableName)
    {
        list($tableName) = explode(' ', $tableName);

        if (false === strpos($tableName, '`')) {
            if (strpos($tableName, '.')) {
                $tableName = str_replace('.', '`.`', $tableName);
            }
            $tableName = '`' . $tableName . '`';
        }

        $sql    = 'SHOW COLUMNS FROM ' . $tableName;
        $pdo    = $this->query($sql, [], false, true);
        $result = $pdo->fetchAll(PDO::FETCH_ASSOC);
        $info   = [];

        if ($result) {
            foreach ($result as $key => $val) {
                $val                 = array_change_key_case($val);
                $info[$val['field']] = [
                    'name'    => $val['field'],
                    'type'    => $val['type'],
                    'notnull' => (bool) ('' === $val['null']), // not null is empty, null is yes
                    'default' => $val['default'],
                    'primary' => (strtolower($val['key']) == 'pri'),
                    'autoinc' => (strtolower($val['extra']) == 'auto_increment'),
                ];
            }
        }

        return $this->fieldCase($info);
    }
1127845
public function getTable($tableName)
    {
        if (is_array($tableName)) {
            list($tableName, $entitySuffix) = $tableName;
        } else {
            $entitySuffix = null;
        }

        if ($entitySuffix !== null) {
            $tableName .= '_' . $entitySuffix;
        }

        if (!isset($this->_tables[$tableName])) {
            $this->_tables[$tableName] = $this->_resources->getTableName(
                $tableName,
                ResourceConnection::DEFAULT_CONNECTION
            );
        }

        return $this->_tables[$tableName];
    }
501964
public function handle(string $tableName)
    {
        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);
        $recordData = GeneralUtility::makeInstance(RecordData::class);

        // First insert an empty row and get the uid of this row since
        // some fields need this uid for relations later.
        $fieldValues = [
            'pid' => $recordFinder->findPidOfMainTableRecord($tableName),
        ];
        $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($tableName);
        $connection->insert($tableName, $fieldValues);
        $fieldValues['uid'] = $connection->lastInsertId($tableName);
        $fieldValues = $recordData->generate($tableName, $fieldValues);
        $connection->update(
            $tableName,
            $fieldValues,
            [ 'uid' => $fieldValues['uid'] ]
        );

        $this->generateTranslatedRecords($tableName, $fieldValues);
    }
772348
protected function _getColumns($tableName)
    {

        $params = [
            ':schemaName' => $this->_adapter->getSchemaName(),
            ':tableName' => $tableName
        ];
        return $this->_adapter->query($this->_getColumnsSql, $params);
    }
202383
public function getRowCount($tableName)
    {
        $result = $this->store->queryDB(
            'SELECT COUNT(*) as count FROM '.$tableName,
            $this->store->getDBCon()
        );
        $row = $result->fetch_assoc();

        return $row['count'];
    }
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;
    }
382669
public function createTable($tableName)
    {
        $table = new Table($tableName);
        $this->_addTable($table);

        foreach ($this->_schemaConfig->getDefaultTableOptions() as $name => $value) {
            $table->addOption($name, $value);
        }

        return $table;
    }