A lightweight Swift wrapper for sqlite3
import SwiftSQLite
let sqlite = try! SQLite(path: "test.db")
try! sqlite.query("CREATE TABLE test (id INTEGER PRIMARY KEY AUTOINCREMENT, value TEXT)")
try! sqlite.query("INSERT INTO test (value) VALUES (?)", arguments: ["ð"])
try! sqlite.query("INSERT INTO test (value) VALUES (?)", arguments: ["ðĪŠ"])
print("Last insert id: \(sqlite.lastInsertRowId)")
// -> Last insert id: 2
let result = try! sqlite.query("SELECT * FROM test")
print(result.fetchAll(column: "value") as [String])
// -> ["ð", "ðĪŠ"]
See unit tests for usage. Find a reference documentation in the Documentation directory.
link |
Stars: 2 |
Last commit: 3 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics