You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -225,21 +225,21 @@ let db = try Connection(path, readonly: true)
225
225
```
226
226
227
227
> _Note:_ Signed applications cannot modify their bundle resources. If you bundle a database file with your app for the purpose of bootstrapping, copy it to a writable location _before_ establishing a connection (see [Read-Write Databases](#read-write-databases), above, for typical, writable locations).
228
-
>
228
+
>
229
229
> See these two Stack Overflow questions for more information about iOS apps with SQLite databases: [1](https://stackoverflow.com/questions/34609746/what-different-between-store-database-in-different-locations-in-ios), [2](https://stackoverflow.com/questions/34614968/ios-how-to-copy-pre-seeded-database-at-the-first-running-app-with-sqlite-swift). We welcome sample code to show how to successfully copy and use a bundled "seed" database for writing in an app.
230
230
231
231
#### In-Memory Databases
232
232
233
233
If you omit the path, SQLite.swift will provision an [in-memory database](https://www.sqlite.org/inmemorydb.html).
234
234
235
235
``` swift
236
-
let db =tryConnection() // equivalent to `Connection(.InMemory)`
236
+
let db =tryConnection() // equivalent to `Connection(.inMemory)`
237
237
```
238
238
239
239
To create a temporary, disk-backed database, pass an empty file name.
240
240
241
241
``` swift
242
-
let db =tryConnection(.Temporary)
242
+
let db =tryConnection(.temporary)
243
243
```
244
244
245
245
In-memory databases are automatically deleted when the database connection is closed.
@@ -367,15 +367,15 @@ The `column` function is used for a single column definition. It takes an [expre
367
367
t.column(id, primaryKey: true)
368
368
// "id" INTEGER PRIMARY KEY NOT NULL
369
369
370
-
t.column(id, primaryKey: .Autoincrement)
370
+
t.column(id, primaryKey: .autoincrement)
371
371
// "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
372
372
```
373
373
374
374
> _Note:_ The `primaryKey` parameter cannot be used alongside `references`. If you need to create a column that has a default value and is also a primary and/or foreign key, use the `primaryKey` and `foreignKey` functions mentioned under [Table Constraints](#table-constraints).
375
375
>
376
376
> Primary keys cannot be optional (_e.g._, `Expression<Int64?>`).
377
377
>
378
-
> Only an `INTEGER PRIMARY KEY` can take `.Autoincrement`.
378
+
> Only an `INTEGER PRIMARY KEY` can take `.autoincrement`.
379
379
380
380
- `unique` adds a `UNIQUE` constraint to the column. (See the `unique` function under [Table Constraints](#table-constraints) for uniqueness over multiple columns).
381
381
@@ -403,10 +403,10 @@ The `column` function is used for a single column definition. It takes an [expre
403
403
- `collate` adds a `COLLATE` clause to `Expression<String>` (and `Expression<String?>`) column definitions with [a collating sequence](https://www.sqlite.org/datatype3.html#collation) defined in the `Collation` enumeration.
404
404
405
405
``` swift
406
-
t.column(email, collate: .Nocase)
406
+
t.column(email, collate: .nocase)
407
407
// "email" TEXT NOT NULL COLLATE "NOCASE"
408
408
409
-
t.column(name, collate: .Rtrim)
409
+
t.column(name, collate: .rtrim)
410
410
// "name" TEXT COLLATE "RTRIM"
411
411
```
412
412
@@ -454,7 +454,7 @@ Additional constraints may be provided outside the scope of a single column usin
454
454
- `foreignKey` adds a `FOREIGN KEY` constraint to the table. Unlike [the `references` constraint, above](#column-constraints), it supports all SQLite types, both [`ON UPDATE` and `ON DELETE` actions](https://www.sqlite.org/foreignkeys.html#fk_actions), and composite (multiple column) keys.
// FOREIGN KEY("user_id") REFERENCES "users"("id") ON DELETE SET NULL
459
459
```
460
460
@@ -471,7 +471,7 @@ We can insert rows into a table by calling a [query’s](#queries) `insert` func
471
471
try db.run(users.insert(email <-"alice@mac.com", name <-"Alice"))
472
472
// INSERT INTO "users" ("email", "name") VALUES ('alice@mac.com', 'Alice')
473
473
474
-
try db.run(users.insert(or: .Replace, email <-"alice@mac.com", name <-"Alice B."))
474
+
try db.run(users.insert(or: .replace, email <-"alice@mac.com", name <-"Alice B."))
475
475
// INSERT OR REPLACE INTO "users" ("email", "name") VALUES ('alice@mac.com', 'Alice B.')
476
476
```
477
477
@@ -637,7 +637,7 @@ users.join(posts, on: user_id == users[id])
637
637
// SELECT * FROM "users" INNER JOIN "posts" ON ("user_id" = "users"."id")
638
638
```
639
639
640
-
The `join` function takes a [query](#queries) object (for the table being joined on), a join condition (`on`), and is prefixed with an optional join type (default: `.Inner`). Join conditions can be built using [filter operators and functions](#filter-operators-and-functions), generally require [namespacing](#column-namespacing), and sometimes require [aliasing](#table-aliasing).
640
+
The `join` function takes a [query](#queries) object (for the table being joined on), a join condition (`on`), and is prefixed with an optional join type (default: `.inner`). Join conditions can be built using [filter operators and functions](#filter-operators-and-functions), generally require [namespacing](#column-namespacing), and sometimes require [aliasing](#table-aliasing).
641
641
642
642
643
643
##### Column Namespacing
@@ -996,10 +996,10 @@ The `addColumn` function shares several of the same [`column` function parameter
996
996
- `collate` adds a `COLLATE` clause to `Expression<String>` (and `Expression<String?>`) column definitions with [a collating sequence](https://www.sqlite.org/datatype3.html#collation) defined in the `Collation` enumeration.
0 commit comments