db\pgsql\QueryBuilder batchInsert()

batchInsert() public method

Generates a batch INSERT SQL statement.

For example,

$sql = $queryBuilder->batchInsert('user', ['name', 'age'], [
    ['Tom', 30],
    ['Jane', 20],
    ['Linda', 25],
]);

Note that the values in each row must match the corresponding column names.

The method will properly escape the column names, and quote the values to be inserted.

public string batchInsert ( $table, $columns, $rows )
$table string

The table that new rows will be inserted into.

$columns array

The column names

$rows array

The rows to be batch inserted into the table

return string

The batch INSERT SQL statement

doc_Yii
2016-10-30 16:58:44
Comments
Leave a Comment

Please login to continue.