class Connection extends Connection

A wrapper around a Doctrine\DBAL\Driver\Connection that adds features like REPLACE and INSERT IGNORE

Methods

integer
replace(string $tableExpression, array $data, array $types = array())

Inserts a table row with specified data.

integer
insertIgnore(string $tableExpression, array $data, array $types = array())

Inserts a table row with specified data.

Details

at line 22
integer replace(string $tableExpression, array $data, array $types = array())

Inserts a table row with specified data.

REPLACE works exactly like INSERT, except that if an old row in the table has the same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row is deleted before the new row is inserted.

Table expression and columns are not escaped and are not safe for user-input.

Parameters

string $tableExpression The expression of the table to insert data into, quoted or unquoted.
array $data An associative array containing column-value pairs.
array $types Types of the inserted data.

Return Value

integer The number of affected rows.

at line 50
integer insertIgnore(string $tableExpression, array $data, array $types = array())

Inserts a table row with specified data.

Errors that occur while executing the INSERT statement are ignored. For example, without IGNORE, a row that duplicates an existing UNIQUE index or PRIMARY KEY value in the table causes a duplicate-key error and the statement is aborted. With IGNORE, the row is discarded and no error occurs. Ignored errors generate warnings instead

Table expression and columns are not escaped and are not safe for user-input.

Parameters

string $tableExpression The expression of the table to insert data into, quoted or unquoted.
array $data An associative array containing column-value pairs.
array $types Types of the inserted data.

Return Value

integer The number of affected rows.