Skip to content

Commit 9bfae5c

Browse files
committed
Playground updates
Document the new way of initializing database connections. And stop saying "instantiate" all the time. Signed-off-by: Stephen Celis <stephen@stephencelis.com>
1 parent 7627523 commit 9bfae5c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

SQLite.playground/Contents.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import SQLite
1111

1212
let db = Database()
1313
/*:
14-
This implicitly opens a database in `":memory:"`. To open a database at a specific location, pass the path as a parameter during instantiation, *e.g.*,
14+
This implicitly opens a database in memory (using `.InMemory`). To open a database at a specific location, pass the path as a parameter during instantiation, *e.g.*,
1515

1616
Database("path/to/database.sqlite3")
1717

18-
Pass `nil` or an empty string (`""`) to open a temporary, disk-backed database, instead.
18+
Pass `.Temporary` to open a temporary, disk-backed database, instead.
1919

20-
Once we instantiate a database connection, we can execute SQL statements directly against it. Let’s create a table.
20+
Once we initialize a database connection, we can execute SQL statements directly against it. Let’s create a table.
2121
*/
2222
db.execute(
2323
"CREATE TABLE users (" +
@@ -32,7 +32,7 @@ db.execute(
3232
/*:
3333
The `execute` function can run multiple SQL statements at once as a convenience and will throw an assertion failure if an error occurs during execution. This is useful for seeding and migrating databases with well-tested statements that are guaranteed to succeed (or where failure can be graceful and silent).
3434

35-
It’s generally safer to prepare SQL statements individually. Let’s instantiate a `Statement` object and insert a couple rows.
35+
It’s generally safer to prepare SQL statements individually. Let’s build a `Statement` object and insert a couple rows.
3636

3737
*/
3838
let stmt = db.prepare("INSERT INTO users (email, admin) VALUES (?, ?)")

0 commit comments

Comments
 (0)