@@ -193,7 +193,8 @@ let path = Bundle.main.path(forResource: "db", ofType: "sqlite3")!
193
193
let db = try Connection (path, readonly : true )
194
194
```
195
195
196
- > _ Note:_ Signed applications cannot modify their bundle resources. If you
196
+ > [ !NOTE]
197
+ > Signed applications cannot modify their bundle resources. If you
197
198
> bundle a database file with your app for the purpose of bootstrapping, copy
198
199
> it to a writable location _ before_ establishing a connection (see
199
200
> [ Read-Write Databases] ( #read-write-databases ) , above, for typical, writable
@@ -254,7 +255,8 @@ db.busyHandler({ tries in
254
255
})
255
256
```
256
257
257
- > _ Note:_ The default timeout is 0, so if you see ` database is locked `
258
+ > [ !NOTE]
259
+ > The default timeout is 0, so if you see ` database is locked `
258
260
> errors, you may be trying to access the same database simultaneously from
259
261
> multiple connections.
260
262
@@ -314,7 +316,8 @@ Use optional generics for expressions that can evaluate to `NULL`.
314
316
let name = SQLExpression< String ?> (" name" )
315
317
```
316
318
317
- > _ Note:_ The default ` SQLExpression ` initializer is for [ quoted
319
+ > [ !NOTE]
320
+ > The default ` SQLExpression ` initializer is for [ quoted
318
321
> identifiers] ( https://www.sqlite.org/lang_keywords.html ) (_ i.e._ , column
319
322
> names). To build a literal SQL expression, use ` init(literal:) ` .
320
323
> <!-- FIXME -->
@@ -359,7 +362,8 @@ try db.run(users.create { t in // CREATE TABLE "users" (
359
362
}) // )
360
363
```
361
364
362
- > _ Note:_ ` SQLExpression<T> ` structures (in this case, the ` id ` and ` email `
365
+ > [ !NOTE]
366
+ > ` SQLExpression<T> ` structures (in this case, the ` id ` and ` email `
363
367
> columns), generate ` NOT NULL ` constraints automatically, while
364
368
> ` SQLExpression<T?> ` structures (` name ` ) do not.
365
369
@@ -402,7 +406,8 @@ several parameters that map to various column constraints and clauses.
402
406
// "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
403
407
```
404
408
405
- > _Note: _ The `primaryKey` parameter cannot be used alongside
409
+ > [! NOTE]
410
+ > The `primaryKey` parameter cannot be used alongside
406
411
> `references`. If you need to create a column that has a default value
407
412
> and is also a primary and/ or foreign key, use the `primaryKey` and
408
413
> `foreignKey` functions mentioned under
@@ -443,7 +448,8 @@ several parameters that map to various column constraints and clauses.
443
448
// "name" TEXT DEFAULT 'Anonymous'
444
449
```
445
450
446
- > _Note: _ The `defaultValue` parameter cannot be used alongside
451
+ > [! NOTE]
452
+ > The `defaultValue` parameter cannot be used alongside
447
453
> `primaryKey` and `references`. If you need to create a column that has
448
454
> a default value and is also a primary and/ or foreign key, use the
449
455
> `primaryKey` and `foreignKey` functions mentioned under
@@ -473,7 +479,8 @@ several parameters that map to various column constraints and clauses.
473
479
// "user_id" INTEGER REFERENCES "users" ("id")
474
480
```
475
481
476
- > _Note: _ The `references` parameter cannot be used alongside
482
+ > [! NOTE]
483
+ > The `references` parameter cannot be used alongside
477
484
> `primaryKey` and `defaultValue`. If you need to create a column that
478
485
> has a default value and is also a primary and/ or foreign key, use the
479
486
> `primaryKey` and `foreignKey` functions mentioned under
574
581
The [`update`](#updating - rows) and [`delete`](#deleting - rows) functions
575
582
follow similar patterns.
576
583
577
- > _Note: _ If `insert` is called without any arguments, the statement will run
584
+ > [! NOTE]
585
+ > If `insert` is called without any arguments, the statement will run
578
586
> with a `DEFAULT VALUES` clause. The table must not have any constraints
579
587
> that aren’t fulfilled by default values.
580
588
>
@@ -836,7 +844,8 @@ let query = users.join(posts, on: user_id == users[id])
836
844
Namespacing is achieved by subscripting a [query](#queries ) with a [column
837
845
expression](#expressions ) (_e.g ._ , `users[id]` above becomes `users.id `).
838
846
839
- > _Note: _ We can namespace all of a table’s columns using `* `.
847
+ > [! NOTE]
848
+ > We can namespace all of a table’s columns using `* `.
840
849
>
841
850
> ```swift
842
851
> let query = users.select (users[* ])
@@ -1120,7 +1129,8 @@ let count = try db.scalar(users.filter(name != nil).count)
1120
1129
// SELECT total("balance") FROM "users"
1121
1130
```
1122
1131
1123
- > _Note: _ Expressions can be prefixed with a `DISTINCT` clause by calling the
1132
+ > [! NOTE]
1133
+ > Expressions can be prefixed with a `DISTINCT` clause by calling the
1124
1134
> `distinct` computed property.
1125
1135
>
1126
1136
> ```swift
@@ -1251,7 +1261,8 @@ try db.transaction {
1251
1261
// COMMIT TRANSACTION
1252
1262
```
1253
1263
1254
- > _Note: _ Transactions run in a serial queue.
1264
+ > [! NOTE]
1265
+ > Transactions run in a serial queue.
1255
1266
1256
1267
## Querying the Schema
1257
1268
@@ -1355,7 +1366,8 @@ tables](#creating-a-table).
1355
1366
// ALTER TABLE "users" ADD COLUMN "suffix" TEXT DEFAULT 'SR'
1356
1367
```
1357
1368
1358
- > _Note: _ Unlike the [`CREATE TABLE` constraint](#table - constraints),
1369
+ > [! NOTE]
1370
+ > Unlike the [`CREATE TABLE` constraint](#table - constraints),
1359
1371
> default values may not be expression structures (including
1360
1372
> `CURRENT_TIME`, `CURRENT_DATE`, or `CURRENT_TIMESTAMP`).
1361
1373
@@ -1384,7 +1396,7 @@ tables](#creating-a-table).
1384
1396
1385
1397
### SchemaChanger
1386
1398
1387
- Version 0.14.0 introduces `SchemaChanger`, an alternative API to perform more complex
1399
+ The `SchemaChanger` is an alternative API to perform more complex
1388
1400
migrations such as renaming columns. These operations work with all versions of
1389
1401
SQLite but use SQL statements such as `ALTER TABLE RENAME COLUMN` when available.
1390
1402
@@ -1527,7 +1539,8 @@ The `Datatype` must be one of the basic Swift types that values are bridged
1527
1539
through before serialization and deserialization (see [Building Type- Safe SQL
1528
1540
](#building - type- safe- sql) for a list of types).
1529
1541
1530
- > ⚠ _Note: _ `Binding` is a protocol that SQLiteDB uses internally to
1542
+ > [! WARNING]
1543
+ > `Binding` is a protocol that SQLiteDB uses internally to
1531
1544
> directly map SQLite types to Swift types. ** Do _not_** conform custom types
1532
1545
> to the `Binding` protocol.
1533
1546
@@ -1570,7 +1583,8 @@ extension UIImage: Value {
1570
1583
}
1571
1584
```
1572
1585
1573
- > _Note: _ See the [Archives and Serializations Programming Guide][] for more
1586
+ > [! NOTE]
1587
+ > See the [Archives and Serializations Programming Guide][] for more
1574
1588
> information on encoding and decoding custom types.
1575
1589
1576
1590
@@ -1711,7 +1725,8 @@ arithmetic, bitwise operations, and concatenation.
1711
1725
| `\| ` | `Int -> Int ` | `\| ` |
1712
1726
| `+ ` | `String -> String ` | `\| \| ` |
1713
1727
1714
- > _Note: _ SQLiteDB also defines a bitwise XOR operator , `^ `, which
1728
+ > [! NOTE]
1729
+ > SQLiteDB also defines a bitwise XOR operator , `^ `, which
1715
1730
> expands the expression `lhs ^ rhs` to `~ (lhs & rhs) & (lhs | rhs)`.
1716
1731
1717
1732
@@ -1728,7 +1743,8 @@ arithmetic, bitwise operations, and concatenation.
1728
1743
Many of SQLite’s [core functions](https :// www.sqlite.org/lang_corefunc.html)
1729
1744
have been surfaced in and type- audited for SQLiteDB.
1730
1745
1731
- > _Note: _ SQLiteDB aliases the `?? ` operator to the `ifnull` function.
1746
+ > [! NOTE]
1747
+ > SQLiteDB aliases the `?? ` operator to the `ifnull` function.
1732
1748
>
1733
1749
> ```swift
1734
1750
> name ?? email // ifnull("name", "email")
@@ -1779,7 +1795,8 @@ let typeConformsTo: (SQLExpression<String>, SQLExpression<String>) -> SQLExpress
1779
1795
)
1780
1796
```
1781
1797
1782
- > _Note: _ The optional `deterministic` parameter is an optimization that
1798
+ > [! NOTE]
1799
+ > The optional `deterministic` parameter is an optimization that
1783
1800
> causes the function to be created with
1784
1801
> [`SQLITE_DETERMINISTIC`](https :// www.sqlite.org/c3ref/c_deterministic.html).
1785
1802
@@ -1807,7 +1824,8 @@ let images = attachments.filter(typeConformsTo(UTI, kUTTypeImage))
1807
1824
// SELECT * FROM "attachments" WHERE "typeConformsTo"("UTI", 'public.image')
1808
1825
```
1809
1826
1810
- > _Note: _ The return type of a function must be
1827
+ > [! NOTE]
1828
+ > The return type of a function must be
1811
1829
> [a core SQL type](#building - type- safe- sql) or [conform to `Value `](#custom - types).
1812
1830
1813
1831
We can create loosely- typed functions by handling an array of raw arguments,
@@ -1828,7 +1846,8 @@ let stmt = try db.prepare("SELECT * FROM attachments WHERE typeConformsTo(UTI, ?
1828
1846
for row in stmt.bind (kUTTypeImage) { /* ... */ }
1829
1847
```
1830
1848
1831
- > _Note: _ Prepared queries can be reused, and long lived prepared queries should be `reset ()` after each use. Otherwise, the transaction (either [implicit or explicit](https :// www.sqlite.org/lang_transaction.html#implicit_versus_explicit_transactions)) will be held open until the query is reset or finalized. This can affect performance. Statements are reset automatically during `deinit`.
1849
+ > [! NOTE]
1850
+ > Prepared queries can be reused, and long lived prepared queries should be `reset ()` after each use. Otherwise, the transaction (either [implicit or explicit](https :// www.sqlite.org/lang_transaction.html#implicit_versus_explicit_transactions)) will be held open until the query is reset or finalized. This can affect performance. Statements are reset automatically during `deinit`.
1832
1851
>
1833
1852
> ```swift
1834
1853
> someObj.statement = try db.prepare (" SELECT * FROM attachments WHERE typeConformsTo(UTI, ?)" )
0 commit comments