mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-29 04:24:21 +00:00
Replace let _ = ... with _ = ...
This commit is contained in:
1 parent
20f3ab8e2c
commit
648dbf7e25
11 files changed
+90
-90
No files matched your search
@@ -101,7 +101,7 @@ public class Statement {
|
||||
/// Throws a DatabaseError of code SQLITE_ERROR if arguments don't fill all
|
||||
/// statement arguments.
|
||||
public func validateArguments(arguments: StatementArguments) throws {
|
||||
let _ = try validatedBindings(arguments)
|
||||
_ = try validatedBindings(arguments)
|
||||
}
|
||||
|
||||
/// Set arguments without any validation. Trades safety for performance.
|
||||
|
||||
@@ -101,7 +101,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
try! NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
}
|
||||
|
||||
let _ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
_ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
@@ -130,7 +130,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
try! NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
}
|
||||
|
||||
let _ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
_ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
@@ -149,7 +149,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
func insertRecords() {
|
||||
let databaseFileName = "GRDBPerformanceTests-\(NSProcessInfo.processInfo().globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent(databaseFileName)
|
||||
let _ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
_ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
defer {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
dbQueue.inDatabase { db in
|
||||
@@ -160,7 +160,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
try! NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
}
|
||||
|
||||
let _ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
_ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
|
||||
@@ -44,7 +44,7 @@ class GRDBTestCase: XCTestCase {
|
||||
|
||||
func sql<T>(request: FetchRequest<T>) -> String {
|
||||
return dbQueue.inDatabase { db in
|
||||
let _ = Row.fetchOne(db, request)
|
||||
_ = Row.fetchOne(db, request)
|
||||
return self.lastSQLQuery
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,16 +17,16 @@ class FetchNamedValuesTests: XCTestCase {
|
||||
dbQueue.inDatabase { db in
|
||||
if let rs = db.executeQuery("SELECT * FROM items", withArgumentsInArray: nil) {
|
||||
while rs.next() {
|
||||
let _ = rs.longForColumn("i0")
|
||||
let _ = rs.longForColumn("i1")
|
||||
let _ = rs.longForColumn("i2")
|
||||
let _ = rs.longForColumn("i3")
|
||||
let _ = rs.longForColumn("i4")
|
||||
let _ = rs.longForColumn("i5")
|
||||
let _ = rs.longForColumn("i6")
|
||||
let _ = rs.longForColumn("i7")
|
||||
let _ = rs.longForColumn("i8")
|
||||
let _ = rs.longForColumn("i9")
|
||||
_ = rs.longForColumn("i0")
|
||||
_ = rs.longForColumn("i1")
|
||||
_ = rs.longForColumn("i2")
|
||||
_ = rs.longForColumn("i3")
|
||||
_ = rs.longForColumn("i4")
|
||||
_ = rs.longForColumn("i5")
|
||||
_ = rs.longForColumn("i6")
|
||||
_ = rs.longForColumn("i7")
|
||||
_ = rs.longForColumn("i8")
|
||||
_ = rs.longForColumn("i9")
|
||||
|
||||
count += 1
|
||||
}
|
||||
@@ -46,16 +46,16 @@ class FetchNamedValuesTests: XCTestCase {
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
for row in Row.fetch(db, "SELECT * FROM items") {
|
||||
let _: Int = row.value(named: "i0")
|
||||
let _: Int = row.value(named: "i1")
|
||||
let _: Int = row.value(named: "i2")
|
||||
let _: Int = row.value(named: "i3")
|
||||
let _: Int = row.value(named: "i4")
|
||||
let _: Int = row.value(named: "i5")
|
||||
let _: Int = row.value(named: "i6")
|
||||
let _: Int = row.value(named: "i7")
|
||||
let _: Int = row.value(named: "i8")
|
||||
let _: Int = row.value(named: "i9")
|
||||
_ = row.value(named: "i0") as Int
|
||||
_ = row.value(named: "i1") as Int
|
||||
_ = row.value(named: "i2") as Int
|
||||
_ = row.value(named: "i3") as Int
|
||||
_ = row.value(named: "i4") as Int
|
||||
_ = row.value(named: "i5") as Int
|
||||
_ = row.value(named: "i6") as Int
|
||||
_ = row.value(named: "i7") as Int
|
||||
_ = row.value(named: "i8") as Int
|
||||
_ = row.value(named: "i9") as Int
|
||||
|
||||
count += 1
|
||||
}
|
||||
@@ -73,16 +73,16 @@ class FetchNamedValuesTests: XCTestCase {
|
||||
var count = 0
|
||||
|
||||
for item in try! db.prepare(itemsTable) {
|
||||
let _ = item[i0Column]
|
||||
let _ = item[i1Column]
|
||||
let _ = item[i2Column]
|
||||
let _ = item[i3Column]
|
||||
let _ = item[i4Column]
|
||||
let _ = item[i5Column]
|
||||
let _ = item[i6Column]
|
||||
let _ = item[i7Column]
|
||||
let _ = item[i8Column]
|
||||
let _ = item[i9Column]
|
||||
_ = item[i0Column]
|
||||
_ = item[i1Column]
|
||||
_ = item[i2Column]
|
||||
_ = item[i3Column]
|
||||
_ = item[i4Column]
|
||||
_ = item[i5Column]
|
||||
_ = item[i6Column]
|
||||
_ = item[i7Column]
|
||||
_ = item[i8Column]
|
||||
_ = item[i9Column]
|
||||
|
||||
count += 1
|
||||
}
|
||||
|
||||
@@ -22,16 +22,16 @@ class FetchPositionalValuesTests: XCTestCase {
|
||||
case 101 /*SQLITE_DONE*/:
|
||||
break loop
|
||||
case 100 /*SQLITE_ROW*/:
|
||||
let _ = sqlite3_column_int64(statement, 0)
|
||||
let _ = sqlite3_column_int64(statement, 1)
|
||||
let _ = sqlite3_column_int64(statement, 2)
|
||||
let _ = sqlite3_column_int64(statement, 3)
|
||||
let _ = sqlite3_column_int64(statement, 4)
|
||||
let _ = sqlite3_column_int64(statement, 5)
|
||||
let _ = sqlite3_column_int64(statement, 6)
|
||||
let _ = sqlite3_column_int64(statement, 7)
|
||||
let _ = sqlite3_column_int64(statement, 8)
|
||||
let _ = sqlite3_column_int64(statement, 9)
|
||||
_ = sqlite3_column_int64(statement, 0)
|
||||
_ = sqlite3_column_int64(statement, 1)
|
||||
_ = sqlite3_column_int64(statement, 2)
|
||||
_ = sqlite3_column_int64(statement, 3)
|
||||
_ = sqlite3_column_int64(statement, 4)
|
||||
_ = sqlite3_column_int64(statement, 5)
|
||||
_ = sqlite3_column_int64(statement, 6)
|
||||
_ = sqlite3_column_int64(statement, 7)
|
||||
_ = sqlite3_column_int64(statement, 8)
|
||||
_ = sqlite3_column_int64(statement, 9)
|
||||
break
|
||||
default:
|
||||
XCTFail()
|
||||
@@ -58,16 +58,16 @@ class FetchPositionalValuesTests: XCTestCase {
|
||||
dbQueue.inDatabase { db in
|
||||
if let rs = db.executeQuery("SELECT * FROM items", withArgumentsInArray: nil) {
|
||||
while rs.next() {
|
||||
let _ = rs.longForColumnIndex(0)
|
||||
let _ = rs.longForColumnIndex(1)
|
||||
let _ = rs.longForColumnIndex(2)
|
||||
let _ = rs.longForColumnIndex(3)
|
||||
let _ = rs.longForColumnIndex(4)
|
||||
let _ = rs.longForColumnIndex(5)
|
||||
let _ = rs.longForColumnIndex(6)
|
||||
let _ = rs.longForColumnIndex(7)
|
||||
let _ = rs.longForColumnIndex(8)
|
||||
let _ = rs.longForColumnIndex(9)
|
||||
_ = rs.longForColumnIndex(0)
|
||||
_ = rs.longForColumnIndex(1)
|
||||
_ = rs.longForColumnIndex(2)
|
||||
_ = rs.longForColumnIndex(3)
|
||||
_ = rs.longForColumnIndex(4)
|
||||
_ = rs.longForColumnIndex(5)
|
||||
_ = rs.longForColumnIndex(6)
|
||||
_ = rs.longForColumnIndex(7)
|
||||
_ = rs.longForColumnIndex(8)
|
||||
_ = rs.longForColumnIndex(9)
|
||||
|
||||
count += 1
|
||||
}
|
||||
@@ -87,16 +87,16 @@ class FetchPositionalValuesTests: XCTestCase {
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
for row in Row.fetch(db, "SELECT * FROM items") {
|
||||
let _: Int = row.value(atIndex: 0)
|
||||
let _: Int = row.value(atIndex: 1)
|
||||
let _: Int = row.value(atIndex: 2)
|
||||
let _: Int = row.value(atIndex: 3)
|
||||
let _: Int = row.value(atIndex: 4)
|
||||
let _: Int = row.value(atIndex: 5)
|
||||
let _: Int = row.value(atIndex: 6)
|
||||
let _: Int = row.value(atIndex: 7)
|
||||
let _: Int = row.value(atIndex: 8)
|
||||
let _: Int = row.value(atIndex: 9)
|
||||
_ = row.value(atIndex: 0) as Int
|
||||
_ = row.value(atIndex: 1) as Int
|
||||
_ = row.value(atIndex: 2) as Int
|
||||
_ = row.value(atIndex: 3) as Int
|
||||
_ = row.value(atIndex: 4) as Int
|
||||
_ = row.value(atIndex: 5) as Int
|
||||
_ = row.value(atIndex: 6) as Int
|
||||
_ = row.value(atIndex: 7) as Int
|
||||
_ = row.value(atIndex: 8) as Int
|
||||
_ = row.value(atIndex: 9) as Int
|
||||
|
||||
count += 1
|
||||
}
|
||||
@@ -115,16 +115,16 @@ class FetchPositionalValuesTests: XCTestCase {
|
||||
|
||||
for row in try! db.prepare("SELECT * FROM items") {
|
||||
// Direct Int extraction is not supported.
|
||||
let _ = Int(row[0] as! Int64)
|
||||
let _ = Int(row[1] as! Int64)
|
||||
let _ = Int(row[2] as! Int64)
|
||||
let _ = Int(row[3] as! Int64)
|
||||
let _ = Int(row[4] as! Int64)
|
||||
let _ = Int(row[5] as! Int64)
|
||||
let _ = Int(row[6] as! Int64)
|
||||
let _ = Int(row[7] as! Int64)
|
||||
let _ = Int(row[8] as! Int64)
|
||||
let _ = Int(row[9] as! Int64)
|
||||
_ = Int(row[0] as! Int64)
|
||||
_ = Int(row[1] as! Int64)
|
||||
_ = Int(row[2] as! Int64)
|
||||
_ = Int(row[3] as! Int64)
|
||||
_ = Int(row[4] as! Int64)
|
||||
_ = Int(row[5] as! Int64)
|
||||
_ = Int(row[6] as! Int64)
|
||||
_ = Int(row[7] as! Int64)
|
||||
_ = Int(row[8] as! Int64)
|
||||
_ = Int(row[9] as! Int64)
|
||||
|
||||
count += 1
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class InsertNamedValuesTests: XCTestCase {
|
||||
}
|
||||
|
||||
measureBlock {
|
||||
let _ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
_ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
|
||||
let dbQueue = FMDatabaseQueue(path: databasePath)
|
||||
dbQueue.inDatabase { db in
|
||||
@@ -51,7 +51,7 @@ class InsertNamedValuesTests: XCTestCase {
|
||||
}
|
||||
|
||||
measureBlock {
|
||||
let _ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
_ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
@@ -82,7 +82,7 @@ class InsertNamedValuesTests: XCTestCase {
|
||||
}
|
||||
|
||||
measureBlock {
|
||||
let _ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
_ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
|
||||
let db = try! Connection(databasePath)
|
||||
try! db.run(itemsTable.create { t in
|
||||
|
||||
@@ -21,7 +21,7 @@ class InsertPositionalValuesTests: XCTestCase {
|
||||
}
|
||||
|
||||
measureBlock {
|
||||
let _ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
_ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
|
||||
var connection: COpaquePointer = nil
|
||||
sqlite3_open_v2(databasePath, &connection, 0x00000004 /*SQLITE_OPEN_CREATE*/ | 0x00000002 /*SQLITE_OPEN_READWRITE*/, nil)
|
||||
@@ -66,7 +66,7 @@ class InsertPositionalValuesTests: XCTestCase {
|
||||
try! NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
}
|
||||
measureBlock {
|
||||
let _ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
_ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
|
||||
let dbQueue = FMDatabaseQueue(path: databasePath)
|
||||
dbQueue.inDatabase { db in
|
||||
@@ -95,7 +95,7 @@ class InsertPositionalValuesTests: XCTestCase {
|
||||
try! NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
}
|
||||
measureBlock {
|
||||
let _ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
_ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
@@ -125,7 +125,7 @@ class InsertPositionalValuesTests: XCTestCase {
|
||||
try! NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
}
|
||||
measureBlock {
|
||||
let _ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
_ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
|
||||
let db = try! Connection(databasePath)
|
||||
try! db.run(itemsTable.create { t in
|
||||
|
||||
@@ -10,7 +10,7 @@ class InsertRecordTests: XCTestCase {
|
||||
func testGRDB() {
|
||||
let databaseFileName = "GRDBPerformanceTests-\(NSProcessInfo.processInfo().globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent(databaseFileName)
|
||||
let _ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
_ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
defer {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
dbQueue.inDatabase { db in
|
||||
@@ -22,7 +22,7 @@ class InsertRecordTests: XCTestCase {
|
||||
}
|
||||
|
||||
measureBlock {
|
||||
let _ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
_ = try? NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
|
||||
@@ -391,7 +391,7 @@ class ConcurrencyTests: XCTestCase {
|
||||
do {
|
||||
dispatch_semaphore_wait(s1, DISPATCH_TIME_FOREVER)
|
||||
try self.dbQueue2.inTransaction(.Deferred) { db in
|
||||
let _ = Row.fetchAll(db, "SELECT * FROM stuffs")
|
||||
_ = Row.fetchAll(db, "SELECT * FROM stuffs")
|
||||
dispatch_semaphore_signal(s2)
|
||||
usleep(100_000) // 0.1s
|
||||
return .Commit
|
||||
|
||||
@@ -156,7 +156,7 @@ class SelectStatementTests : GRDBTestCase {
|
||||
func testDatabaseErrorThrownBySelectStatementContainSQL() {
|
||||
dbQueue.inDatabase { db in
|
||||
do {
|
||||
let _ = try db.selectStatement("SELECT * FROM blah")
|
||||
_ = try db.selectStatement("SELECT * FROM blah")
|
||||
XCTFail()
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.code, 1)
|
||||
|
||||
@@ -258,7 +258,7 @@ class UpdateStatementTests : GRDBTestCase {
|
||||
func testDatabaseErrorThrownByUpdateStatementContainSQL() {
|
||||
dbQueue.inDatabase { db in
|
||||
do {
|
||||
let _ = try db.updateStatement("UPDATE blah SET id = 12")
|
||||
_ = try db.updateStatement("UPDATE blah SET id = 12")
|
||||
XCTFail()
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.code, 1)
|
||||
@@ -275,7 +275,7 @@ class UpdateStatementTests : GRDBTestCase {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
do {
|
||||
let _ = try db.updateStatement("UPDATE persons SET age = 1; UPDATE persons SET age = 2;")
|
||||
_ = try db.updateStatement("UPDATE persons SET age = 1; UPDATE persons SET age = 2;")
|
||||
XCTFail("Expected error")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.code, 21) // SQLITE_MISUSE
|
||||
@@ -291,7 +291,7 @@ class UpdateStatementTests : GRDBTestCase {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
do {
|
||||
let _ = try db.updateStatement("UPDATE persons SET age = 1;x")
|
||||
_ = try db.updateStatement("UPDATE persons SET age = 1;x")
|
||||
XCTFail("Expected error")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.code, 21) // SQLITE_MISUSE
|
||||
|
||||
Reference in new issue
Block a user