My current code is written with Swift 3 ,I tried to change Swift 4.2 via Xcode10.1. SQLite is crashing on changes version and working correct on old code.
I'm trying to retrieve a count of records in a table using SQLite.swift and Swift in a Cocoa macOS application.
let db = try Connection("\(pathh)/db.sqlite3")
let users = Table("users")
var count = try db.scalar(users.filter(userid == userid).count)
However, when this code is executed (from a button click event handler), the following exception is thrown:
unrecognized token: ":" (code: 1)
When I tried to use var count = try db.scalar("SELECT COUNT(*) FROM users WHERE userid=?",userid) as! Int64
, the correct result is returned.
Any and all help would be appreciated. Thanks in advance!