SQLite.swift

码农软件 · 软件分类 · 其他(Others) · 2019-07-22 21:14:10

软件介绍

SQLite.swift 是一个使用纯 Swift 语言封装 SQLite3 的操作框架。

特性:

  • 简单的查询和参数绑定接口

  • 安全、自动类型数据访问

  • 隐式提交和回滚接口

  • 开发者友好的错误处理和调试

  • 文档完善

  • 通过广泛测试

SQLite.playground Screen Shot

示例代码:

import SQLite

let db = Database("path/to/db.sqlite3")

db.execute(
    "CREATE TABLE users (" +
        "id INTEGER PRIMARY KEY, " +
        "email TEXT NOT NULL UNIQUE, " +
        "manager_id INTEGER, " +
        "FOREIGN KEY(manager_id) REFERENCES users(id)" +
    ")"
)

let stmt = db.prepare("INSERT INTO users (email) VALUES (?)")
for email in ["alice@example.com", "betsy@example.com"] {
    stmt.run(email)
}

db.totalChanges // 2
db.lastChanges  // {Some 1}
db.lastID       // {Some 2}

for row in db.prepare("SELECT id, email FROM users") {
    println(row)
    // [Optional(1), Optional("betsy@example.com")]
    // [Optional(2), Optional("alice@example.com")]
}

db.scalar("SELECT count(*) FROM users") // {Some 2}

let jr = db.prepare("INSERT INTO users (email, manager_id) VALUES (? ?)")
db.transaction(
    stmt.run("dolly@example.com"),
    jr.run("emery@example.com", db.lastID)
)

本文地址:https://codercto.com/soft/d/10721.html

Discrete Mathematics and Its Applications

Discrete Mathematics and Its Applications

Kenneth H Rosen / McGraw-Hill Science/Engineering/Math / 2003-04-22 / USD 132.81

Discrete Mathematics and its Applications is a focused introduction to the primary themes in a discrete mathematics course, as introduced through extensive applications, expansive discussion, and deta......一起来看看 《Discrete Mathematics and Its Applications》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具