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
Copy file name to clipboardExpand all lines: Documentation/Index.md
+50
Original file line number
Diff line number
Diff line change
@@ -111,8 +111,26 @@ install SQLite.swift with Carthage:
111
111
112
112
3. Run `pod install`.
113
113
114
+
#### Requiring a specific version of SQLite
115
+
116
+
If you want to use a more recent version of SQLite than what is provided with the OS you can require the `standalone` subspec:
117
+
118
+
``` ruby
119
+
pod 'SQLite.swift/standalone', '~> 0.10.1'
120
+
```
121
+
122
+
By default this will use the most recent version of SQLite without any extras. If you want you can further customize this by adding another dependency to sqlite3 or one of its subspecs:
123
+
124
+
```ruby
125
+
pod 'SQLite.swift/standalone', '~> 0.10.1'
126
+
pod 'sqlite3/fts5', '= 3.11.1'# SQLite 3.11.1 with FTS5 enabled
127
+
```
128
+
129
+
See the [sqlite3 podspec][sqlite3pod] for more details.
Once we insert a few rows, we can search using the `match` function, which takes a table or column as its first argument and a query string as its second.
1385
1419
1386
1420
``` swift
@@ -1396,6 +1430,22 @@ let replies = emails.filter(subject.match("Re:*"))
1396
1430
// SELECT * FROM "emails" WHERE "subject" MATCH 'Re:*'
1397
1431
```
1398
1432
1433
+
### FTS5
1434
+
1435
+
When linking against a version of SQLite with [FTS5](http://www.sqlite.org/fts5.html) enabled we can create the virtual table
1436
+
in a similar fashion.
1437
+
1438
+
```swift
1439
+
let emails =VirtualTable("emails")
1440
+
let subject = Expression<String>("subject")
1441
+
let body = Expression<String>("body")
1442
+
let config =FTS5Config()
1443
+
.column(subject)
1444
+
.column(body, [.unindexed])
1445
+
1446
+
try db.run(emails.create(.FTS5(config))
1447
+
// CREATE VIRTUAL TABLE "emails" USING fts5("subject", "body" UNINDEXED)
0 commit comments