Skip to content

Instantly share code, notes, and snippets.

@mutyonok
Created March 31, 2016 13:38
Show Gist options
  • Save mutyonok/6eb585a11af7e95e269d73de75017a88 to your computer and use it in GitHub Desktop.
Save mutyonok/6eb585a11af7e95e269d73de75017a88 to your computer and use it in GitHub Desktop.
public function batchInsert($table, $columns, $rows)
{
$quotedTable = $this->db->quoteSql($table);
$quotedColumns = [];
foreach ($columns as $column) {
$quotedColumns[] = $this->db->quoteSql($column);
}
$sql = $this->db->getQueryBuilder()->batchInsert($quotedTable, $quotedColumns, $rows);
$this->setSql($sql); //but do not quote this SQL as it was already quoted
return $this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment