mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
README.md
This commit is contained in:
1 parent
6419d884a2
commit
5f6bdc3ff5
1 file changed
+9
-2
@@ -17,13 +17,20 @@ let dbQueue = try DatabaseQueue(path: "/tmp/GRDB.sqlite")
|
||||
|
||||
try dbQueue.inTransaction { db -> Void in
|
||||
try db.execute("DROP TABLE IF EXISTS persons")
|
||||
|
||||
try db.execute(
|
||||
"CREATE TABLE persons (" +
|
||||
"id INTEGER PRIMARY KEY, " +
|
||||
"name TEXT, " +
|
||||
"age INT)")
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (?, ?)", bindings: ["Arthur", 36])
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", bindings: [":name": "Barbara", ":age": 37])
|
||||
|
||||
try db.execute(
|
||||
"INSERT INTO persons (name, age) VALUES (?, ?)",
|
||||
bindings: ["Arthur", 36])
|
||||
|
||||
try db.execute(
|
||||
"INSERT INTO persons (name, age) VALUES (:name, :age)",
|
||||
bindings: [":name": "Barbara", ":age": 37])
|
||||
}
|
||||
|
||||
try dbQueue.inDatabase { db -> Void in
|
||||
|
||||
Reference in new issue
Block a user