Skip to content

werner-freytag/SwiftSQLite

Repository files navigation

SwiftSQLite

A lightweight Swift wrapper for sqlite3

Example

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])

// -> ["😎", "🤪"]

Documentation

See unit tests for usage. Find a reference documentation in the Documentation directory.

About

A lightweight Swift wrapper for SQLite.

Resources

License

Stars

Watchers

Forks

Packages

No packages published