Skip to content

Commit f4cb77e

Browse files
committed
Merge pull request stephencelis#45 from juliensagot/master
Add transaction method which takes an array of Statements as its unique parameter
2 parents 1af591a + e1ee5ca commit f4cb77e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

SQLite Common/Database.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,17 @@ public final class Database {
215215
public func transaction(statements: (@autoclosure () -> Statement)...) -> Statement {
216216
return transaction(.Deferred, statements)
217217
}
218+
219+
/// Runs a series of statements in a transaction. The first statement to
220+
/// fail will short-circuit the rest and roll back the changes. A successful
221+
/// transaction will automatically be committed.
222+
///
223+
/// :param: statements Statements array to run in the transaction.
224+
///
225+
/// :returns: The last statement executed, successful or not.
226+
public func transaction(statements: [@autoclosure () -> Statement]) -> Statement {
227+
return transaction(.Deferred, statements)
228+
}
218229

219230
/// Runs a series of statements in a transaction. The first statement to
220231
/// fail will short-circuit the rest and roll back the changes. A successful

0 commit comments

Comments
 (0)