AKYSqlite.swift 通过 CocoaPods 提供。要安装,只需将以下行添加到您的 Podfile 中
pod 'AKYSqlite_swift'
导入 AKYSqlite.h
import AKYSqlite_swift
从 AKYSqlite_swift/Classes 复制文件到您的项目中
let dbPath = "/path/to/the/database/file"
let db = AKYDatabase(path: dbPath)
if db.open() {
let stmt = db.prepareStatement(query: "SELECT name, lastname FROM person WHERE person_id = @id")
stmt.bindInt(1, forName: "@id")
while stmt.step() {
let name = stmt.getString(forName: "name")!
let lastname = stmt.getString(forName: "lastname")
}
stmt.finalize()
db.close()
}
Aikyuichi,[email protected]
AKYSqlite.swift 在 MIT 许可协议下可用。有关更多信息,请参阅 LICENSE 文件。