db\sqlite\QueryBuilder batchInsert()

batchInsert() public method

Generates a batch INSERT SQL statement.

For example,

$connection->createCommand()->batchInsert('user', ['name', 'age'], [
    ['Tom', 30],
    ['Jane', 20],
    ['Linda', 25],
])->execute();

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

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:59:53
Comments
Leave a Comment

Please login to continue.