‪TYPO3CMS  10.4
TYPO3\CMS\Core\Database\Query\BulkInsertQuery Class Reference

Public Member Functions

 __construct (Connection $connection, string $table, array $columns=[])
 
string __toString ()
 
 addValues (array $values, array $types=[])
 
int execute ()
 
array getParameters ()
 
array getParameterTypes ()
 
string getSQL ()
 

Protected Member Functions

int getInsertMaxRows ()
 

Protected Attributes

string[] $columns
 
Connection $connection
 
string $table
 
array $parameters = array( )
 
array $types = array( )
 
array $values = array( )
 

Detailed Description

Provides functionality to generate and execute row based bulk INSERT statements.

Based on work by Steve Müller st.mu.nosp@m.elle.nosp@m.r@dzh.nosp@m.-onl.nosp@m.ine.d.nosp@m.e for the Doctrine project, licensed under the MIT license.

This class will be removed from core and the functionality will be provided by the upstream implementation once the pull request has been merged into Doctrine DBAL.

See also
https://github.com/doctrine/dbal/pull/682

Definition at line 34 of file BulkInsertQuery.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Database\Query\BulkInsertQuery::__construct ( Connection  $connection,
string  $table,
array  $columns = [] 
)

Constructor.

Parameters
Connection$connection‪The connection to use for query execution.
string$table‪The name of the table to insert rows into.
string[]$columns‪The names of the columns to insert values into. Can be left empty to allow arbitrary row inserts based on the table's column order.

Definition at line 68 of file BulkInsertQuery.php.

References TYPO3\CMS\Core\Database\Query\BulkInsertQuery\$columns, TYPO3\CMS\Core\Database\Query\BulkInsertQuery\$connection, TYPO3\CMS\Core\Database\Query\BulkInsertQuery\$table, and TYPO3\CMS\Core\Database\Connection\quoteIdentifier().

Member Function Documentation

◆ __toString()

string TYPO3\CMS\Core\Database\Query\BulkInsertQuery::__toString ( )

Render the bulk insert statement as string.

Returns
‪string

Definition at line 80 of file BulkInsertQuery.php.

References TYPO3\CMS\Core\Database\Query\BulkInsertQuery\getSQL().

◆ addValues()

TYPO3\CMS\Core\Database\Query\BulkInsertQuery::addValues ( array  $values,
array  $types = [] 
)

Adds a set of values to the bulk insert query to be inserted as a row into the specified table.

Parameters
array$values‪The set of values to be inserted as a row into the table. If no columns have been specified for insertion, this can be an arbitrary list of values to be inserted into the table. Otherwise the values' keys have to match either one of the specified column names or indexes.
array$types‪The types for the given values to bind to the query. If no columns have been specified for insertion, the types' keys will be matched against the given values' keys. Otherwise the types' keys will be matched against the specified column names and indexes. Non-matching keys will be discarded, missing keys will not be bound to a specific type.
Exceptions

Definition at line 108 of file BulkInsertQuery.php.

References TYPO3\CMS\Core\Database\Query\BulkInsertQuery\$types, and TYPO3\CMS\Core\Database\Query\BulkInsertQuery\$values.

◆ execute()

int TYPO3\CMS\Core\Database\Query\BulkInsertQuery::execute ( )

Executes this INSERT query using the bound parameters and their types.

Returns
‪int The number of affected rows.
Exceptions

Definition at line 181 of file BulkInsertQuery.php.

References TYPO3\CMS\Core\Database\Query\BulkInsertQuery\getInsertMaxRows(), and TYPO3\CMS\Core\Database\Query\BulkInsertQuery\getSQL().

◆ getInsertMaxRows()

int TYPO3\CMS\Core\Database\Query\BulkInsertQuery::getInsertMaxRows ( )
protected

Return the maximum number of rows that can be inserted at the same time.

Returns
‪int

Definition at line 205 of file BulkInsertQuery.php.

Referenced by TYPO3\CMS\Core\Database\Query\BulkInsertQuery\execute().

◆ getParameters()

array TYPO3\CMS\Core\Database\Query\BulkInsertQuery::getParameters ( )

Returns the parameters for this INSERT query being constructed indexed by parameter index.

Returns
‪array

Definition at line 220 of file BulkInsertQuery.php.

References TYPO3\CMS\Core\Database\Query\BulkInsertQuery\$parameters.

◆ getParameterTypes()

array TYPO3\CMS\Core\Database\Query\BulkInsertQuery::getParameterTypes ( )

Returns the parameter types for this INSERT query being constructed indexed by parameter index.

Returns
‪array

Definition at line 230 of file BulkInsertQuery.php.

References TYPO3\CMS\Core\Database\Query\BulkInsertQuery\$types.

◆ getSQL()

string TYPO3\CMS\Core\Database\Query\BulkInsertQuery::getSQL ( )

Member Data Documentation

◆ $columns

string [] TYPO3\CMS\Core\Database\Query\BulkInsertQuery::$columns
protected

◆ $connection

Connection TYPO3\CMS\Core\Database\Query\BulkInsertQuery::$connection
protected

◆ $parameters

array TYPO3\CMS\Core\Database\Query\BulkInsertQuery::$parameters = array( )
protected

◆ $table

string TYPO3\CMS\Core\Database\Query\BulkInsertQuery::$table
protected

◆ $types

array TYPO3\CMS\Core\Database\Query\BulkInsertQuery::$types = array( )
protected

◆ $values

array TYPO3\CMS\Core\Database\Query\BulkInsertQuery::$values = array( )
protected