@@ -238,8 +238,8 @@ public final class Database {
238238 /// failure.
239239 ///
240240 /// :returns: The COMMIT or ROLLBACK statement.
241- public func transaction( _ mode: TransactionMode = . Deferred, @noescape _ block: Statement -> TransactionResult ) -> Statement {
242- return run ( block ( transaction ( mode) ) . rawValue)
241+ public func transaction( _ mode: TransactionMode = . Deferred, @noescape _ block: ( txn : Statement ) -> TransactionResult ) -> Statement {
242+ return run ( block ( txn : transaction ( mode) ) . rawValue)
243243 }
244244
245245 /// Commits the current transaction (or, if a savepoint is open, releases
@@ -312,8 +312,8 @@ public final class Database {
312312 /// depending on success or failure.
313313 ///
314314 /// :returns: The RELEASE or ROLLBACK statement.
315- public func savepoint( _ savepointName: String ? = nil , @noescape _ block: Statement -> SavepointResult ) -> Statement {
316- switch block ( savepoint ( savepointName) ) {
315+ public func savepoint( _ savepointName: String ? = nil , @noescape _ block: ( txn : Statement ) -> SavepointResult ) -> Statement {
316+ switch block ( txn : savepoint ( savepointName) ) {
317317 case . Release:
318318 return release ( )
319319 case . Rollback:
@@ -376,10 +376,10 @@ public final class Database {
376376 /// number of times it’s been called for this lock. If it
377377 /// returns true, it will try again. If it returns false,
378378 /// no further attempts will be made.
379- public func busy( callback: ( Int -> Bool ) ? ) {
379+ public func busy( callback: ( ( tries : Int ) -> Bool ) ? ) {
380380 try {
381381 if let callback = callback {
382- self . busy = { callback ( Int ( $0) ) ? 1 : 0 }
382+ self . busy = { callback ( tries : Int ( $0) ) ? 1 : 0 }
383383 } else {
384384 self . busy = nil
385385 }
@@ -391,12 +391,12 @@ public final class Database {
391391 /// Sets a handler to call when a statement is executed with the compiled
392392 /// SQL.
393393 ///
394- /// :param: callback This block is executed as a statement is executed with
395- /// the compiled SQL as an argument. E.g., pass println to
396- /// act as a logger.
397- public func trace( callback: ( String -> ( ) ) ? ) {
394+ /// :param: callback This block is invoked when a statement is executed with
395+ /// the compiled SQL as its argument. E.g., pass ` println`
396+ /// to act as a logger.
397+ public func trace( callback: ( ( SQL : String ) -> ( ) ) ? ) {
398398 if let callback = callback {
399- trace = { callback ( String . fromCString ( $0) !) }
399+ trace = { callback ( SQL : String . fromCString ( $0) !) }
400400 } else {
401401 trace = nil
402402 }
@@ -421,7 +421,7 @@ public final class Database {
421421 /// called. The block is called with an array of raw
422422 /// SQL values mapped to the function's parameters and
423423 /// should return a raw SQL value (or nil).
424- public func create( #function: String, argc: Int = - 1 , deterministic: Bool = false, _ block: [ Binding? ] -> Binding? ) {
424+ public func create( #function: String, argc: Int = - 1 , deterministic: Bool = false, _ block: ( args : [ Binding ? ] ) -> Binding ? ) {
425425 try {
426426 if self . functions [ function] == nil { self . functions [ function] = [ : ] }
427427 self . functions [ function] ? [ argc] = { context, argc, argv in
@@ -444,7 +444,7 @@ public final class Database {
444444 assertionFailure ( " unsupported value type: \( type) " )
445445 }
446446 }
447- let result = block ( arguments)
447+ let result = block ( args : arguments)
448448 if let result = result as? Blob {
449449 sqlite3_result_blob ( context, result. bytes, Int32 ( result. length) , nil )
450450 } else if let result = result as? Double {
@@ -473,10 +473,10 @@ public final class Database {
473473 ///
474474 /// :param: block A collation function that takes two strings and
475475 /// returns the comparison result.
476- public func create( #collation: String, _ block: ( String, String) -> ComparisonResult ) {
476+ public func create( #collation: String, _ block: ( lhs : String , rhs : String ) -> ComparisonResult ) {
477477 try {
478478 self . collations [ collation] = { lhs, rhs in
479- return Int32 ( block ( String . fromCString ( lhs) !, String . fromCString ( rhs) !) . rawValue)
479+ return Int32 ( block ( lhs : String . fromCString ( lhs) !, rhs : String . fromCString ( rhs) !) . rawValue)
480480 }
481481 return SQLiteCreateCollation ( self . handle, collation, self . collations [ collation] )
482482 }
0 commit comments