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

Public Member Functions

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

Protected Attributes

string[] $columns
 
DoctrineConnection $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 35 of file BulkInsertQuery.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
DoctrineConnection$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 69 of file BulkInsertQuery.php.

References TYPO3\CMS\Core\Database\Query\BulkInsertQuery\$columns, TYPO3\CMS\Core\Database\Query\BulkInsertQuery\$connection, and TYPO3\CMS\Core\Database\Query\BulkInsertQuery\$table.

Member Function Documentation

◆ __toString()

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

Render the bulk insert statement as string.

Definition at line 79 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 107 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 180 of file BulkInsertQuery.php.

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

◆ getParameters()

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

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

Definition at line 188 of file BulkInsertQuery.php.

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

◆ getParameterTypes()

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

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

Definition at line 196 of file BulkInsertQuery.php.

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

◆ getSQL()

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

Member Data Documentation

◆ $columns

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

◆ $connection

DoctrineConnection 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