What's Changed
Adds multirow insert method by @NeedleInAJayStack in #153
This adds functionality to do a multi-row inserts with a single
values
method call.Previously, to insert multiple rows a user had to call
values
repeatedly:db.insert(into: "planets") .columns(["name", "color"]) .values([SQLBind("Jupiter"), SQLBind("orange")]) .values([SQLBind("Mars"), SQLBind("red")]) .run()This was a bit awkward when inserting rows from an array, where an instance of the builder had to be saved off and edited:
let rows: [[SQLExpression]] = [[...], [...], ...] let builder = db.insert(into: "planets") .columns(["name", "color"]) for row in rows { builder.values(row) } builder.run()db.insert(into: "planets") .columns(["name", "color"]) .values([[SQLBind("Jupiter"), SQLBind("orange")], [SQLBind("Mars"), SQLBind("red")]]) .run() let rows = [[...], [...], ...] db.insert(into: "planets") .columns(["name", "color"]) .values(rows) .run()…
This patch was released by @gwynne
Full Changelog: 3.31.1...3.32.0