| About the Author |
|
xv | |
| About the Technical Reviewer |
|
xvii | |
| Acknowledgments |
|
xix | |
| Preface |
|
xxi | |
|
Chapter 1 Creating the Objective-C Wrapper |
|
|
1 | (10) |
|
|
|
1 | (1) |
|
Creating the Swift iOS Project |
|
|
2 | (3) |
|
Create the Db Mgr Project Structure |
|
|
3 | (1) |
|
Adding the SQLite 3 Library |
|
|
3 | (2) |
|
|
|
5 | (2) |
|
Creating the Bridge Header File |
|
|
5 | (2) |
|
Configuring the Swift Compiler |
|
|
7 | (1) |
|
Creating the Swift Wrapper Functions |
|
|
7 | (3) |
|
|
|
8 | (1) |
|
|
|
9 | (1) |
|
Creating the SQLite Execute Function |
|
|
10 | (1) |
|
|
|
10 | (1) |
|
Chapter 2 Creating SQLite Databases |
|
|
11 | (14) |
|
Creating Databases and Adding them to the Project |
|
|
11 | (11) |
|
|
|
12 | (1) |
|
|
|
12 | (1) |
|
|
|
13 | (2) |
|
|
|
15 | (3) |
|
|
|
18 | (1) |
|
|
|
19 | (2) |
|
|
|
21 | (1) |
|
|
|
22 | (2) |
|
Add Database to the Project |
|
|
23 | (1) |
|
|
|
24 | (1) |
|
Chapter 3 Creating Databases During Runtime |
|
|
25 | (20) |
|
|
|
25 | (5) |
|
|
|
25 | (2) |
|
|
|
27 | (3) |
|
|
|
30 | (11) |
|
|
|
31 | (5) |
|
|
|
36 | (3) |
|
|
|
39 | (2) |
|
Building the Winery Database |
|
|
41 | (3) |
|
Create the Winery.sqlite File |
|
|
42 | (2) |
|
|
|
44 | (1) |
|
Chapter 4 Altering Databases and Other Features |
|
|
45 | (18) |
|
|
|
46 | (2) |
|
|
|
46 | (1) |
|
|
|
47 | (1) |
|
|
|
48 | (1) |
|
|
|
48 | (1) |
|
|
|
48 | (1) |
|
|
|
49 | (1) |
|
Adding and Altering Collation Sequences |
|
|
50 | (2) |
|
|
|
51 | (1) |
|
|
|
51 | (1) |
|
|
|
51 | (1) |
|
|
|
51 | (1) |
|
The SQLite DELETE Statement |
|
|
52 | (1) |
|
|
|
52 | (1) |
|
|
|
52 | (1) |
|
|
|
53 | (1) |
|
|
|
53 | (1) |
|
Deleting Collation Sequences |
|
|
53 | (1) |
|
|
|
53 | (6) |
|
|
|
53 | (2) |
|
Creating Functions using Swift |
|
|
55 | (3) |
|
Using Functions in a SQLite Database using Swift |
|
|
58 | (1) |
|
|
|
59 | (2) |
|
|
|
59 | (1) |
|
|
|
60 | (1) |
|
|
|
60 | (1) |
|
|
|
60 | (1) |
|
|
|
60 | (1) |
|
|
|
60 | (1) |
|
|
|
60 | (1) |
|
Corrupting a SQLite Database |
|
|
61 | (1) |
|
|
|
61 | (1) |
|
|
|
62 | (1) |
|
Chapter 5 Inserting Records |
|
|
63 | (26) |
|
The Data-Binding Functions |
|
|
63 | (1) |
|
The SQLite INSERT function |
|
|
64 | (5) |
|
|
|
66 | (1) |
|
|
|
67 | (1) |
|
|
|
67 | (1) |
|
|
|
67 | (1) |
|
|
|
67 | (1) |
|
|
|
68 | (1) |
|
|
|
69 | (3) |
|
|
|
69 | (1) |
|
|
|
69 | (3) |
|
Creating the UI View for Inserting |
|
|
72 | (3) |
|
|
|
75 | (3) |
|
Add the Wineries Database |
|
|
76 | (1) |
|
|
|
76 | (1) |
|
|
|
77 | (1) |
|
|
|
77 | (1) |
|
|
|
78 | (6) |
|
|
|
78 | (1) |
|
The init() function init() |
|
|
78 | (1) |
|
|
|
79 | (1) |
|
The createOrOpenDatabase Function |
|
|
80 | (1) |
|
The insertWineRecord Function |
|
|
80 | (1) |
|
The insertWineryRecord Function |
|
|
81 | (1) |
|
|
|
81 | (1) |
|
Add Photo Capture Functionality |
|
|
82 | (1) |
|
|
|
83 | (1) |
|
|
|
84 | (3) |
|
|
|
84 | (3) |
|
|
|
87 | (2) |
|
Chapter 6 Selecting Records |
|
|
89 | (24) |
|
|
|
89 | (1) |
|
|
|
90 | (6) |
|
|
|
90 | (2) |
|
Using a Dynamic WHERE Clause |
|
|
92 | (1) |
|
Perform a SELECT using a Sub-Query |
|
|
93 | (1) |
|
Perform a SELECT using Joins |
|
|
93 | (1) |
|
Select and Display Images |
|
|
94 | (1) |
|
Select and Playback Audio Records |
|
|
95 | (1) |
|
Select and Display Video Records |
|
|
96 | (1) |
|
Adding SELECT Functionality to the Winery App |
|
|
96 | (4) |
|
Add the SelectWineries UlPicker |
|
|
96 | (1) |
|
|
|
96 | (1) |
|
The UlPickerView Functions |
|
|
97 | (1) |
|
The selectWineriesList Function |
|
|
98 | (1) |
|
The selectWineList Function |
|
|
99 | (1) |
|
The selectWineryByName Function |
|
|
99 | (1) |
|
Modifying the Ul for Displaying Records |
|
|
100 | (9) |
|
Adding the UlTableViewControllers |
|
|
100 | (2) |
|
Adding the Navigation Controllers |
|
|
102 | (2) |
|
Connect the TableViewControllers and TableViewCellController |
|
|
104 | (2) |
|
Adding the IBOutlets: WineList Controller |
|
|
106 | (1) |
|
|
|
107 | (2) |
|
|
|
109 | (3) |
|
|
|
112 | (1) |
|
Chapter 7 Updating Records |
|
|
113 | (18) |
|
|
|
113 | (4) |
|
UPDATE Using a Where Clause |
|
|
115 | (1) |
|
|
|
115 | (1) |
|
Updating Records Using a Join |
|
|
116 | (1) |
|
UPDATE Using a Sub-Query in FROM Clause |
|
|
116 | (1) |
|
|
|
116 | (1) |
|
A Sample SQLite UPDATE Operation in Swift |
|
|
117 | (1) |
|
Adding the UPDATE Functionality to the Winery App |
|
|
118 | (6) |
|
Modifying the WineryDAO Controller |
|
|
118 | (2) |
|
Modifying the UI for Updates |
|
|
120 | (4) |
|
|
|
124 | (6) |
|
|
|
125 | (5) |
|
|
|
130 | (1) |
|
Chapter 8 Deleting Records |
|
|
131 | (14) |
|
The DELETE Statement in SQLite |
|
|
131 | (1) |
|
|
|
131 | (1) |
|
Restrictions and Triggers |
|
|
132 | (1) |
|
|
|
132 | (1) |
|
A Swift SQLite Delete Example |
|
|
132 | (2) |
|
Adding the Delete Functionality to the Winery App |
|
|
134 | (4) |
|
Modifying the WineryDAO Class |
|
|
135 | (1) |
|
Modifying the View/Controllers |
|
|
136 | (1) |
|
Modifying the TableViewControllers |
|
|
136 | (1) |
|
Modifying the Ul for Delete |
|
|
137 | (1) |
|
|
|
137 | (1) |
|
|
|
138 | (6) |
|
|
|
144 | (1) |
|
Chapter 9 Searching for Records in SQLite |
|
|
145 | (16) |
|
|
|
145 | (13) |
|
Create the SQLite Database |
|
|
146 | (2) |
|
Create the iOS/SQLite Project |
|
|
148 | (10) |
|
|
|
158 | (1) |
|
|
|
159 | (2) |
|
Chapter 10 Working with Multiple Databases |
|
|
161 | (14) |
|
|
|
161 | (1) |
|
|
|
162 | (1) |
|
|
|
162 | (1) |
|
|
|
163 | (1) |
|
Attach and Detach in Swift |
|
|
163 | (8) |
|
|
|
164 | (1) |
|
|
|
164 | (5) |
|
|
|
169 | (2) |
|
|
|
171 | (2) |
|
|
|
173 | (2) |
|
Chapter 11 Backing Up SQLite Databases |
|
|
175 | (12) |
|
Overview of the SQLite Backup Methods |
|
|
175 | (2) |
|
|
|
175 | (1) |
|
Back Up In-Memory SQLite Databases |
|
|
176 | (1) |
|
Back Up On-Disk SQLite Databases |
|
|
177 | (1) |
|
|
|
177 | (8) |
|
|
|
181 | (2) |
|
|
|
183 | (2) |
|
|
|
185 | (2) |
|
Chapter 12 Analyzing SQLite Databases |
|
|
187 | (10) |
|
|
|
187 | (1) |
|
|
|
188 | (1) |
|
The sqlite3_analyzer tool |
|
|
189 | (7) |
|
|
|
196 | (1) |
| Index |
|
197 | |