You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Documentation/Index.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -902,6 +902,16 @@ db.transaction()
902
902
&& db.commit() || db.rollback()
903
903
```
904
904
905
+
The former statement can also be written as
906
+
``` swift
907
+
db.transaction { _in
908
+
for obj in objects {
909
+
stmt.run(obj.email)
910
+
}
911
+
return .Commit|| .Rollback
912
+
}
913
+
```
914
+
905
915
> _Note:_ Each statement is captured in an auto-closure and won’t execute till the preceding statement succeeds. This means we can use the `lastInsertRowid` property on `Database` to reference the previous statement’s insert [`ROWID`][ROWID].
0 commit comments