BulkInsertQuery
Provides functionality to generate and execute row based bulk INSERT statements.
Based on work by Steve Müller st.mueller@dzh-online.de 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.
Tags
Table of Contents
Properties
- $columns : array<string|int, string>
- $connection : Connection
- $parameters : array<string|int, mixed>
- $table : string
- $types : array<string|int, mixed>
- $values : array<string|int, mixed>
Methods
- __construct() : mixed
- Constructor.
- __toString() : string
- Render the bulk insert statement as string.
- addValues() : mixed
- Adds a set of values to the bulk insert query to be inserted as a row into the specified table.
- execute() : int
- Executes this INSERT query using the bound parameters and their types.
- getParameters() : array<string|int, mixed>
- Returns the parameters for this INSERT query being constructed indexed by parameter index.
- getParameterTypes() : array<string|int, mixed>
- Returns the parameter types for this INSERT query being constructed indexed by parameter index.
- getSQL() : string
- Returns the SQL formed by the current specifications of this INSERT query.
- getInsertMaxRows() : int
- Return the maximum number of rows that can be inserted at the same time.
Properties
$columns
protected
array<string|int, string>
$columns
$connection
protected
Connection
$connection
$parameters
protected
array<string|int, mixed>
$parameters
= []
$table
protected
string
$table
$types
protected
array<string|int, mixed>
$types
= []
$values
protected
array<string|int, mixed>
$values
= []
Methods
__construct()
Constructor.
public
__construct(Connection $connection, string $table[, array<string|int, string> $columns = [] ]) : mixed
Parameters
- $connection : Connection
-
The connection to use for query execution.
- $table : string
-
The name of the table to insert rows into.
- $columns : array<string|int, string> = []
-
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.
__toString()
Render the bulk insert statement as string.
public
__toString() : string
Return values
stringaddValues()
Adds a set of values to the bulk insert query to be inserted as a row into the specified table.
public
addValues(array<string|int, mixed> $values[, array<string|int, mixed> $types = [] ]) : mixed
Parameters
- $values : array<string|int, mixed>
-
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.
- $types : array<string|int, mixed> = []
-
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.
Tags
execute()
Executes this INSERT query using the bound parameters and their types.
public
execute() : int
Tags
Return values
int —The number of affected rows.
getParameters()
Returns the parameters for this INSERT query being constructed indexed by parameter index.
public
getParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>getParameterTypes()
Returns the parameter types for this INSERT query being constructed indexed by parameter index.
public
getParameterTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>getSQL()
Returns the SQL formed by the current specifications of this INSERT query.
public
getSQL() : string
Tags
Return values
stringgetInsertMaxRows()
Return the maximum number of rows that can be inserted at the same time.
protected
getInsertMaxRows() : int