Function inserts the line into table with $tableName
@param string $tableName 'whitelist' or 'greylist'
@param string $entityId
@param string $reason
548622
public static function insertTolist($tableName, $entityId, $reason)
    {
        $databaseConnector = new DatabaseConnector();
        $conn = $databaseConnector->getConnection();
        $whiteListTableName = $databaseConnector->getWhiteListTableName();
        $greyListTableName = $databaseConnector->getGreyListTableName();
        $table = null;
        assert($conn != null);

        if ($tableName == self::WHITELIST) {
            $table = $whiteListTableName;
        } elseif ($tableName == self::GREYLIST) {
            $table = $greyListTableName;
        }

        $stmt = $conn->prepare("INSERT INTO " . $table . " (entityId, reason) VALUES (?, ?)");

        if ($stmt) {
            $stmt->bind_param("ss", $entityId, $reason);
            $ex = $stmt->execute();
            if ($ex === false) {
                Logger::error("Error during inserting entityId " . $entityId . " into " . $table);
            }

            Logger::debug("EntityId " . $entityId . " was inserted into " . $table);
            $stmt->close();
        } else {
            Logger::error("Error during preparing statement");
        }

        $conn->close();
    }
688298
public function insert($storageName, $key, array $data)
    {
        try {
            $this->conn->insert($this->table, [
                $this->keyColumn  => $key,
                $this->dataColumn => serialize($data),
            ]);
        } catch (\Exception $e) {
        }
    }
882733
public String generateSqlInsert(String tableName) {
        try {
            return cacheSQLs.get("INSERT:" + tableName, () -> {
                return MessageFormat.format("INSERT INTO {0} ({1}) VALUES ({2})", tableName,
                        strAllColumns, StringUtils.repeat("?", ",", getAllColumns().length));
            });
        } catch (ExecutionException e) {
            throw new DaoException(e);
        }
    }
739095
public function createNode($tagName, $entityName = null)
    {
        if ($tagName instanceof Element) {
            $this->push($tagName);
        } else {
            $this->push(new Element($tagName, $entityName));
        }

        return $this->last();
    }
148513
protected function createTable($tableName, $table) {
		$res = "\$this->schema->create('$tableName', function(\$table) {";

		foreach($table->getColumns() as $colName=>$col)
			$res .= $this->createColumn($colName, $col);

		foreach($table->getIndexes() as $index)
			$res .= $this->createIndex($index);

		foreach($table->getForeignKeys() as $key)
			$res .= $this->createForeignKey($key);

		$res .= "\n});\n\n";

		return $res;
	}
200541
private function prepareSelectQueryFromArguments($table_name, $fields, $conditions = null, $order_by_fields = null)
    {
        if (empty($table_name)) {
            throw new InvalidArgumentException('Table name is required');
        }

        $escaped_field_names = empty($fields) ? '*' : implode(',', array_map(function ($field_name) {
            return $this->escapeFieldName($field_name);
        }, (array) $fields));

        if ($conditions) {
            $where = 'WHERE ' . $this->prepareConditions($conditions);
        } else {
            $where = '';
        }

        $escaped_order_by_field_names = '';

        if (!empty($order_by_fields)) {
            $escaped_order_by_field_names = implode(',', array_map(function ($field_name) {
                return $this->escapeFieldName($field_name);
            }, (array) $order_by_fields));
        }

        $order_by = $escaped_order_by_field_names ? "ORDER BY $escaped_order_by_field_names" : '';

        return trim("SELECT $escaped_field_names FROM {$this->escapeTableName($table_name)} $where $order_by");
    }
1296765
private function createTable($entityName)
    {
        $prefix        = '';
        $schemaManager = $this->repositoryFactory->getSchemaManager();

        if ($schemaManager !== null) {
            $meta      = $this->entityDefinitions[$entityName];
            $tableName = $prefix . $meta->storage['table'];
            $table     = new Table($tableName);

            foreach ($meta->fields as $field) {
                // @todo add proper type handling
                $type = 'string';

                if (in_array($field->type, ['int', 'integer', 'id'])) {
                    $type = 'integer';
                }

                $table->addColumn($field->columnName($field->name), $type, ['notNull' => false]);
            }

            $primary = explode(',', $meta->primary);
            $table->setPrimaryKey($primary);

            $schemaManager->dropAndCreateTable($table);
        }
    }
47605
public function lastInsertId($tableName = null, $primaryKey = null)
    {
        $this->_connect();

         if ($tableName !== null) {
            $sequenceName = $tableName;
            if ($primaryKey) {
                $sequenceName .= "_$primaryKey";
            }
            $sequenceName .= '_seq';
            return $this->lastSequenceId($sequenceName);
        }

        $id = $this->getConnection()->lastInsertId();

        return $id;
    }
1371269
protected function insertRow(AbstractEntity $entity)
    {
        $values  = $entity->getDbValues();
        $columns = array_keys($values);

        if ($this->autoIncrementColumn && ! array_key_exists($this->autoIncrementColumn, $values)) {
            throw new LogicException('auto_increment column ' . $this->autoIncrementColumn . ' not found');
        }

        $query = $this->getSqlObject()
            ->insert()
            ->columns($columns)
            ->values($values);

        $statement = $this->getSqlObject()->prepareStatementForSqlObject($query);
        $result    = $statement->execute();

        if ($this->autoIncrementColumn && ! $values[$this->autoIncrementColumn]) {
            $entity->exchangeArray([
                $this->autoIncrementColumn => $result->getGeneratedValue()
            ]);
        }
    }
869825
protected function insertEvent(StreamName $streamName, DomainEvent $e)
    {
        $eventData = array(
            'event_id' => $e->uuid()->toString(),
            'version' => $e->version(),
            'event_name' => $e->messageName(),
            'event_class' => get_class($e),
            'payload' => Serializer::serialize($e->payload(), $this->serializerAdapter),
            'created_at' => $e->createdAt()->format(\DateTime::ISO8601)
        );

        foreach ($e->metadata() as $key => $value) {
            $eventData[$key] = (string)$value;
        }

        $tableGateway = $this->getTablegateway($streamName);

        $tableGateway->insert($eventData);
    }
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);
    }
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
        );
    }
380512
public function insert($tableName, array $data) 
    {
        $this->count++;
        try {
            return $this->persistence->insert($tableName, $data);
        } catch (\PDOException $e) {
            \common_Logger::w('Failed insertion on table : '.$tableName);
            throw $e;
        }
    }
422837
public function processInsert(DatabaseLayer\Insert $thing)
    {
        // SELECTORS
        if (count($thing->getTables()) > 1) {
            throw new Exception("Active Record Cannot insert into more than one table at a time!");
        }
        $tables = $thing->getTables();
        $table = end($tables);

        $updates = array();
        foreach ($thing->getData() as $key => $value) {
            $key = trim($key, "`");
            if (is_object($value) || is_array($value)) {
                $value = JsonPrettyPrinter::Json($value);
            }
            $value_slashed = addslashes($value);
            if ($value === null) {
                $updates[] = "`$key` = NULL";
            } else {
                $updates[] = "`$key` = \"$value_slashed\"";
            }
        }
        $selector = "INSERT INTO {$table->getName()} ";
        $data = "SET " . implode(", ", $updates);

        $query = "{$selector}\n{$data}";

        $this->query($query);

        $insertId = $this->lastInsertId();

        return $insertId;
    }
559809
public function updateNode($con, $insertId, $tableName = null)
    {
        $this->validate(['con' => $con, 'tableName' => $tableName, 'insertId' => $insertId]);
        
        if ($this->queryChanged) {
            $query = $this->selectQuery." WHERE ".$this->idColumn." = ". $insertId;
        } else {
            $query = $this->selectQuery.$tableName." WHERE ".$this->idColumn." = ". $insertId;
        }
        
        $data = $this->con->getData($con, $query);
        
        $params = [
            'index' => $this->client->getIndex(),
            'type'  => $this->client->getType(),
            'id'    => $data[0][$this->idColumn],
            'body'  => ['doc' => $data[0]]
        ];
        
        $responses = $this->client->getClient()->update($params);
        return $responses['result'];
    }
1321993
protected static function checkColumn($tableName, $columnName, $con=NULL)
    {
        $connection = self::checkConnection($con);

            $result = $connection->prepare("SELECT {$columnName} FROM {$tableName}");
            $result->execute();
            if (! $result->columnCount())
            {
                throw new ColumnNotExistExeption();
            }
            return $columnName;
    }
1250494
public function create($entityId, array $entityValues = [], $description = null, array $lookups = [Entity::LOOKUP_KEYWORDS])
    {
        $data = [
            'id' => $entityId,
            'values' => $entityValues,
            'doc' => $description,
            'lookups' => $lookups,
        ];

        $response = $this->client->post('/entities', $data);

        return $this->decodeResponse($response);
    }