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
@@ -81,13 +82,16 @@ You should now be able to `import SQLite` from any of your target’s source fil
81
82
82
83
### SQLCipher
83
84
84
-
To install SQLite.swift with [SQLCipher][] support:
85
+
To install SQLite.swift with [SQLCipher](http://sqlcipher.net) support:
85
86
86
87
1. Make sure the **sqlcipher** working copy is checked out in Xcode. If **sqlcipher.xcodeproj** (in the **Vendor** group) is unavailable (and appears red), go to the **Source Control** menu and select **Check Out sqlcipher…** from the **sqlcipher** menu item.
87
88
88
89
2. Follow [the instructions above](#installation) with the **SQLiteCipher** target, instead.
89
90
90
-
[SQLCipher]: http://sqlcipher.net
91
+
> _Note:_ By default, SQLCipher compiles [without support for full-text search](https://github.com/sqlcipher/sqlcipher/issues/102). If you intend to use [FTS4](#full-text-search), make sure you add the following to **Other C Flags** in the **Build Settings** of the **sqlcipher** target (in the **sqlcipher.xcodeproj** project):
92
+
>
93
+
> -`-DSQLITE_ENABLE_FTS4`
94
+
> -`-DSQLITE_ENABLE_FTS3_PARENTHESIS`
91
95
92
96
93
97
### Frameworkless Targets
@@ -101,7 +105,7 @@ It’s possible to use SQLite.swift in a target that doesn’t support framework
101
105
3. Add the following line to your project’s [bridging header](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html#//apple_ref/doc/uid/TP40014216-CH10-XID_79) (a file usually in the form of `$(TARGET_NAME)-Bridging-Header.h`.
102
106
103
107
```swift
104
-
#import"SQLite-Bridging.h'
108
+
#import"SQLite-Bridging.h"
105
109
```
106
110
107
111
> _Note:_ Adding SQLite.swift source files directly to your application will both remove the `SQLite` module namespace and expose internal functions and variables. Please [report any namespace collisions and bugs](https://github.com/stephencelis/SQLite.swift/issues/new) you encounter.
@@ -144,7 +148,7 @@ var path = NSSearchPathForDirectoriesInDomains(
@@ -205,6 +209,8 @@ SQLite.swift comes with a typed expression layer that directly maps [Swift types
205
209
>†SQLite.swift defines its own `Blob` structure, which safely wraps the underlying bytes.
206
210
>
207
211
> See [Custom Types](#custom-types) for more information about extending other classes and structures to work with SQLite.swift.
212
+
>
213
+
> See [Executing Arbitrary SQL](#executing-arbitrary-sql) to forego the typed layer and execute raw SQL, instead.
208
214
209
215
These expressions (in the form of the structure, [`Expression`](#expressions)) build on one another and, with a query ([`Query`](#queries)), can create and execute SQL statements.
// CREATE VIRTUAL TABLE "emails" USING fts4("subject", "body", tokenize=porter)
1375
+
```
1376
+
1377
+
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.
1378
+
1379
+
``` swift
1380
+
emails.insert(
1381
+
subject <-"Just Checking In",
1382
+
body <-"Hey, I was just wondering...did you get my last email?"
1383
+
)!
1384
+
1385
+
emails.filter(match(emails, "wonder*"))
1386
+
// SELECT * FROM "emails" WHERE "emails" MATCH 'wonder*'
1387
+
1388
+
emails.filter(match(subject, "Re:*"))
1389
+
// SELECT * FROM "emails" WHERE "subject" MATCH 'Re:*'
1390
+
```
1391
+
1392
+
1351
1393
## Executing Arbitrary SQL
1352
1394
1353
-
Though we recommend you stick with SQLite.swift’s type-safe system whenever possible, it is possible to simply and safely prepare and execute raw SQL statements via a `Database` connection using the following functions.
1395
+
Though we recommend you stick with SQLite.swift’s [type-safe system](#building-type-safe-sql) whenever possible, it is possible to simply and safely prepare and execute raw SQL statements via a `Database` connection using the following functions.
1354
1396
1355
1397
- `execute` runs an arbitrary number of SQL statements as a convenience.
0 commit comments