Adds rows

@param string $tableName
@return string
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);
    }
15191
protected function addTableRow($tagName, $row)
	{
		$this->pos = $row['pos'];
		foreach (explode('|', $row['line']) as $i => $str)
		{
			if ($i > 0)
			{
				$this->createIgnoreTag($this->pos, 1);
				++$this->pos;
			}

			$align = (empty($this->table['cols'][$i])) ? '' : $this->table['cols'][$i];
			$this->addTableCell($tagName, $align, $str);
		}

		$this->createRowTags($row['pos'], $this->pos);
	}
512817
protected function rowspanGetRowNames($rowName, $rowspan) {
    $rowIndex = $this->rows[$rowName];
    $rowNames = array();
    for ($i = 0; $i < $rowspan; ++$i) {
      $rowNames[$i + $rowIndex] = $this->rowNames[$i + $rowIndex];
    }
    return $rowNames;
  }
393916
public function insertOrUpdate($tableName, array $data)
    {
        $this->executeQuery("SET SESSION sql_mode='ALLOW_INVALID_DATES'", []);

        $columns = array_map(
            array($this, 'getQuotedName'),
            array_keys($data)
        );
        $updateAssignments = $this->getAssignmentsFor($data);
        return sprintf(
            "INSERT INTO %s (%s) VALUES (%s) ON DUPLICATE KEY UPDATE %s",
            $this->getQuotedName($tableName),
            implode(', ', $columns),
            implode(', ', array_fill(0, count($data), '?')),
            $updateAssignments
        );
    }
1213177
public function update($tableName)
    {
        $sql = new Update($tableName);
        $sql->setAdapter($this->_adapter);
        return $sql;
    }
345047
public function insertRecord($tableName, array $data) {
	
		$data = array_change_key_case($data, CASE_LOWER);
	
		if(!$this->tableStructureCache || !array_key_exists($tableName, $this->tableStructureCache) || empty($this->tableStructureCache[$tableName])) {
			$this->fillTableStructureCache($tableName);
		}
	
		if(!array_key_exists($tableName, $this->tableStructureCache)) {
			throw new \PDOException(sprintf("Table '%s' not found.", $tableName));
		}
	
		$attributes = array_keys($this->tableStructureCache[$tableName]);
		$columns = $this->tableStructureCache[$tableName];
	
		$names = [];
		$values = [];
	
		foreach($attributes as $attribute) {
	
			if (array_key_exists($attribute, $data)) {
				$names[]	= $columns[$attribute]['columnName'];
				$values[]	= $data[$attribute];
			}
	
		}
	
		// nothing to do
	
		if(!count($names)) {
			return null;
		}
	
		$valuePlaceholders = implode(', ', array_fill(0, count($values), '?'));
	
		// append create timestamp when applicable
	
		if(
			in_array(static::CREATE_FIELD, $attributes) &&
			!in_array(static::CREATE_FIELD, array_keys($data))
		) {
					
			// for compatibility purposes get the real column name
				
			$names[] = $columns[static::CREATE_FIELD]['columnName'];
			$valuePlaceholders .= ', NOW()';
		}

		// prime and execute statement

        if(
            $this->primeQuery(
				sprintf("
                        INSERT INTO
                            %s
                        (%s%s%s)
                        VALUES
                        (%s)
                        ",
                    static::QUOTE_CHAR . $tableName . static::QUOTE_CHAR,
                    static::QUOTE_CHAR, implode(static::QUOTE_CHAR . ', ' . static::QUOTE_CHAR, $names), static::QUOTE_CHAR,
                    $valuePlaceholders
                ),
                $values
    		)->execute()
		) {
			return $this->connection->lastInsertId();
		}

		throw new \PDOException(vsprintf('ERROR: %s, %s, %s', $this->statement->errorInfo()));
	
	}
824295
public function table($tableName)
    {
        return new Table(
            $this->dbManager,
            $this->connectionName,
            $tableName,
            $this->getStructure($this->connectionName)
        );
    }
672724
public function addTable($rows, $headers = false)
	{
		// Figure out some items we need to know
		$maxLengths = [];

		foreach ($rows as $i => $row)
		{
			foreach ($row as $k => $field)
			{
				$maxLengths[$k] = isset($maxLengths[$k]) ? $maxLengths[$k] : 0;
				$maxLengths[$k] = strlen($field) > $maxLengths[$k] ? strlen($field) : $maxLengths[$k];
			}
		}

		// Compute the total length of the table
		$width = array_sum($maxLengths) + ((count($row) - 1) * 3) + 2;

		// Add the top border
		$this->addLine('/' . str_repeat('-', ($width)) . '\\');

		// Draw the rows
		foreach ($rows as $i => $row)
		{
			$styles = ($i == 0 && $headers) ? ['format' => 'underline'] : null;
			foreach ($row as $k => $field)
			{
				$padding = $maxLengths[$k] - strlen($field);
				$this->addString('| ');
				$this->addString($field, $styles);
				$this->addString(' ' . str_repeat(' ', $padding));
			}

			$this->addLine('|');
		}

		// Add the bottom border
		$this->addLine('\\' . str_repeat('-', ($width)) . '/');
	}
645807
public function getFields($tableName) {
        $this->initConnect(true);
        list($tableName) = explode(' ', $tableName);
        if(strpos($tableName,'.')){
        	list($dbName,$tableName) = explode('.',$tableName);
			$sql   = 'SHOW COLUMNS FROM `'.$dbName.'`.`'.$tableName.'`';
        }else{
        	$sql   = 'SHOW COLUMNS FROM `'.$tableName.'`';
        }
        
        $result = $this->query($sql);
        $info   =   array();
        if($result) {
            foreach ($result as $key => $val) {
				if(\PDO::CASE_LOWER != $this->_linkID->getAttribute(\PDO::ATTR_CASE)){
					$val = array_change_key_case ( $val ,  CASE_LOWER );
				}
                $info[$val['field']] = array(
                    '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 $info;
    }
1220968
public function add(string $name, Table $table)
    {
        $this->tables[$name] = $table;

        return $this;
    }
104910
protected function getIndexes($tableName)
    {
        $parts = $this->getSchemaName($tableName);

        $indexes = [];
        $sql = sprintf(
            "SELECT
                i.relname AS index_name,
                a.attname AS column_name
            FROM
                pg_class t,
                pg_class i,
                pg_index ix,
                pg_attribute a,
                pg_namespace nsp
            WHERE
                t.oid = ix.indrelid
                AND i.oid = ix.indexrelid
                AND a.attrelid = t.oid
                AND a.attnum = ANY(ix.indkey)
                AND t.relnamespace = nsp.oid
                AND nsp.nspname = %s
                AND t.relkind = 'r'
                AND t.relname = %s
            ORDER BY
                t.relname,
                i.relname",
            $this->getConnection()->quote($parts['schema']),
            $this->getConnection()->quote($parts['table'])
        );
        $rows = $this->fetchAll($sql);
        foreach ($rows as $row) {
            if (!isset($indexes[$row['index_name']])) {
                $indexes[$row['index_name']] = ['columns' => []];
            }
            $indexes[$row['index_name']]['columns'][] = $row['column_name'];
        }

        return $indexes;
    }
867144
public function addRow($rows = null) {
        if( ! is_array($rows) ) {
            $rows = func_get_args();
        }
        $row = new TableRow;
        foreach( $rows as $arg ) {
            $cell = new TableCell;
            $cell->addChild( $arg );
            $row->addChild( $cell );
        }
        $this->addChild($row);
        return $row;
    }
945246
private function getAddedColumns($tableName, TableDiff $diff)
    {
        /** @var $col \Doctrine\DBAL\Schema\Column */
        foreach ($diff->addedColumns as $col) {
            $this->addMessage($tableName, sprintf('missing column `%s`', $col->getName()));
        }
    }
1226899
private function getTableColumns (string $tableName)
    {
        $columns = DB::getSchemaBuilder ()->getColumnListing ($tableName);

        if (!count ($columns))
            $this->abort ("Table not found: " . $tableName);
        else
            $columns = DB::select (DB::raw ('SHOW COLUMNS FROM ' . $tableName));


        return $columns;
    }
42268
public function createAlias(string $tableName): string
    {
        $alias                          = $tableName . (++$this->aliasIdCounter);
        $this->knownAliases[$tableName] = $alias;

        return $alias;
    }
773418
public function addRowName($rowName) {
    if (isset($this->rows[$rowName])) {
      throw new \Exception("Row '$rowName' already exists.");
    }
    $this->rowNames[] = $rowName;
    $this->rows[$rowName] = $this->iRow++;
    return $this;
  }
1190549
public function listTableDetails($tableName)
    {
        $columns     = $this->listTableColumns($tableName);
        $foreignKeys = [];
        if ($this->_platform->supportsForeignKeyConstraints()) {
            $foreignKeys = $this->listTableForeignKeys($tableName);
        }
        $indexes = $this->listTableIndexes($tableName);

        return new Table($tableName, $columns, $indexes, $foreignKeys);
    }