 
         // If we have a live cursor, this will step to the first result.
         // Stepping through a prepared statement without resetting it will lock the connection.
-        historyCursor[0]
+        c[0]
 
         // Close the cursor after a delay if there's a close timeout set.
         if let closeTimeout = closeTimeout {
             let queue = dispatch_queue_create("cursor timeout queue", DISPATCH_QUEUE_SERIAL)
             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(closeTimeout * NSEC_PER_SEC)), queue) {
-                historyCursor.close()
+                c.close()
             }
         }
 
-        return addSite(historyTable, url: "url1", title: "title1")
+        return addSite(table, url: "http://url/\(urlCounter++)", title: "title\(urlCounter++)")
     }
 
-    private func addSite(history: HistoryTable<Site>, url: String, title: String) -> NSError? {
-        return swiftData.withConnection(.ReadWrite) { connection -> NSError? in
+    private func addSite(table: BrowserTable, url: String, title: String) -> NSError? {
+        return swiftData.withConnection(SwiftData.Flags.ReadWrite) { connection -> NSError? in
             var err: NSError?
-            let site = Site(url: url, title: title)
-            history.insert(connection, item: site, err: &err)
-            return err
+            let args: Args = [Bytes.generateGUID(), url, title]
+            return connection.executeChange("INSERT INTO history (guid, url, title) VALUES (?, ?, ?)", withArgs: args)
         }
     }
 }
    func testFilledCursor() {
        SwiftData.ReuseConnections = false
        SwiftData.EnableWAL = false
        var error = writeDuringRead(safeQuery: true)
        XCTAssertNil(error, "Insertion succeeded")
    }

    private func writeDuringRead(safeQuery: Bool = false, closeTimeout: UInt64? = nil) -> NSError? {
        let historyTable = HistoryTable<Site>()

        swiftData.withConnection(SwiftData.Flags.ReadWriteCreate) { db in
            historyTable.create(db, version: 1)
            return nil
        }

        var error = addSite(historyTable, url: "url0", title: "title0")
        XCTAssertNil(error, "Inserted URL")

        // Query the database and hold the cursor.
        var historyCursor: Cursor!
        error = swiftData.withConnection(SwiftData.Flags.ReadOnly) { db in
            let (query, args) = historyTable.getQueryAndArgs(nil)!
            if safeQuery {
                historyCursor = db.executeQuery(query, factory: historyTable.factory!, withArgs: args)
            } else {
                historyCursor = db.executeQueryUnsafe(query, factory: historyTable.factory!, withArgs: args)
            }
            return nil
        }

        SwiftData.EnableWAL = true
    }

    /*
    // These two tests broke after pull #427.
    func testNoWALOrConnectionReuse() {
    SwiftData.EnableWAL = false
        SwiftData.ReuseConnections = false
        var error = writeDuringRead()
        XCTAssertEqual(error!.code, 5, "Got 'database is locked' error")
    }

    func testNoConnectionReuse() {
        SwiftData.EnableWAL = true
        SwiftData.ReuseConnections = false
        var error = writeDuringRead()
        XCTAssertNotNil(error, "Expected error during write.")
        XCTAssertEqual(error?.code ?? 0, 8, "Got 'attempt to write to read-only database' error")
    }
    */

    func testNoWAL() {
        SwiftData.EnableWAL = false
        SwiftData.ReuseConnections = true
        var error = writeDuringRead()
        XCTAssertNil(error, "Insertion succeeded")
    }

    func testDefaultSettings() {
        SwiftData.EnableWAL = true
        SwiftData.ReuseConnections = true
        var error = writeDuringRead()
        XCTAssertNil(error, "Insertion succeeded")
    }

    func testBusyTimeout() {
        SwiftData.EnableWAL = false
        SwiftData.ReuseConnections = false
        var error = writeDuringRead(closeTimeout: 1)
        XCTAssertNil(error, "Insertion succeeded")
    }
