mirror of
https://github.com/groue/GRDB.swift
synced 2026-12-06 05:28:44 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
786ab176c9 | ||
|
|
973af107da | ||
|
|
1911ef0172 | ||
|
|
d2e9b340c9 | ||
|
|
5b487d1722 | ||
|
|
a91da59448 | ||
|
|
2846254304 | ||
|
|
5fe765dd29 | ||
|
|
9815f44134 | ||
|
|
3f8969b88f | ||
|
|
4fc7a44a9d | ||
|
|
e132688e00 | ||
|
|
588df57840 | ||
|
|
4a8ca6fdc1 | ||
|
|
2bb2493731 | ||
|
|
c61949ceaf | ||
|
|
3fce1e00c9 | ||
|
|
2f2add1c49 | ||
|
|
697acb103f | ||
|
|
c830e43e8f | ||
|
|
834ef45ca6 | ||
|
|
279faa13e9 | ||
|
|
0309abca6f | ||
|
|
fedee67bda | ||
|
|
a6c3566aa5 | ||
|
|
52fa24e1c4 | ||
|
|
a7ecf41e3b | ||
|
|
e68e5f6265 | ||
|
|
aad5a9b060 | ||
|
|
aa064029ec | ||
|
|
e84060e01c | ||
|
|
f4f72ebb43 | ||
|
|
da51e81e38 | ||
|
|
247cbdd0d0 | ||
|
|
c528740154 | ||
|
|
37b357b050 | ||
|
|
18c376979d | ||
|
|
9cc4357a70 | ||
|
|
f2d35a052f | ||
|
|
221f378d10 | ||
|
|
06a8c8b940 | ||
|
|
eee80b421a | ||
|
|
f6e22c3636 | ||
|
|
20d77fbba5 | ||
|
|
0393ebe012 | ||
|
|
2beddcf77b | ||
|
|
e784ebbcdd | ||
|
|
30ee538dbd | ||
|
|
7939ba6e05 | ||
|
|
2785e69fc1 | ||
|
|
d472c1696d | ||
|
|
d9cfa71fc7 | ||
|
|
715e12912b | ||
|
|
b182fe27f6 | ||
|
|
5594b33933 | ||
|
|
059b8800f6 | ||
|
|
9f687b1848 | ||
|
|
a4a05b1f0a | ||
|
|
1a7b0b0626 | ||
|
|
4c467e46cf | ||
|
|
fa71edeb07 | ||
|
|
4ff436371d | ||
|
|
9d8fa0bc5a | ||
|
|
1a8ecd7889 | ||
|
|
f6614fdfda | ||
|
|
a6055df756 | ||
|
|
5af91c5eab | ||
|
|
41974c4a46 | ||
|
|
f001b5bd76 | ||
|
|
28cf457853 | ||
|
|
8ccc23333d | ||
|
|
d95954d980 | ||
|
|
3506881c2a | ||
|
|
51d127c378 | ||
|
|
2d5dd7ef63 | ||
|
|
ef23ba55a1 | ||
|
|
ffdbf2f3f1 | ||
|
|
56cad83f55 | ||
|
|
719f33f7a7 | ||
|
|
700ffacdb1 | ||
|
|
a6ef4ed55c | ||
|
|
c5da564fb3 | ||
|
|
a6b04ebb64 | ||
|
|
99ba6db257 | ||
|
|
a3cddb72b9 | ||
|
|
2a9e896095 | ||
|
|
89d522d325 | ||
|
|
3c4ff587ca | ||
|
|
e111529035 | ||
|
|
cae1f97032 | ||
|
|
20419834a6 | ||
|
|
5dabc2a20b | ||
|
|
c700f5fc68 | ||
|
|
0b71cf86f2 | ||
|
|
96159bd09c | ||
|
|
bcff802ccb | ||
|
|
376d295853 | ||
|
|
0030ad1804 | ||
|
|
4ec3e0f7d8 | ||
|
|
e36219e408 | ||
|
|
8f8f53a697 | ||
|
|
567292c72f | ||
|
|
b744f73a76 | ||
|
|
da440a5e16 | ||
|
|
017af1d5c3 | ||
|
|
1f5d75d8e9 | ||
|
|
8b80abc701 | ||
|
|
dc75ca4caf | ||
|
|
d7d4c0a54d | ||
|
|
823b094b60 | ||
|
|
06a6c982aa | ||
|
|
1d15ef01f9 | ||
|
|
f72ffcbb43 | ||
|
|
e0f2305cd9 | ||
|
|
210939d2c1 | ||
|
|
2fd071d90e | ||
|
|
badec62cdd | ||
|
|
895cda4de7 | ||
|
|
21fdc9f350 | ||
|
|
398c0ef687 | ||
|
|
3b0a9aef3c | ||
|
|
48ec0916bf | ||
|
|
10af87a7d0 | ||
|
|
96e7996f37 | ||
|
|
0f7af931a9 | ||
|
|
cfd2d80b78 | ||
|
|
0386c01aa9 | ||
|
|
2c39c91ac6 | ||
|
|
0eb51e3e8b | ||
|
|
bb931e9da7 | ||
|
|
7b2e672496 | ||
|
|
cdc6370ee5 | ||
|
|
cc762e4e1d | ||
|
|
ed525bd1d8 | ||
|
|
2b2e92c810 | ||
|
|
44d31ead76 | ||
|
|
ec163e94eb | ||
|
|
ec2ac33fec | ||
|
|
20bda2af26 | ||
|
|
7a49f6293d | ||
|
|
81b21010f1 | ||
|
|
2526e0a2f7 | ||
|
|
af1e8470c9 | ||
|
|
dfd9da68a7 | ||
|
|
5e702234f4 | ||
|
|
9020dcca9a | ||
|
|
930a4e4c1d | ||
|
|
4db77f96b7 | ||
|
|
cc12c046b9 | ||
|
|
f5c63e0997 | ||
|
|
29a26800b7 | ||
|
|
bc5eeb3b3a | ||
|
|
40d02518b0 | ||
|
|
a2556edc69 | ||
|
|
111970fda9 | ||
|
|
ebeb7bc969 | ||
|
|
6ccac5f69c | ||
|
|
cc41b8b259 | ||
|
|
db1a3456b7 | ||
|
|
1b9305c073 | ||
|
|
a33814ef40 | ||
|
|
581bc9f27c | ||
|
|
40cff0053f | ||
|
|
cc33b12b0d | ||
|
|
2add1c68ea | ||
|
|
380b6676a6 | ||
|
|
f133a36477 | ||
|
|
5f2d6f8e2f | ||
|
|
a72c207ec5 | ||
|
|
ae3c28dee1 | ||
|
|
bd919e5209 | ||
|
|
d1697756e9 | ||
|
|
83c3745165 | ||
|
|
56a4a964b7 | ||
|
|
c9a02faf08 | ||
|
|
e59388738e | ||
|
|
c8368d98eb | ||
|
|
d12dad2e34 | ||
|
|
1ee8c73562 | ||
|
|
ad8de84257 | ||
|
|
48398b4913 | ||
|
|
d719fe4612 | ||
|
|
034a30b444 | ||
|
|
9609e2ac4c | ||
|
|
66c2b72a28 | ||
|
|
da48b0880e | ||
|
|
4134b1549a | ||
|
|
7265b2535b | ||
|
|
bb638377ac | ||
|
|
466113fc4a | ||
|
|
31aea350cb | ||
|
|
56869577d4 | ||
|
|
ed3c597a92 | ||
|
|
cbb607b6b0 | ||
|
|
7f64abe820 | ||
|
|
b43dc1ba37 | ||
|
|
59962e5e88 | ||
|
|
8eabcecb69 | ||
|
|
a3ad726111 | ||
|
|
a46b4edb0a | ||
|
|
7059fe3815 | ||
|
|
780f1afe91 | ||
|
|
2459b4e56f | ||
|
|
f750cee594 | ||
|
|
1c3824f4b9 | ||
|
|
5ba1fa856d | ||
|
|
f40a685ac9 | ||
|
|
bf3b6577d5 | ||
|
|
7b0659332b | ||
|
|
19812cb015 | ||
|
|
b283c80776 | ||
|
|
49838c67ee | ||
|
|
4a40bddd82 | ||
|
|
208b7860aa | ||
|
|
05e7c9470b | ||
|
|
2f79d5f805 | ||
|
|
1f120a04f9 | ||
|
|
90a46f6556 | ||
|
|
4dff14a02a | ||
|
|
d9a9acb616 | ||
|
|
8ea215931e | ||
|
|
6caed6aacc | ||
|
|
0c192fcb57 | ||
|
|
3e819a5051 | ||
|
|
b31983cc3a | ||
|
|
e24cb1783c | ||
|
|
a913aba018 | ||
|
|
35d34ab524 | ||
|
|
604cf6b522 | ||
|
|
e987695732 | ||
|
|
09f37a86ad | ||
|
|
ff32f99610 | ||
|
|
4cd099ef30 | ||
|
|
54d3b0eabc | ||
|
|
b3d731b040 | ||
|
|
6629ec48a3 | ||
|
|
19c273771d | ||
|
|
e7b6919bc1 | ||
|
|
60e6c7d250 | ||
|
|
4feeb0e608 | ||
|
|
b3243efdf5 | ||
|
|
60a23bb280 | ||
|
|
973f38727d | ||
|
|
deaac5808d | ||
|
|
22dc01610e | ||
|
|
fe702d8fea | ||
|
|
10e669423f | ||
|
|
fbf146657e | ||
|
|
8667fab206 | ||
|
|
e974cd4b33 | ||
|
|
43c96803be | ||
|
|
70b42a5633 | ||
|
|
9f989f7706 | ||
|
|
4d976ef803 | ||
|
|
02257fd78f | ||
|
|
929c8f49a6 | ||
|
|
a6ec38c805 | ||
|
|
e5ec8ea3b2 | ||
|
|
36ac5a2802 | ||
|
|
b5beff5030 | ||
|
|
d1d1a5da77 | ||
|
|
713d58612e | ||
|
|
bd0990deb4 | ||
|
|
35e8d9c12b | ||
|
|
1fb7f9ff5b | ||
|
|
7eecb059e6 | ||
|
|
ba8375adb1 | ||
|
|
2ef547c461 | ||
|
|
a34784ca73 | ||
|
|
5594d46c2d | ||
|
|
dc7a1e3f41 | ||
|
|
68732487f9 | ||
|
|
5ea1d4376d | ||
|
|
9cb8b205c5 | ||
|
|
a35c453423 | ||
|
|
e7f91d7c25 | ||
|
|
4886f43463 | ||
|
|
929c8ac2b5 | ||
|
|
1438934aa6 | ||
|
|
ec65335fcd | ||
|
|
39d31dbd11 | ||
|
|
6c5be7a169 | ||
|
|
b45894fd51 | ||
|
|
a660b4e5c4 | ||
|
|
e11c88cf05 | ||
|
|
40f930f08a | ||
|
|
0c55e7819d | ||
|
|
3c17ee941f | ||
|
|
5a67ca0411 | ||
|
|
63d04a6707 | ||
|
|
676a116cda | ||
|
|
55435fd324 | ||
|
|
612f8059b8 | ||
|
|
ffd16f7639 | ||
|
|
528860161e | ||
|
|
1fe6094da5 | ||
|
|
399c51b1ee | ||
|
|
55e4abd534 | ||
|
|
e9d02f441b | ||
|
|
f858bcbe5b | ||
|
|
cd107711a9 | ||
|
|
ce4c20b112 | ||
|
|
0b8ba1ccfa | ||
|
|
c72c97fd53 | ||
|
|
1e12068e64 | ||
|
|
1799fe1ff9 | ||
|
|
ae5175c5b4 | ||
|
|
86d5b0b23d | ||
|
|
341044356f | ||
|
|
5eb7a62062 | ||
|
|
74f96c0766 | ||
|
|
49b62cb27a | ||
|
|
798588c54b | ||
|
|
f1a9cdaa8e | ||
|
|
c66c0a11b6 | ||
|
|
b1cdd1360b | ||
|
|
7c8b48e08a | ||
|
|
64df5c6b41 | ||
|
|
a5c1361dc9 | ||
|
|
798b1a7d2e | ||
|
|
e484e4c6de | ||
|
|
31299a529a | ||
|
|
53ac681d49 | ||
|
|
828ef48441 | ||
|
|
63e8742fb1 | ||
|
|
192a958fdc | ||
|
|
f606e633da | ||
|
|
e2d2b031a5 | ||
|
|
c203a972ff | ||
|
|
44df1aa0bd | ||
|
|
d010587f44 | ||
|
|
840525c11a | ||
|
|
a0881d851c | ||
|
|
ac00e05a72 | ||
|
|
4938568ea7 | ||
|
|
cb4c07a5fb | ||
|
|
4edd76341e | ||
|
|
bb8aee8965 | ||
|
|
5d97d2d680 | ||
|
|
3eb2646cad | ||
|
|
96c3dadb7b | ||
|
|
4d9a238c27 | ||
|
|
a475cfa340 | ||
|
|
e54cec9123 | ||
|
|
3edad29501 | ||
|
|
392a004bd1 | ||
|
|
7f8ec17511 | ||
|
|
d9e6fd3b89 | ||
|
|
6cf59838a6 | ||
|
|
3efa60ce8a | ||
|
|
7a90cd2562 | ||
|
|
4cdbe4f0f4 | ||
|
|
595408b351 | ||
|
|
4ee1fd9f65 | ||
|
|
f16f4d557a | ||
|
|
27314d1af3 | ||
|
|
4f14fb0ccd | ||
|
|
9b2a8f847f | ||
|
|
dae4ae1c6b | ||
|
|
c8023adff1 | ||
|
|
c34ac0f17b | ||
|
|
2222a1bfe2 | ||
|
|
3134809c22 | ||
|
|
203e8c41ce | ||
|
|
5804c044d5 | ||
|
|
80c378df21 | ||
|
|
0f3bc5922d | ||
|
|
1810edfa6e | ||
|
|
362b8d3243 | ||
|
|
b06f76512d | ||
|
|
6c2b421b57 | ||
|
|
63b3b4225a | ||
|
|
5b7ad40163 | ||
|
|
1751fb38e5 | ||
|
|
184a2bcf18 | ||
|
|
57fce9d20f | ||
|
|
d354157c0e | ||
|
|
de78e065cb | ||
|
|
17a49b5d8c | ||
|
|
6c6bbf6294 | ||
|
|
72f04367d9 | ||
|
|
7395305f87 | ||
|
|
1c62a665c7 | ||
|
|
518919aeee | ||
|
|
da798b3748 | ||
|
|
441e936d88 | ||
|
|
23def44101 | ||
|
|
35fafdb476 | ||
|
|
0e20e6a0bb | ||
|
|
04654a5c85 | ||
|
|
e17c4e5271 | ||
|
|
4d79b35c47 | ||
|
|
26aeb7dcbd | ||
|
|
7bc3582525 | ||
|
|
1ad00e1102 | ||
|
|
311ad6b940 | ||
|
|
c65f3289a3 | ||
|
|
cfeaf2f376 | ||
|
|
8434e856f4 | ||
|
|
35a700027c | ||
|
|
2196158f58 | ||
|
|
56d5ca180a | ||
|
|
60326b8f65 | ||
|
|
363943583d | ||
|
|
4348889865 | ||
|
|
50e50e82e1 | ||
|
|
fd30f16364 | ||
|
|
21879db549 | ||
|
|
313b9d64f6 | ||
|
|
87be97a38d | ||
|
|
4f5054d792 | ||
|
|
51545c4db0 | ||
|
|
98fb48eb1d | ||
|
|
fa2817ab52 | ||
|
|
2a35601ff4 | ||
|
|
ed70058a1f | ||
|
|
79a1b65547 | ||
|
|
cccddd8455 | ||
|
|
9a4d9f7f1f | ||
|
|
c532f40b7d | ||
|
|
d7e68c340c | ||
|
|
42a985112a | ||
|
|
16a653ed9d | ||
|
|
91f18323be | ||
|
|
09bbb50e1f | ||
|
|
a4eebfeeb2 | ||
|
|
62d19c9d11 | ||
|
|
07142b3052 | ||
|
|
a304bc0eed | ||
|
|
857b7e53d9 | ||
|
|
2987bb129c | ||
|
|
8da9ad696b | ||
|
|
8720d6937a | ||
|
|
9262834ffb | ||
|
|
a41b1a5a2d | ||
|
|
1e362fdd53 | ||
|
|
8dfe166944 | ||
|
|
8d0feea2c2 | ||
|
|
47d9f5920f | ||
|
|
25eca4146c | ||
|
|
61938601fd | ||
|
|
61d114f297 | ||
|
|
eddebfbba5 | ||
|
|
323d828eb7 | ||
|
|
bb763f7315 | ||
|
|
b1d93112da | ||
|
|
56bd3513a3 | ||
|
|
ddcf26058b | ||
|
|
ba4ee3f1fc | ||
|
|
dedfd5cd33 | ||
|
|
b5296f4206 | ||
|
|
e2e2c58d9f | ||
|
|
7a90b9ce23 | ||
|
|
ae0928e686 | ||
|
|
b815ad7a8c | ||
|
|
06cca9033a | ||
|
|
5302364139 | ||
|
|
78b7fc6169 | ||
|
|
b159c30cf1 | ||
|
|
5c7712bf6c | ||
|
|
e64b766599 | ||
|
|
89a852286c | ||
|
|
1e312cfbb1 | ||
|
|
8d4522227c | ||
|
|
eee39a7c0b | ||
|
|
bd58c18bb0 | ||
|
|
685b3a4f21 | ||
|
|
4e82a482d1 | ||
|
|
1214e28563 | ||
|
|
9170ed6e3a | ||
|
|
f2bb8bb8af | ||
|
|
24d74698ef | ||
|
|
ba615c15cb | ||
|
|
88f206e7f5 | ||
|
|
511740ccd7 | ||
|
|
7a2fab1126 | ||
|
|
fd435f0941 | ||
|
|
ffd5a8b321 | ||
|
|
5454e43bc4 | ||
|
|
a94fd2d127 | ||
|
|
14c53c5e3e | ||
|
|
b25648eea1 | ||
|
|
10d0d162b5 | ||
|
|
e5b2be4346 | ||
|
|
4cea442b59 | ||
|
|
532f682fc7 | ||
|
|
c2cd689c32 | ||
|
|
c3e986eb56 | ||
|
|
d91f4c244f | ||
|
|
22b768963f | ||
|
|
57354cd1ef | ||
|
|
c74cc40d5c | ||
|
|
b867a74b6b | ||
|
|
7a10486492 | ||
|
|
f36b833654 | ||
|
|
ef9206088e | ||
|
|
e141b26411 | ||
|
|
1f4da13060 | ||
|
|
4ec85e2f25 | ||
|
|
842831d729 | ||
|
|
39a0b5672b | ||
|
|
2729892676 | ||
|
|
50318354a6 | ||
|
|
77593c8031 | ||
|
|
3bfb9adb99 | ||
|
|
deebf289de | ||
|
|
d4e777900c | ||
|
|
1b44683cfe | ||
|
|
0ff53f0bd7 | ||
|
|
a5cbf08a76 | ||
|
|
023fa8afc9 | ||
|
|
a721748de1 | ||
|
|
ad112285e6 | ||
|
|
fe05ac9753 | ||
|
|
b873162a6f | ||
|
|
846604cce5 | ||
|
|
b1ea970f62 | ||
|
|
5bcfb7f488 | ||
|
|
1908f1b4f6 | ||
|
|
b0bf8e81aa | ||
|
|
4866ba0c84 | ||
|
|
8dadf42504 | ||
|
|
fc18b15106 | ||
|
|
9b4e55be28 | ||
|
|
8a4686984a | ||
|
|
42ebffc4fc | ||
|
|
2d2c596f75 | ||
|
|
fa464b489d | ||
|
|
b531504912 | ||
|
|
e4a346995b | ||
|
|
f0d1f2387d | ||
|
|
7eb592df79 | ||
|
|
a704c0ad35 | ||
|
|
acf4077878 | ||
|
|
ba50771007 | ||
|
|
898db8b7d4 | ||
|
|
d452a00592 | ||
|
|
4ab8fb359b | ||
|
|
29e6082663 | ||
|
|
7c6197b1fc | ||
|
|
1e0e40912b | ||
|
|
ff84638df8 | ||
|
|
90dee9c171 | ||
|
|
53873c7864 | ||
|
|
f60a9708b2 | ||
|
|
84497bfba7 | ||
|
|
4dfd672c04 | ||
|
|
d8b64aa2f4 | ||
|
|
4968100420 | ||
|
|
b52687f356 | ||
|
|
71d4565aa5 | ||
|
|
42ff295092 | ||
|
|
f0758e2a6c | ||
|
|
33e93ea156 | ||
|
|
9f212184fd | ||
|
|
1c16d4bd3f | ||
|
|
0008ffc735 | ||
|
|
e5dce929bb | ||
|
|
40bcf96c2b | ||
|
|
519d4470e3 | ||
|
|
cdf18b5480 | ||
|
|
dbe4965438 | ||
|
|
899b9b07dd | ||
|
|
54d8a03e87 | ||
|
|
052ad87da0 | ||
|
|
2a515b1d8d | ||
|
|
dad48df039 | ||
|
|
ee798df57d | ||
|
|
eed21b8f8f | ||
|
|
29938f5703 | ||
|
|
52bcf97d73 | ||
|
|
9934184f5f | ||
|
|
fdf33cbf81 | ||
|
|
34458bc86e | ||
|
|
9b061b3aa7 | ||
|
|
2fa6acef1c | ||
|
|
3afb1f145a | ||
|
|
b03b75d125 | ||
|
|
b9756f0bdc | ||
|
|
c3234cb79f | ||
|
|
828ab97837 | ||
|
|
ac66510f32 | ||
|
|
599397b6f7 | ||
|
|
e230f5d358 | ||
|
|
91486f1b70 | ||
|
|
95e6de8654 | ||
|
|
784baaec46 | ||
|
|
6adaca568f | ||
|
|
bcdcceb809 | ||
|
|
de3d075ff2 | ||
|
|
c5f3aa21b3 | ||
|
|
9831b0e3d4 | ||
|
|
24a8df801f | ||
|
|
e0cfd404a1 | ||
|
|
0e62c3455b | ||
|
|
9cd5a7926a | ||
|
|
8e4995c8d9 | ||
|
|
ca5fc1e8fc | ||
|
|
14dca4667a | ||
|
|
ebff14adac | ||
|
|
51f02ed46e | ||
|
|
03740d0918 | ||
|
|
c83a16e22e | ||
|
|
e1bf662884 | ||
|
|
d866bc9044 | ||
|
|
fd0e4c20ee | ||
|
|
55ca0a80b6 | ||
|
|
eeaf3dc2cf | ||
|
|
467b948349 | ||
|
|
f368af3d02 | ||
|
|
0f34ee7d16 | ||
|
|
2fe89fc41b | ||
|
|
968942f128 | ||
|
|
b5fae096a9 | ||
|
|
5cad9a1071 | ||
|
|
f4a350c3d0 | ||
|
|
89885ed4d9 | ||
|
|
612878d3b1 | ||
|
|
65d0bb6a90 | ||
|
|
484b440816 | ||
|
|
92d78515c4 | ||
|
|
341bedd7ca | ||
|
|
e9f54f1841 | ||
|
|
4c4af5f1fc | ||
|
|
2558cd9356 | ||
|
|
4670026c92 | ||
|
|
302b9c2ac5 | ||
|
|
000f1d02c3 | ||
|
|
63ce8429f2 | ||
|
|
61993c4a50 | ||
|
|
c248efc9fe | ||
|
|
ec64ca2865 | ||
|
|
d4fe7467b6 | ||
|
|
e8a229103a | ||
|
|
e6cdab37b0 | ||
|
|
26c88ffaec | ||
|
|
abf1c144c5 | ||
|
|
c4e04d6e07 | ||
|
|
ed4826a67f | ||
|
|
dee2df9e45 | ||
|
|
acabd11d40 | ||
|
|
8adea6ba1e | ||
|
|
c36be55c2f | ||
|
|
5355555568 | ||
|
|
176735d4cf | ||
|
|
3e01bca690 | ||
|
|
dd99d96c24 | ||
|
|
22e8c59031 | ||
|
|
44cefc89e4 | ||
|
|
df15249f23 | ||
|
|
b737321cbd | ||
|
|
319380ec6c | ||
|
|
cae7cad5d4 | ||
|
|
d4c7b41897 | ||
|
|
0ecf6b5aa1 | ||
|
|
cb51c03992 | ||
|
|
5dca5fe3cb | ||
|
|
a7acd50159 | ||
|
|
e732ec9fe4 | ||
|
|
e4070c8b5e | ||
|
|
b171b5904b | ||
|
|
cc89c994c8 | ||
|
|
fc2689e207 | ||
|
|
a5979b2e47 | ||
|
|
2eb8e32705 | ||
|
|
b32984b1d6 | ||
|
|
7e2fd9e690 | ||
|
|
a96dac8205 | ||
|
|
6afc2fd75a | ||
|
|
e44bd4684b | ||
|
|
115158a70e | ||
|
|
63577feca4 | ||
|
|
e8b91bf617 | ||
|
|
567e6f1d82 | ||
|
|
2b9b8ce536 | ||
|
|
a0f4cb9271 | ||
|
|
46f24c582c | ||
|
|
2068710a30 | ||
|
|
0568b5c6de | ||
|
|
a0d9b9fbe8 | ||
|
|
2190e449c1 | ||
|
|
f665b56e2b | ||
|
|
041b6abd59 | ||
|
|
fb7ace729c | ||
|
|
a68ed01003 | ||
|
|
95af80acde | ||
|
|
18664b7e7e | ||
|
|
37f9634389 | ||
|
|
a995b76f24 | ||
|
|
cb81e50f71 | ||
|
|
f8ba151b76 | ||
|
|
a0af67fce8 | ||
|
|
1467936c89 | ||
|
|
0d3008b839 | ||
|
|
517821632a | ||
|
|
0ed3e540c2 | ||
|
|
c96bb16db6 | ||
|
|
bd82441883 | ||
|
|
18421cde49 | ||
|
|
6dea26932e | ||
|
|
258768505e | ||
|
|
8caa20b746 | ||
|
|
5efc39af6a | ||
|
|
66daa2eb29 | ||
|
|
02687991e0 | ||
|
|
1e64592a39 | ||
|
|
9d2b074bec | ||
|
|
384a6f3d36 | ||
|
|
754d972253 | ||
|
|
9a29a6de5a | ||
|
|
f6513932b0 | ||
|
|
368f91c4c5 | ||
|
|
f1f40f0289 | ||
|
|
1d6671c11a | ||
|
|
9a0fa2f8b3 | ||
|
|
9b6ec9ffd3 | ||
|
|
e9b8fe5018 | ||
|
|
4a5cec8ed5 | ||
|
|
fa6f0ba77c | ||
|
|
a8fc58e143 | ||
|
|
57961e04b3 | ||
|
|
6628aa7eaf | ||
|
|
b7e492e03d | ||
|
|
2f2dc86c9d | ||
|
|
bfb2ff9390 | ||
|
|
cbd14c4b8c | ||
|
|
cb08660a78 | ||
|
|
87e1b075e0 | ||
|
|
26a3682c6e | ||
|
|
be30a2463a | ||
|
|
cc1df37725 | ||
|
|
3510032050 | ||
|
|
07aecd3a95 | ||
|
|
0e2a96b402 | ||
|
|
603c121874 | ||
|
|
9e634196bf | ||
|
|
4f20ea4570 | ||
|
|
c851708b3d | ||
|
|
fd6a693bc8 | ||
|
|
bab56b4c9d | ||
|
|
970da50910 | ||
|
|
0008e4b645 | ||
|
|
89e7a62d99 | ||
|
|
74e89c542a | ||
|
|
d441483201 | ||
|
|
f11d4fa613 | ||
|
|
11f9880ccf | ||
|
|
8c440961c5 | ||
|
|
8f5d7da934 | ||
|
|
807347da80 | ||
|
|
9364491316 | ||
|
|
255e12849e | ||
|
|
5c0fe81dcf | ||
|
|
e34dee8852 | ||
|
|
a803420576 | ||
|
|
a1939bc295 | ||
|
|
8c7bbd937f | ||
|
|
c87b2eaf7b | ||
|
|
f156718d86 | ||
|
|
9cabfacb99 | ||
|
|
377237d7c0 | ||
|
|
13f2611b25 | ||
|
|
519dfd3be7 | ||
|
|
c9c8d23ed5 | ||
|
|
ed4ceb41b5 | ||
|
|
fb4643630b | ||
|
|
999c3be21a | ||
|
|
0793a0638e | ||
|
|
8ad1d93cc6 | ||
|
|
afb4c9a00d | ||
|
|
93d9516a07 | ||
|
|
7950f23b6d | ||
|
|
178e206d19 | ||
|
|
d157308306 | ||
|
|
261eb19fea | ||
|
|
6a973421e3 | ||
|
|
325110c0cd | ||
|
|
184360925d | ||
|
|
58710196ca | ||
|
|
a3c57a01d6 | ||
|
|
63d26c2a51 | ||
|
|
8cd824f66f | ||
|
|
1652990324 | ||
|
|
28221e398e | ||
|
|
49fde8158f | ||
|
|
59d1526a88 | ||
|
|
36fdf1f67b | ||
|
|
a2771c262b | ||
|
|
de4e753429 | ||
|
|
cac9104769 | ||
|
|
f56cb03a09 | ||
|
|
911d3ad722 | ||
|
|
72a1984331 | ||
|
|
67035b8422 | ||
|
|
1c9416fbed | ||
|
|
cf25ced2e6 | ||
|
|
4003697850 | ||
|
|
7f48c7abbe | ||
|
|
b8d924ab6f | ||
|
|
b58a4e90da | ||
|
|
f781da41a4 | ||
|
|
c0695e80a8 | ||
|
|
019363e56b | ||
|
|
bf76567fdf | ||
|
|
e64250c519 | ||
|
|
4d190cd055 | ||
|
|
fe02fd7284 | ||
|
|
d73ced98ad | ||
|
|
ee5f915cca | ||
|
|
d801f1f5fb | ||
|
|
bd32afbed2 | ||
|
|
226d98cf6b | ||
|
|
dc3b4d3770 | ||
|
|
409169061e | ||
|
|
c539166747 | ||
|
|
2bb199bc25 | ||
|
|
6da9c50b9d | ||
|
|
8118f781d9 | ||
|
|
2e2f28d1bb | ||
|
|
316bb91625 | ||
|
|
263adb157c | ||
|
|
18937bdcc4 | ||
|
|
948d7498bd | ||
|
|
59ff18b508 | ||
|
|
baa9501c65 | ||
|
|
5c44f55ef6 | ||
|
|
095778cf0f | ||
|
|
2cec3f29d1 | ||
|
|
9523b88d77 | ||
|
|
6bcab179d1 | ||
|
|
fc1fdab51a | ||
|
|
f9bb3defde | ||
|
|
6075a92905 | ||
|
|
f495edfb3a | ||
|
|
6af47fa6ee | ||
|
|
972789dba3 | ||
|
|
cec1ed8d3d | ||
|
|
374963167a | ||
|
|
ccb5826a25 | ||
|
|
527aed0ea3 | ||
|
|
a8e266377c | ||
|
|
de57dc9410 | ||
|
|
617f0c8c17 | ||
|
|
2e73199153 | ||
|
|
5b0b674988 | ||
|
|
d85a74570d | ||
|
|
bb1f8aab24 | ||
|
|
0c4fb36827 | ||
|
|
ec2017ff72 | ||
|
|
f3cc0a07bc | ||
|
|
5e2dc95331 | ||
|
|
ee99abc266 | ||
|
|
cbf4ab797d | ||
|
|
bbe0bfadd9 | ||
|
|
35414e0afd | ||
|
|
90e99aac3b | ||
|
|
59506a97d6 | ||
|
|
ebf9b0e4f1 | ||
|
|
b85a8b8b0b | ||
|
|
f8029a6dc9 | ||
|
|
95eb9afeef | ||
|
|
87024f0426 | ||
|
|
09697f2593 | ||
|
|
e99e9f3e40 | ||
|
|
b8c05e551d | ||
|
|
829eb7d3a2 | ||
|
|
268080cbc5 | ||
|
|
8d9d0dd826 | ||
|
|
195c201f87 | ||
|
|
ceb0fc4db9 | ||
|
|
6121a9b48c | ||
|
|
e3138154f1 | ||
|
|
ac6c7f6a35 | ||
|
|
af6e31dcdf | ||
|
|
6f158e3382 | ||
|
|
81504bba1e | ||
|
|
66bedf46a1 | ||
|
|
a196ac03b1 | ||
|
|
ae1010166a | ||
|
|
a548212f27 | ||
|
|
1aeb6d0d9e | ||
|
|
612c963105 | ||
|
|
173a60eac6 | ||
|
|
8411efc8ef | ||
|
|
af8fe35222 | ||
|
|
a0e5f64ddf | ||
|
|
c80f0d317a | ||
|
|
e5a9159282 | ||
|
|
8215791051 | ||
|
|
ab62abed79 | ||
|
|
b31356aada | ||
|
|
b0db219aeb | ||
|
|
20a7c550fe | ||
|
|
2eb190dbbb | ||
|
|
d97360ef52 | ||
|
|
fab64c61c4 | ||
|
|
b9fea2ea12 | ||
|
|
adc4ae48d6 | ||
|
|
e7549a2887 | ||
|
|
f28507a366 | ||
|
|
a1b2c011f5 | ||
|
|
b8ee051f8f | ||
|
|
06e34c88b5 | ||
|
|
9866b92405 | ||
|
|
d1846217fd | ||
|
|
aa82f3637b | ||
|
|
731684f22f | ||
|
|
48b84270c4 | ||
|
|
acc4bbf628 | ||
|
|
1718c3bc16 | ||
|
|
235fa57423 | ||
|
|
90f0ebde1d | ||
|
|
e016725814 | ||
|
|
3f449a40ad | ||
|
|
e92726bdb3 | ||
|
|
45fe70d8ed | ||
|
|
e833e5d86d | ||
|
|
3dff5cb99f | ||
|
|
666d09e296 | ||
|
|
6e1e49a185 | ||
|
|
15c13ece27 | ||
|
|
754efefd32 | ||
|
|
f81e69f73c | ||
|
|
dd8e73e8f2 | ||
|
|
660520b939 | ||
|
|
a1c3096556 | ||
|
|
8cd9dea821 | ||
|
|
0cf64a7dde | ||
|
|
53aff4fbbb | ||
|
|
78789fad1c | ||
|
|
3c54d844b2 | ||
|
|
d8e27abff9 | ||
|
|
b7b8f9caa6 | ||
|
|
7e1cd47a4e | ||
|
|
badbd846c2 | ||
|
|
e08089ba3e | ||
|
|
27f57ce0b3 | ||
|
|
8aa773df9a | ||
|
|
8fb19d24e8 | ||
|
|
fd1376be53 | ||
|
|
051f0fd377 | ||
|
|
954644a001 | ||
|
|
19fcbf8f25 | ||
|
|
c1e2c20ace | ||
|
|
09dbbc17e4 | ||
|
|
4d9db3665f | ||
|
|
625f19ae00 | ||
|
|
dcc715d75d | ||
|
|
e8717498b5 | ||
|
|
ecfbbb39bd | ||
|
|
2cd8f56842 | ||
|
|
588b9737bf | ||
|
|
22d540caaa | ||
|
|
2dead0306a | ||
|
|
b77fa9f627 | ||
|
|
6a29eecf8d | ||
|
|
049e9f1a55 | ||
|
|
dcb995c626 | ||
|
|
6200f5fb62 | ||
|
|
cc27c19c66 | ||
|
|
23dc818eac | ||
|
|
311d40a9f1 | ||
|
|
ad4d2831c9 | ||
|
|
ee9c959262 | ||
|
|
b739603a3c | ||
|
|
153701133d | ||
|
|
d8704edc7f | ||
|
|
57f6b2d122 | ||
|
|
21c41fb145 | ||
|
|
12d35a39c7 | ||
|
|
11aa9f7b79 | ||
|
|
23ae3ad8ad | ||
|
|
84d468ad2f | ||
|
|
0459612632 | ||
|
|
7dfa4bcdb5 | ||
|
|
a3e73508f4 | ||
|
|
df120ec4a3 | ||
|
|
6dfa6a3710 | ||
|
|
7ae39a00cb | ||
|
|
0cbcbe3e69 | ||
|
|
47debc0223 | ||
|
|
5953f08495 | ||
|
|
43276582ed | ||
|
|
2c3d7871ff | ||
|
|
112f10a16d | ||
|
|
28beefcbb8 | ||
|
|
edcff1068b | ||
|
|
266f23d1e6 | ||
|
|
c4dfd24782 | ||
|
|
9ae2de6dc1 | ||
|
|
45fd6f89c0 | ||
|
|
b1ba4b505a | ||
|
|
99e6cf4796 | ||
|
|
4df5752df7 | ||
|
|
7a2837b6c9 | ||
|
|
dc08805307 | ||
|
|
2ffebb9c0b | ||
|
|
2553a51408 | ||
|
|
e2a338c3c9 | ||
|
|
795f4cd7a7 | ||
|
|
932fa22701 | ||
|
|
5c746ad3d4 | ||
|
|
d0c8a80e5e | ||
|
|
da40f7ab07 | ||
|
|
f4c42a5d39 | ||
|
|
7b3a752ad9 | ||
|
|
ad861e7da1 | ||
|
|
17e8cf8aaa | ||
|
|
6773f1e152 | ||
|
|
928b95861d | ||
|
|
f274abcc8d | ||
|
|
5a725af1bb | ||
|
|
b0d5c8870a | ||
|
|
fb14a49dd5 | ||
|
|
b6d2ec3bea | ||
|
|
3fd5b77de8 | ||
|
|
b060039a28 | ||
|
|
ba84e8bc33 | ||
|
|
cba111c055 | ||
|
|
a1f4c3506d | ||
|
|
a4e0abf7bc | ||
|
|
7058bb5e12 | ||
|
|
43d4d3cddc | ||
|
|
c4804f427f | ||
|
|
430ef5d1a6 | ||
|
|
d8fb4304b7 | ||
|
|
caf5ee7412 | ||
|
|
2acfbcdce6 | ||
|
|
c687c5df24 | ||
|
|
f63db81268 | ||
|
|
00de9bbbc5 | ||
|
|
825db1158c | ||
|
|
b5bff64cf0 | ||
|
|
c5255872ca | ||
|
|
9920f44a90 | ||
|
|
f5bbc43c87 | ||
|
|
7076809b71 | ||
|
|
34b7cda2ec | ||
|
|
f2cd90a999 | ||
|
|
2c35c63a09 | ||
|
|
7832a6eb6f | ||
|
|
e1c3dda6e0 | ||
|
|
f11c015522 | ||
|
|
9cd23bc02b | ||
|
|
8c0ab4285b | ||
|
|
3cbc5aaf2d | ||
|
|
c43aae15ff | ||
|
|
2fd3ded6e2 | ||
|
|
cb6d727664 | ||
|
|
3be2047c9c | ||
|
|
b3ec9a0900 | ||
|
|
50cf830404 | ||
|
|
72e58a7f0d | ||
|
|
36781c0bc6 | ||
|
|
12ca7d0fe2 | ||
|
|
b85066eb06 | ||
|
|
456705de54 | ||
|
|
31b500cc7f | ||
|
|
03d0011c2f | ||
|
|
101088cadc | ||
|
|
638702728c | ||
|
|
015a0888d4 | ||
|
|
361eaeca07 | ||
|
|
6850c2a9ee | ||
|
|
12af387e50 | ||
|
|
55216be46b | ||
|
|
7630642c56 | ||
|
|
ad8fe7923a | ||
|
|
f06b4f70f9 | ||
|
|
408ecda944 | ||
|
|
95844cd6c0 | ||
|
|
cf4824e588 | ||
|
|
c99aaf763d | ||
|
|
1156027587 | ||
|
|
46c6d43556 | ||
|
|
07fccd0479 | ||
|
|
10e4fe7a71 | ||
|
|
5f37891eae | ||
|
|
f09644be00 | ||
|
|
96e573b356 | ||
|
|
bed63b55fe | ||
|
|
0a8ac5cb05 | ||
|
|
590d7cc79b | ||
|
|
aeeaa18b28 | ||
|
|
d6a6f1ed51 | ||
|
|
68bf5d5105 | ||
|
|
78d5f6f598 | ||
|
|
fa8c6dfa6f | ||
|
|
15d3bc70d2 | ||
|
|
c37b52645c | ||
|
|
e6f61699d7 | ||
|
|
6cdf61d6cf | ||
|
|
60dee64fa0 | ||
|
|
21f4ba4f3a | ||
|
|
df4777dca4 | ||
|
|
03b8e98cb2 | ||
|
|
fafe2374b7 | ||
|
|
1840fac000 | ||
|
|
ec460ff07a | ||
|
|
b0e68366d4 | ||
|
|
99266e4ea9 | ||
|
|
34025599a0 | ||
|
|
21f34b8039 | ||
|
|
30b3a4c9c7 | ||
|
|
7ca2f7d6b1 | ||
|
|
7a6ac1f6d0 | ||
|
|
e53f0a3191 | ||
|
|
54b28ae356 | ||
|
|
22b7181c40 | ||
|
|
daf6a856c7 | ||
|
|
4e2baa0868 | ||
|
|
6b48084c9c | ||
|
|
1e48959c0a | ||
|
|
088c37d1ea | ||
|
|
18dcc21340 | ||
|
|
e03c1d4c85 | ||
|
|
9fb85f252e | ||
|
|
c7601c9921 | ||
|
|
eab2bd3565 | ||
|
|
4454c6be73 | ||
|
|
0adf8a0a05 | ||
|
|
bdf59c1a5f | ||
|
|
e317926fcb | ||
|
|
1487a0ecd2 | ||
|
|
950d2689c7 | ||
|
|
8687ed6697 | ||
|
|
ab9c0dab04 | ||
|
|
45e2819694 | ||
|
|
0187a0cace | ||
|
|
9d714ba9e0 | ||
|
|
a614434c04 | ||
|
|
0fbfee521f | ||
|
|
d2233acc44 | ||
|
|
4b86741683 | ||
|
|
26bf91e1da | ||
|
|
37eab31b40 | ||
|
|
39aa548586 | ||
|
|
a228b36e8e | ||
|
|
7d33a1572e | ||
|
|
5ccbf0042c | ||
|
|
0313ea636a | ||
|
|
d7a5db3dbb | ||
|
|
82435bf6ff | ||
|
|
e56a4ed9e2 | ||
|
|
52ef16dba5 | ||
|
|
e4713edd75 | ||
|
|
5abe72f7e7 | ||
|
|
fdeb07f82b | ||
|
|
44b59eea58 | ||
|
|
f8bf2f38d3 | ||
|
|
091854a6d0 | ||
|
|
fd55aa61cf | ||
|
|
7bd014f9de | ||
|
|
793ef35c95 | ||
|
|
d8eb8499ef | ||
|
|
ad98339de7 | ||
|
|
d121326382 | ||
|
|
bd9e689885 | ||
|
|
79dcf6d63b | ||
|
|
3390a26588 | ||
|
|
93d1cd3ee7 | ||
|
|
4b3cfc5de1 | ||
|
|
f9d38fdd69 | ||
|
|
628c375b8c | ||
|
|
714c884732 | ||
|
|
f6dffe9845 | ||
|
|
a28b3cc268 | ||
|
|
388dd99986 | ||
|
|
1081b6a1c0 | ||
|
|
80d93b1fc9 | ||
|
|
3980fe5de1 | ||
|
|
b374b1ef7a | ||
|
|
09a7865e7d | ||
|
|
2f9a399d18 | ||
|
|
bbda3955c3 | ||
|
|
ba42932024 | ||
|
|
f7c8bd6d1c | ||
|
|
35479575ec | ||
|
|
23a4aab3c4 | ||
|
|
ec5bd18b67 | ||
|
|
d5750bf329 | ||
|
|
ac55d35b13 | ||
|
|
a1c27049d6 | ||
|
|
8b36b29126 | ||
|
|
c0e75ac6b4 | ||
|
|
897f3a86c5 | ||
|
|
58025d3b01 | ||
|
|
591197422d | ||
|
|
027b1f711c | ||
|
|
5f15a0f555 | ||
|
|
c46238301a | ||
|
|
7c282d28df | ||
|
|
587251e73c | ||
|
|
12dbafd0c9 | ||
|
|
3c822399b1 | ||
|
|
ae7252fbec | ||
|
|
13dfde1862 | ||
|
|
3a0aef3779 | ||
|
|
a82cc8cbd4 | ||
|
|
6e6701a644 | ||
|
|
b6b74e292f | ||
|
|
db0dfdcd59 | ||
|
|
fc49643860 | ||
|
|
7968c1dcd2 | ||
|
|
b9180798ca | ||
|
|
8ed0888ea8 | ||
|
|
e5d941f98b | ||
|
|
62f434f0e0 | ||
|
|
829451486e | ||
|
|
0da1a293e6 | ||
|
|
a51ccad560 | ||
|
|
b8ab30fc22 | ||
|
|
915bc6c7cd | ||
|
|
0bc55a5185 | ||
|
|
07c2973459 | ||
|
|
2bc8722049 | ||
|
|
84259fd9d8 | ||
|
|
31474b581b | ||
|
|
2fc71c762a | ||
|
|
a541e6db1f | ||
|
|
a4aab9f4c2 | ||
|
|
2d6abc088f | ||
|
|
a1f3d42fd0 | ||
|
|
915e72584c | ||
|
|
22ef3c8b2a | ||
|
|
0936793b23 | ||
|
|
8bbdf56cb0 | ||
|
|
25fd939bc6 | ||
|
|
5e4f31fe84 | ||
|
|
5638b4f889 | ||
|
|
2f28a7f3f2 | ||
|
|
9f3137e509 | ||
|
|
32c91f56f3 | ||
|
|
c81284754f | ||
|
|
e300546a32 | ||
|
|
ce0f62d598 | ||
|
|
18e1987a6a | ||
|
|
626c12c8a3 | ||
|
|
8e8fb9cfe8 | ||
|
|
c0c3f2c9ba | ||
|
|
7e4846b83c | ||
|
|
adcd0e2936 | ||
|
|
2a02a2e40b | ||
|
|
8b8953b98c | ||
|
|
05baa544bc | ||
|
|
95aee6eb37 | ||
|
|
d348c0e794 | ||
|
|
bdc25e4fb5 | ||
|
|
f864fba78b | ||
|
|
ec34261674 | ||
|
|
119965a7fb | ||
|
|
24c672ddc9 | ||
|
|
56578c7c0c | ||
|
|
fdc78b5c32 | ||
|
|
3585223827 | ||
|
|
13bdb881c7 | ||
|
|
12c46c794f | ||
|
|
3b839ebd1f | ||
|
|
04d5c98756 | ||
|
|
2cce4bf2a8 | ||
|
|
15560229ce | ||
|
|
20317e5830 | ||
|
|
2bf1de5a43 | ||
|
|
7306ce09b4 | ||
|
|
846bcf3ef5 | ||
|
|
69b69da52a | ||
|
|
7a7be6e454 | ||
|
|
3587e450a3 | ||
|
|
0b8001eac2 | ||
|
|
8235c6d4fc | ||
|
|
aed88bd857 | ||
|
|
8fcca219b4 | ||
|
|
4b16ed6bdd | ||
|
|
3ad7901edb | ||
|
|
a684823f25 | ||
|
|
90a03c5096 | ||
|
|
46f8f3c27e | ||
|
|
3569a85488 | ||
|
|
9a0942e9b2 | ||
|
|
26725bd878 | ||
|
|
ae01148b76 | ||
|
|
1269959265 | ||
|
|
a471d68d6c | ||
|
|
2eb8859080 | ||
|
|
038fe07fd4 | ||
|
|
578b899653 | ||
|
|
32e0151f7d | ||
|
|
43cf02d5b8 | ||
|
|
d60a1193b2 | ||
|
|
806e0b6d7f | ||
|
|
74434e87c5 | ||
|
|
41935d8b48 | ||
|
|
8a93c7472f | ||
|
|
687737f71a | ||
|
|
c4296f0127 | ||
|
|
933e8d4409 | ||
|
|
28950473b2 | ||
|
|
6a478ca315 | ||
|
|
03d4175bea | ||
|
|
25abdef96a | ||
|
|
a01d8548e3 | ||
|
|
c1946e57b7 | ||
|
|
811ed6efe5 | ||
|
|
6855a0afbe | ||
|
|
f9e68a0c9c | ||
|
|
f1ecdfc9df | ||
|
|
01fc9f6130 | ||
|
|
a2c3f74ab2 | ||
|
|
11301d7b63 | ||
|
|
1d2e1d9950 | ||
|
|
47938a2278 | ||
|
|
6922ad04a9 | ||
|
|
cc24e73483 | ||
|
|
59fed5c756 | ||
|
|
f93e7579bc | ||
|
|
a617053d97 | ||
|
|
3ebd5a95d4 | ||
|
|
4f4ecbf819 | ||
|
|
cb81b63524 | ||
|
|
8bd3512bc8 | ||
|
|
7f0d3c89bd | ||
|
|
f4d87458dd | ||
|
|
2c3c80e45c | ||
|
|
1a24193d2c | ||
|
|
92ac40e4da | ||
|
|
fcc316674e | ||
|
|
a0237d4259 | ||
|
|
bf061b9d4f | ||
|
|
6f3b5b1c61 | ||
|
|
1244b6b283 | ||
|
|
b01303f5ae | ||
|
|
3a9d5730e5 | ||
|
|
17a8a5984b | ||
|
|
0cd2c067b6 | ||
|
|
b4342492d5 | ||
|
|
ccbbdd280d | ||
|
|
ada209dc75 | ||
|
|
a602e3c88a | ||
|
|
b507d527e3 | ||
|
|
6d1ce4bca2 | ||
|
|
36eda331d1 | ||
|
|
a2eca89fb8 | ||
|
|
a555ba09f1 | ||
|
|
313104a01b | ||
|
|
744d2a535f | ||
|
|
f08d9d2775 | ||
|
|
224cf9b88d | ||
|
|
5ba06a74a0 | ||
|
|
1f14cc35dd | ||
|
|
4953307e1e | ||
|
|
b33d429212 | ||
|
|
d3a17b64f4 | ||
|
|
5a572b25a0 | ||
|
|
03187804c4 | ||
|
|
99b005f0cc | ||
|
|
7bf5d027bf | ||
|
|
e6f7cc8d74 | ||
|
|
4224c01925 | ||
|
|
ea85d577d8 | ||
|
|
add0e43723 | ||
|
|
e7378cbba0 | ||
|
|
dc58ff19d4 | ||
|
|
7bce331eb1 | ||
|
|
141dc247d6 | ||
|
|
dda8df678a | ||
|
|
e06abbc354 | ||
|
|
26938c245b | ||
|
|
54e9803080 | ||
|
|
bf30c7cb01 | ||
|
|
32f063fd2b | ||
|
|
e4c27a31fa | ||
|
|
365e44e376 | ||
|
|
7e55a8558a | ||
|
|
e38b007743 | ||
|
|
f2dd248200 | ||
|
|
ce8673e7e2 | ||
|
|
aaf4deee2c | ||
|
|
7a0895f872 | ||
|
|
d052c32f7a | ||
|
|
07dbee52cd | ||
|
|
aa8b1f39b3 | ||
|
|
849c550191 | ||
|
|
41cdb4911c | ||
|
|
15c4efcbe4 | ||
|
|
6b776f0b92 | ||
|
|
b8005deaa4 | ||
|
|
2fc35e2543 | ||
|
|
e7fcfff370 | ||
|
|
4bc9033205 | ||
|
|
8673550b69 | ||
|
|
e47ed9c012 | ||
|
|
bdd58a50b1 | ||
|
|
e3d8deba0c | ||
|
|
b386832256 | ||
|
|
26564cfeda | ||
|
|
78e560318d | ||
|
|
7a88044edb | ||
|
|
cc06968c42 | ||
|
|
ae7c89d746 | ||
|
|
0c525a8e52 | ||
|
|
4ac562a55a | ||
|
|
5180673b6d | ||
|
|
f573046107 | ||
|
|
a24878209b | ||
|
|
f12d69a4f6 | ||
|
|
4a1706ede6 | ||
|
|
f5cb34f506 | ||
|
|
2f1e758eb4 | ||
|
|
f825f43528 | ||
|
|
8f1844921e | ||
|
|
1cd887d3ec | ||
|
|
0bb53a73a8 | ||
|
|
6ede5dda6b | ||
|
|
3dbf92bb58 | ||
|
|
f447d7f423 | ||
|
|
a3f6a330e2 | ||
|
|
0c26670bf6 | ||
|
|
97884af83d | ||
|
|
946df5f8d6 | ||
|
|
e98a12c797 | ||
|
|
7444870741 | ||
|
|
2bcf6a5da8 | ||
|
|
b77fa8d57b | ||
|
|
cfd6f063e1 | ||
|
|
a8906da890 | ||
|
|
b63046b20a | ||
|
|
df91e31397 | ||
|
|
b40622c093 | ||
|
|
a925aac1df | ||
|
|
2081b6a4a8 | ||
|
|
7b66f5afb3 | ||
|
|
a14da417a7 | ||
|
|
5af4e1db67 | ||
|
|
e90e0f7d57 | ||
|
|
eac0901af0 | ||
|
|
79f3f69827 | ||
|
|
7c0ca54249 | ||
|
|
d10d4220a8 | ||
|
|
ab8ef25f89 | ||
|
|
8ff60854ac | ||
|
|
41938a5f16 | ||
|
|
10f8a2e807 | ||
|
|
2d8de7009b | ||
|
|
88cc17b530 | ||
|
|
df09d0c8bb | ||
|
|
749aa28b9a | ||
|
|
912ec6a9e9 | ||
|
|
e49957b2b2 | ||
|
|
06e74ffb47 | ||
|
|
4ebbc638da | ||
|
|
757fbbdd88 | ||
|
|
c73965f69a | ||
|
|
2af0f73473 | ||
|
|
305ecf8a7c | ||
|
|
da56090604 | ||
|
|
98eb5640ed | ||
|
|
1e1b1baad5 | ||
|
|
a68103e8ba | ||
|
|
3438addf6c | ||
|
|
6fc7c4e2c0 | ||
|
|
dc7537ac0a | ||
|
|
d7a83f3361 | ||
|
|
5e75b1e7dc | ||
|
|
a11a16a700 | ||
|
|
a3de8281ef | ||
|
|
7960528464 | ||
|
|
a8b067885f | ||
|
|
945fabbdd6 | ||
|
|
c12bf0aead | ||
|
|
12f25ddafd | ||
|
|
55f07e913a | ||
|
|
0bd22281f7 | ||
|
|
72ab62b21b | ||
|
|
796d30d863 | ||
|
|
b191323e2b | ||
|
|
e4ae0988a4 | ||
|
|
238ebdeed8 | ||
|
|
68ebe1a4ff | ||
|
|
8a89be6999 | ||
|
|
0620fc9f17 | ||
|
|
1e95e38505 | ||
|
|
5b4e5f9d1d | ||
|
|
6285fd9f98 | ||
|
|
401d5cab66 | ||
|
|
d7e2df5ca9 | ||
|
|
b38177bb32 | ||
|
|
27b9cbda38 | ||
|
|
a71e08ad2a | ||
|
|
5e0c9165ba | ||
|
|
cb2a6cd3b5 | ||
|
|
81c0e73751 | ||
|
|
6f12594b3e | ||
|
|
5a296b1238 | ||
|
|
249456c916 | ||
|
|
5aa2554584 | ||
|
|
9999ced817 | ||
|
|
6c137b29c2 | ||
|
|
854c070b82 | ||
|
|
6a5a4664e9 | ||
|
|
5aaecd3946 | ||
|
|
425310710f | ||
|
|
af990fb666 | ||
|
|
c0b2669c46 | ||
|
|
edc615f487 | ||
|
|
04b8b8dd5a | ||
|
|
34ef36544e | ||
|
|
4a9deadcf4 | ||
|
|
e1eb1d705a | ||
|
|
ab035a3887 | ||
|
|
c92f0f3edf | ||
|
|
ceb73730c2 | ||
|
|
60e0a731ad | ||
|
|
d9e77284c1 | ||
|
|
4d9c7d0dcb | ||
|
|
936d2e56ea | ||
|
|
4be1923921 | ||
|
|
7bb5866164 | ||
|
|
0f2854fe17 | ||
|
|
548b2f4b77 | ||
|
|
cd776e4b64 | ||
|
|
aeca4c0f9c | ||
|
|
d96b1bb9f8 | ||
|
|
944bdd5bba | ||
|
|
e61550841b | ||
|
|
ff5e171d4a | ||
|
|
b5bb92459d | ||
|
|
b9ea94e9be | ||
|
|
f42186f7c9 | ||
|
|
b510bff195 | ||
|
|
c1b85c0d21 | ||
|
|
08f84bdc07 | ||
|
|
187c93377f | ||
|
|
eb4b85dc79 | ||
|
|
36d7bf77e3 | ||
|
|
2a47e5f32c | ||
|
|
b522abffb5 | ||
|
|
ba272061b7 | ||
|
|
142542da1e | ||
|
|
c79c4d265c | ||
|
|
95289f1715 | ||
|
|
a35d5c4c3a | ||
|
|
c6fd36b75d | ||
|
|
985eb69c50 | ||
|
|
17912ebffe | ||
|
|
a9b41d4a21 | ||
|
|
0b020ce1ac | ||
|
|
580532aeca | ||
|
|
8c43047c95 | ||
|
|
05aeef0ea0 | ||
|
|
ced9493069 | ||
|
|
76ab3fd1ab | ||
|
|
7d6fcda03e | ||
|
|
a7d2c1137c | ||
|
|
033ad18779 | ||
|
|
404706a3db | ||
|
|
2c3bf06740 | ||
|
|
a132b58227 | ||
|
|
8d91141d6a | ||
|
|
a8ac895998 | ||
|
|
ee8aa1d9c6 | ||
|
|
206e45214f | ||
|
|
ba2aef0468 | ||
|
|
7642b522f9 | ||
|
|
b8960c4549 | ||
|
|
358b823e00 | ||
|
|
aa3a95f528 | ||
|
|
00a1eebf60 | ||
|
|
b6587da081 | ||
|
|
bcd6e6767a | ||
|
|
7d21772f87 | ||
|
|
949d706eaa | ||
|
|
c8445b9b5f | ||
|
|
d3c901678c | ||
|
|
1549affd5c | ||
|
|
f9e875a7cc | ||
|
|
5b65279a0a | ||
|
|
ccd58d2909 | ||
|
|
714f56c17c | ||
|
|
a820a96996 | ||
|
|
1d77523e41 | ||
|
|
107c1529ff | ||
|
|
a7f80ef144 | ||
|
|
9274864a83 | ||
|
|
f51bbd8a39 | ||
|
|
1534e1a1ee | ||
|
|
0c9c176223 | ||
|
|
e58ed7a3dc | ||
|
|
adde65f757 | ||
|
|
b45939ed26 | ||
|
|
3de4920385 | ||
|
|
0ab4df99b7 | ||
|
|
adaabcb8e5 | ||
|
|
68403ee142 | ||
|
|
1eb0040126 | ||
|
|
6cca2fd991 | ||
|
|
f276ab830a | ||
|
|
2d3f45bad5 | ||
|
|
30259c4360 | ||
|
|
cfa091dbc4 | ||
|
|
eb18f474c8 | ||
|
|
6554a027d7 | ||
|
|
0e83f0b217 | ||
|
|
b45d6945b1 | ||
|
|
c2e32c0bf2 | ||
|
|
926b9b1d1a | ||
|
|
57b51cec9c | ||
|
|
ebfcc2e23a | ||
|
|
980b3234d5 | ||
|
|
a25b914085 | ||
|
|
c936000d62 | ||
|
|
e1f3adafb7 | ||
|
|
4745eb190a | ||
|
|
d78784e45e | ||
|
|
6e60ff2062 | ||
|
|
b8c1c1ef1e | ||
|
|
d918f0fb03 | ||
|
|
91d6880218 | ||
|
|
ea30075602 | ||
|
|
a00ca647f5 | ||
|
|
f6260087c3 | ||
|
|
81e1d86047 | ||
|
|
988ac8e60b | ||
|
|
cc624f9ed2 | ||
|
|
8d2984c572 | ||
|
|
29d4396956 | ||
|
|
0ba0023099 | ||
|
|
2ef26e9681 | ||
|
|
3be6b6966b | ||
|
|
415aeb1ef5 | ||
|
|
2fc25e9b13 | ||
|
|
00a032e6b0 | ||
|
|
04ab95ab76 | ||
|
|
2f3c7eb550 | ||
|
|
dce6d50350 | ||
|
|
6ac63436f7 | ||
|
|
03979d8665 | ||
|
|
8991232681 | ||
|
|
31a0604341 | ||
|
|
8b6ac9c736 | ||
|
|
ac5279fa70 | ||
|
|
ed2ea88cb5 | ||
|
|
f2a7706bdf | ||
|
|
b88d2fe111 | ||
|
|
9b9b4d4bdf | ||
|
|
41037eb425 | ||
|
|
ba126f1f1a | ||
|
|
88894a6d54 | ||
|
|
61cb276b94 | ||
|
|
f83f5455c2 | ||
|
|
09e409cb79 | ||
|
|
39e3cba80e | ||
|
|
8246f1c990 | ||
|
|
10c32381d4 | ||
|
|
5b6efbbb5f | ||
|
|
5edb5276f8 | ||
|
|
b1109780ed | ||
|
|
62070c50ff | ||
|
|
8332dc188a | ||
|
|
3e28fd69b3 | ||
|
|
4cf6f7bd7c | ||
|
|
a2b0a57971 | ||
|
|
df7d5c6075 | ||
|
|
e6f9811162 | ||
|
|
7625c75dc7 | ||
|
|
07ab79d8dd | ||
|
|
54f8550229 | ||
|
|
f6ae7587ea | ||
|
|
2d78d04d52 | ||
|
|
5a26ee2ca9 | ||
|
|
8971d7b876 | ||
|
|
158894c7cc | ||
|
|
589f98bcc2 | ||
|
|
9b250b0dda | ||
|
|
ebe147ee34 | ||
|
|
4cd0334ed1 | ||
|
|
c49506e588 | ||
|
|
238f5a9af3 | ||
|
|
5d81d0e640 | ||
|
|
4baa0b102d | ||
|
|
0cd17f15d7 | ||
|
|
1fa08bbbc3 | ||
|
|
9e06242c1d | ||
|
|
5b7006d695 | ||
|
|
cd3273bb51 | ||
|
|
917ad5f750 | ||
|
|
29ee22f6cc | ||
|
|
4ad8157ba0 | ||
|
|
69a8bd1761 | ||
|
|
2bdeae0ddb | ||
|
|
0fb1eec3cd | ||
|
|
243d6ebd2c | ||
|
|
6b2882fe47 | ||
|
|
6ad8dc7f3e | ||
|
|
fcedab74c0 | ||
|
|
7404c642e3 | ||
|
|
d922961112 | ||
|
|
c679970832 | ||
|
|
8393cd4b86 | ||
|
|
42125c756e | ||
|
|
447df0af17 | ||
|
|
38d5646975 | ||
|
|
b16656bd23 | ||
|
|
0f987916b7 | ||
|
|
21e419ff8a | ||
|
|
d2acc351a2 | ||
|
|
faa076c1e9 | ||
|
|
1eac28a145 | ||
|
|
df7791a3e7 | ||
|
|
176a23fe97 | ||
|
|
548ff068fd | ||
|
|
50ce433bcb | ||
|
|
d8ada8c9d3 | ||
|
|
f04972a902 | ||
|
|
0b2ec35324 | ||
|
|
77278e77eb | ||
|
|
c6f2c8a3f5 | ||
|
|
e037972dbb | ||
|
|
ba24c55d41 | ||
|
|
034a24dfe3 | ||
|
|
9f7851a178 | ||
|
|
7ea2d7d1ab | ||
|
|
8ecfb872b6 | ||
|
|
2a91ab07b9 | ||
|
|
111d11a71b | ||
|
|
6aeee05e8a | ||
|
|
472586e772 | ||
|
|
4f15322cec | ||
|
|
0e46ff2b6d | ||
|
|
fcf90a053a | ||
|
|
b9e19e84d4 | ||
|
|
1fc60cf410 | ||
|
|
21bc1fd5a6 | ||
|
|
3989f0c332 | ||
|
|
23ffef8943 | ||
|
|
c3105fa66f | ||
|
|
8b09b2cdba | ||
|
|
315426a4b6 | ||
|
|
51d948fc29 | ||
|
|
68f4f011b7 | ||
|
|
ebdd6c5a4d | ||
|
|
deda8dcd97 | ||
|
|
f19f29a4bd | ||
|
|
0677a8a21a | ||
|
|
b3c12c33b7 | ||
|
|
09f57d3bb6 | ||
|
|
6b9b249e22 | ||
|
|
78327f648d | ||
|
|
df32c1c5d5 | ||
|
|
e93f13f6b0 | ||
|
|
02d2b89a4d | ||
|
|
34ff64b103 | ||
|
|
827dc3da8b | ||
|
|
1cd9c8f817 | ||
|
|
e8a9035e68 | ||
|
|
a288c8d7fb | ||
|
|
88e8c2ba33 | ||
|
|
252ec6fe59 | ||
|
|
e664ab18ee | ||
|
|
b78c5b32c6 | ||
|
|
4ddc8f950e | ||
|
|
0260a33678 | ||
|
|
358c3ab0c3 | ||
|
|
a658599406 | ||
|
|
d0b1bde521 | ||
|
|
b24075ca1c | ||
|
|
88fb4051a4 | ||
|
|
0c7cff5602 | ||
|
|
f872f17d39 | ||
|
|
70917c19d1 | ||
|
|
4353e997fc | ||
|
|
e5bf8a8e75 | ||
|
|
d3928b30de | ||
|
|
ec2bc5e8cb | ||
|
|
b74e3d389b | ||
|
|
e567668346 | ||
|
|
6e31480ed9 | ||
|
|
d35b65c9d2 | ||
|
|
0f27299586 | ||
|
|
baff716ef6 | ||
|
|
1141676223 | ||
|
|
a6ce80d39b | ||
|
|
6d3e0eaa22 | ||
|
|
18c1333496 | ||
|
|
ab00d73d7a | ||
|
|
5bc574025d | ||
|
|
71e7d92d75 | ||
|
|
723c7a97fc | ||
|
|
16a3b88db5 | ||
|
|
19ed31a2c2 | ||
|
|
93fd430863 | ||
|
|
c1ac810ff2 | ||
|
|
e785085d0d | ||
|
|
334133ea61 | ||
|
|
82b801498a | ||
|
|
83c74cf9e1 | ||
|
|
3dc4dcf874 | ||
|
|
aaf184ddb3 | ||
|
|
21e9e64b3d | ||
|
|
48c431c0a9 | ||
|
|
8992b4a284 | ||
|
|
c9d7da5951 | ||
|
|
f76744fc98 | ||
|
|
b624874768 | ||
|
|
ed84727938 | ||
|
|
10f8318883 | ||
|
|
7dd7f1a32c | ||
|
|
a06fa75419 | ||
|
|
7e0ca09bf7 | ||
|
|
cae3d7b321 | ||
|
|
1c30a93da1 | ||
|
|
03d30d7f99 | ||
|
|
6e4aecb3dc | ||
|
|
660d01c59a | ||
|
|
81cccadf80 | ||
|
|
e0ea5af18e | ||
|
|
4544759cff | ||
|
|
6a466fcb12 | ||
|
|
a07c09b3d4 | ||
|
|
2c3bee16c9 | ||
|
|
9a397c1ff8 | ||
|
|
c627363fca | ||
|
|
219899fc9b | ||
|
|
d987d99913 | ||
|
|
985c32510c | ||
|
|
01ab19a263 | ||
|
|
0ba6d5de28 | ||
|
|
e6031addf5 | ||
|
|
8845babb28 | ||
|
|
ed34a59a0c | ||
|
|
767cd877b8 | ||
|
|
fd7c4a0653 | ||
|
|
26f08a59ad | ||
|
|
841b6f68dd | ||
|
|
dbe835912a | ||
|
|
6b9182645d | ||
|
|
16c1ca0bba | ||
|
|
181aea9aec | ||
|
|
422971d229 | ||
|
|
2010a3169d | ||
|
|
397b538c9d | ||
|
|
1d1d843dc7 | ||
|
|
abd6fe9f2d | ||
|
|
f5db3c08e3 | ||
|
|
0b568b2d28 | ||
|
|
42885a3df0 | ||
|
|
cd820c2dbe | ||
|
|
0944ed331b | ||
|
|
f45b9a3757 | ||
|
|
d52c552721 | ||
|
|
2a5bdbcbdc | ||
|
|
2606f7196e | ||
|
|
09a672561d | ||
|
|
cbabdf02de | ||
|
|
a65d7cdc15 | ||
|
|
1a17efcf8e | ||
|
|
9f60d63a6b | ||
|
|
4426166f1d | ||
|
|
d97ceeaa6c | ||
|
|
a7ac615bb2 | ||
|
|
90fc23205c | ||
|
|
c233fec9b9 | ||
|
|
a8df726bff | ||
|
|
ff3f26f935 | ||
|
|
a882a5f346 | ||
|
|
1b318154c2 | ||
|
|
390cf44a88 | ||
|
|
3e71253ffb | ||
|
|
748e2a81ad | ||
|
|
d3ebe43cbd | ||
|
|
7a13b9c4b7 | ||
|
|
15f9aabaf0 | ||
|
|
c617a8f354 | ||
|
|
6ac2cd4686 | ||
|
|
2833da3b2d | ||
|
|
8058a79ed0 | ||
|
|
93755a62aa | ||
|
|
d4c7e00a19 | ||
|
|
70deb7b388 | ||
|
|
c229439dec | ||
|
|
cb2dda8421 | ||
|
|
4558321ef7 | ||
|
|
9376f048be | ||
|
|
d038227941 | ||
|
|
2c885cb347 | ||
|
|
01bf13189c | ||
|
|
f92d433a3e | ||
|
|
25476f2973 | ||
|
|
1d4bff1add | ||
|
|
30864a16a2 | ||
|
|
7b492fe7ed | ||
|
|
7186c9a3a0 | ||
|
|
a5760a7462 | ||
|
|
aa5c6283a7 | ||
|
|
280955801c | ||
|
|
adc3f6d184 | ||
|
|
c9ebb6da00 | ||
|
|
a8f04a1ba5 | ||
|
|
d478e4b1f4 | ||
|
|
ac9b2e8ba4 | ||
|
|
770ee6aaec | ||
|
|
003a6ef4d2 | ||
|
|
f9e43fae29 | ||
|
|
7e1eb5a970 | ||
|
|
f231218a69 | ||
|
|
e21c9cb8f0 | ||
|
|
8597808a61 | ||
|
|
1871eed0ab | ||
|
|
8f2685b335 | ||
|
|
cd85b54dd7 | ||
|
|
6dd04142b3 | ||
|
|
0618054968 | ||
|
|
e11673d15c | ||
|
|
066a4de15f | ||
|
|
5ffac12f5b | ||
|
|
b24631345b | ||
|
|
ab3332ed8f | ||
|
|
58084c6a65 | ||
|
|
6664733650 | ||
|
|
f7a537ab91 | ||
|
|
0506d47a4f | ||
|
|
e06bcab62b | ||
|
|
90061a4b25 | ||
|
|
5a17fa53cd | ||
|
|
88c284dbf1 | ||
|
|
dd98fdbee1 | ||
|
|
af43079e33 | ||
|
|
aa6097dff8 | ||
|
|
7fa4346cd1 | ||
|
|
d286041e04 | ||
|
|
bf0f9e1fa2 | ||
|
|
d4c0dd824b | ||
|
|
528ce8c9de | ||
|
|
7c4ff7677d | ||
|
|
cb36991cb2 | ||
|
|
f15a4df79e | ||
|
|
901b7a0f12 | ||
|
|
687bcc3469 | ||
|
|
a239e435a6 | ||
|
|
75728418af | ||
|
|
893714c968 | ||
|
|
5cb4044408 | ||
|
|
4966ce447f | ||
|
|
8213bf5b6d | ||
|
|
280d90cdc4 | ||
|
|
df5a327da4 | ||
|
|
e736923312 | ||
|
|
fe4f932be4 | ||
|
|
fe7e39776b | ||
|
|
da33e480c3 | ||
|
|
19a0a7098d | ||
|
|
74d46f201a | ||
|
|
0eec061d01 | ||
|
|
7c1ad9abab | ||
|
|
3ad99011f2 | ||
|
|
cb8331f213 | ||
|
|
ffa2858d82 | ||
|
|
1cf20da416 | ||
|
|
30bc7e4f6c | ||
|
|
9f406c6725 | ||
|
|
b1ff790e43 | ||
|
|
90f304a881 | ||
|
|
99cbfa13cb | ||
|
|
ce7736a4b8 | ||
|
|
c36ed7b660 | ||
|
|
d6c4705626 | ||
|
|
9df4455f07 | ||
|
|
5e4923b5bc | ||
|
|
9d00189ac0 | ||
|
|
3af2d7c0df | ||
|
|
521222ad19 | ||
|
|
e0f5a1c1a1 | ||
|
|
fa393a53b2 | ||
|
|
43e81781a3 | ||
|
|
b03e9922a4 | ||
|
|
7206e46377 | ||
|
|
554b9a03b5 | ||
|
|
20278d23e1 | ||
|
|
81607da632 | ||
|
|
c1ec74a5b7 | ||
|
|
eaed0c098b | ||
|
|
886fb6b5a1 | ||
|
|
9fe92bc669 | ||
|
|
098e9fee8c | ||
|
|
1d0f670100 | ||
|
|
ee7f505cde | ||
|
|
4581850b05 | ||
|
|
bc757016af | ||
|
|
d3259a8430 | ||
|
|
d57107ca2a | ||
|
|
2cf606bdbd | ||
|
|
32cd559379 | ||
|
|
ad8551b746 | ||
|
|
a26bef8813 | ||
|
|
34dad07393 | ||
|
|
5453aec1d0 | ||
|
|
03a5671bb0 | ||
|
|
37c16fbb48 | ||
|
|
92431f20d7 | ||
|
|
9b6b66d22d | ||
|
|
83477c67d7 | ||
|
|
ac31392b90 | ||
|
|
201485eed6 | ||
|
|
87992f9e75 | ||
|
|
0b24721b4a | ||
|
|
8d540751e1 | ||
|
|
fc8b2ee679 | ||
|
|
bc512e775c | ||
|
|
7b9d54183c | ||
|
|
85d640c4f8 | ||
|
|
a0275aa413 | ||
|
|
7d1c4a9991 | ||
|
|
ade05d5d1b | ||
|
|
6e259f9a0e | ||
|
|
02a21b8050 | ||
|
|
5fe7c5d888 | ||
|
|
1ee4437970 | ||
|
|
a8cebfe06c | ||
|
|
0b73275933 | ||
|
|
04fec2c2f0 | ||
|
|
ccd560cbc6 | ||
|
|
43df7f18be | ||
|
|
2f18d1ff8b | ||
|
|
6c816bfdeb | ||
|
|
afa8cfce5e | ||
|
|
49ad4bdb26 | ||
|
|
e76e8b1404 | ||
|
|
9794b72607 | ||
|
|
997a29e70b | ||
|
|
a478a1c888 | ||
|
|
5db11aa49a | ||
|
|
24a650f562 | ||
|
|
a1d9bf297f | ||
|
|
92682cb11f | ||
|
|
b51b02b1d3 | ||
|
|
df410d2444 | ||
|
|
ec07380055 | ||
|
|
3a766cd826 | ||
|
|
eef7fa5b40 | ||
|
|
eb726e47c3 | ||
|
|
5378cd07bf | ||
|
|
d8b935369b | ||
|
|
4e2f396b4a | ||
|
|
34c43a2bbe | ||
|
|
f7fddbc162 | ||
|
|
4c2a53ac26 | ||
|
|
ffe1021c2a | ||
|
|
3fcbcb9455 | ||
|
|
19fbce4479 | ||
|
|
b2e0874efa | ||
|
|
ca81422c4b | ||
|
|
6bdf433e95 | ||
|
|
daba5b2102 | ||
|
|
9dbf992c40 | ||
|
|
7772749e88 | ||
|
|
0c0fd48700 | ||
|
|
41f2cdc6e6 | ||
|
|
cf572ea931 | ||
|
|
da372fbb93 | ||
|
|
92e1336db0 | ||
|
|
a9d3dffd3c | ||
|
|
5fac4abc07 | ||
|
|
28a795eddb | ||
|
|
06b824928b | ||
|
|
5b57707b86 | ||
|
|
a348febf3e | ||
|
|
7f8a7ac628 | ||
|
|
a5fab4e0f6 | ||
|
|
2724e90981 | ||
|
|
26fc80213e | ||
|
|
47890fa74e | ||
|
|
49b35a9216 | ||
|
|
a08bbbad29 | ||
|
|
3b93cf8e28 | ||
|
|
75258afb6c | ||
|
|
fca37601dd | ||
|
|
55301efa3e | ||
|
|
82052848ee | ||
|
|
25dd52fdda | ||
|
|
c891c3cff8 | ||
|
|
917e75050e | ||
|
|
a46b3aa816 | ||
|
|
60fafd399f | ||
|
|
f3d3eb43dc | ||
|
|
5ff030607e | ||
|
|
71492c5d37 | ||
|
|
f553f2d2b0 | ||
|
|
5fdff2dc6f | ||
|
|
4185de77e0 | ||
|
|
aa51a6c54e | ||
|
|
092509b3c3 | ||
|
|
695279e784 | ||
|
|
5c6bccd7b3 | ||
|
|
45c8b48b0a | ||
|
|
51130c354b | ||
|
|
79d1845266 | ||
|
|
4f1173e609 | ||
|
|
23178a2727 | ||
|
|
60ab73d8a4 | ||
|
|
2a39120b38 | ||
|
|
c5bc699c26 | ||
|
|
9cc225dede | ||
|
|
5f743f4cad | ||
|
|
a7266e38c4 | ||
|
|
ea2f202e4d | ||
|
|
c1169f0d2c | ||
|
|
37d7c178f5 | ||
|
|
c34d64b3bb | ||
|
|
8934596527 | ||
|
|
c13ac87a5b | ||
|
|
09ea2dcd10 | ||
|
|
1dd6707070 | ||
|
|
d5367fc2b2 | ||
|
|
0333406fbc | ||
|
|
6f779faa05 | ||
|
|
82fa559962 | ||
|
|
eca93cb43f | ||
|
|
04e648b3f9 | ||
|
|
6de0debb49 | ||
|
|
84929771be | ||
|
|
3b00230580 | ||
|
|
959b11d19e | ||
|
|
2ad59f1aa5 | ||
|
|
494682c2af | ||
|
|
d48d0e621f | ||
|
|
1a3382aa24 | ||
|
|
5c065d3f8a | ||
|
|
4799957d08 | ||
|
|
307f43ce12 | ||
|
|
b13fc99797 | ||
|
|
1f30f8dcf3 | ||
|
|
fbb40e1232 | ||
|
|
1d5999e50b | ||
|
|
04713d9652 | ||
|
|
050f432c10 | ||
|
|
1201f4e008 | ||
|
|
5614f57f43 | ||
|
|
f9d82b8ead | ||
|
|
fba181bfea | ||
|
|
10d20748ad | ||
|
|
25fc832ae5 | ||
|
|
fe5ef03bc8 | ||
|
|
fe158d20ed | ||
|
|
95cb311f6c | ||
|
|
e1bb98ec94 | ||
|
|
d7e0e44de0 | ||
|
|
8a54e4cd76 | ||
|
|
b89c4f95e8 | ||
|
|
087a1a1af5 | ||
|
|
db86ceca0e | ||
|
|
a54b0389ae | ||
|
|
6c826b6ecf | ||
|
|
8e864b9df4 | ||
|
|
6e0837325c | ||
|
|
b237df4b6d | ||
|
|
96f8a57f44 | ||
|
|
f5575510f5 | ||
|
|
745a72a0c4 | ||
|
|
c34b9e77a1 | ||
|
|
7e8a47cd92 | ||
|
|
a0ecab10ac | ||
|
|
185c2575b6 | ||
|
|
565f627429 | ||
|
|
ef4f483a9e | ||
|
|
92538de969 | ||
|
|
88fe1cae08 | ||
|
|
fbb59d2d6c | ||
|
|
3b9688eb2f | ||
|
|
03debbf434 | ||
|
|
f3bc909a02 | ||
|
|
c3c20acb80 | ||
|
|
eccb4530a1 | ||
|
|
3dd81071a5 | ||
|
|
d95f98f67d | ||
|
|
94797986a9 | ||
|
|
ac5e7e8973 | ||
|
|
2684c4a735 | ||
|
|
bd67f86769 | ||
|
|
e2765a3fd6 | ||
|
|
73714933d7 | ||
|
|
d3da0bf860 | ||
|
|
dc011d522f | ||
|
|
3d1ecc1881 | ||
|
|
7676f10e0c | ||
|
|
c83bdfa810 | ||
|
|
282677b8fc | ||
|
|
b2d0080637 | ||
|
|
5f1be7c815 | ||
|
|
d5e2d6b88b | ||
|
|
39a2efbcd9 | ||
|
|
063b367951 | ||
|
|
37ce59af6e | ||
|
|
2d0cd5d186 | ||
|
|
dbbded56cf | ||
|
|
67d6ac1760 | ||
|
|
48d2ce5a98 | ||
|
|
96a8a0f1fa | ||
|
|
4253a46282 | ||
|
|
660c255532 | ||
|
|
3956f1d183 | ||
|
|
234e1e6810 | ||
|
|
e9e2d0bf10 | ||
|
|
5d8a380f86 | ||
|
|
a9a06a0652 | ||
|
|
9f4b03c14f | ||
|
|
a8f93a5a9c | ||
|
|
4c52d51aa2 | ||
|
|
663b89a4a5 | ||
|
|
0a4779ed8c | ||
|
|
c09463e529 | ||
|
|
f93b029b82 | ||
|
|
929122934e | ||
|
|
dfd38150f2 | ||
|
|
11bb86a8ed | ||
|
|
05dad7e0d6 | ||
|
|
541316cd89 | ||
|
|
08c75a2d06 | ||
|
|
15a4aa3d1b | ||
|
|
acb46d3e86 | ||
|
|
000bd1b200 | ||
|
|
baf87f837a | ||
|
|
0bcc8639c1 | ||
|
|
e75b25c0c1 | ||
|
|
2cc6d17014 | ||
|
|
404bb0eafd | ||
|
|
284f0e7ccb | ||
|
|
081df4cad9 | ||
|
|
13d25939ec | ||
|
|
9b6c05ca04 | ||
|
|
8b9e78e158 | ||
|
|
a974f311d9 | ||
|
|
b034137516 | ||
|
|
b819271441 | ||
|
|
b898391124 | ||
|
|
4c57436fe8 | ||
|
|
f0479a656a | ||
|
|
41e0537eca | ||
|
|
dd04990143 | ||
|
|
d0d9344c8a | ||
|
|
64ee2ef045 | ||
|
|
061d444a8f | ||
|
|
d4cb690b8b | ||
|
|
bd50f1ce59 | ||
|
|
944cae53de | ||
|
|
17b43d021a | ||
|
|
059af3a621 | ||
|
|
524701caad | ||
|
|
34111df889 | ||
|
|
5dfca74327 | ||
|
|
12cfdac1b0 | ||
|
|
5ccf66bd9b | ||
|
|
4f344ab1a6 | ||
|
|
624ac5b81c | ||
|
|
7c2fb3506c | ||
|
|
dc4ac5568c | ||
|
|
460cfd05c6 | ||
|
|
40525d9bcf | ||
|
|
8dbf8c92cf | ||
|
|
92d417dc0c | ||
|
|
43e9a63210 | ||
|
|
4483d748e9 | ||
|
|
48f2581d07 | ||
|
|
f074f1ab36 | ||
|
|
42bea06b93 | ||
|
|
6550454d1e | ||
|
|
0a80316d09 | ||
|
|
64b98a8330 | ||
|
|
992c63480d | ||
|
|
6566f3f83d | ||
|
|
973da2de61 | ||
|
|
bf7fdd68f2 | ||
|
|
1136d367c7 | ||
|
|
e7b1c9b7cd | ||
|
|
9a03e0866b | ||
|
|
a5d26bdc81 | ||
|
|
e9cca9657f | ||
|
|
8498dd927f | ||
|
|
ccc8d2ba33 | ||
|
|
1098b0254e | ||
|
|
9eda86eb29 | ||
|
|
2d126010bc | ||
|
|
30f4744199 | ||
|
|
e26892ad90 | ||
|
|
4976b7e648 | ||
|
|
a539b629e7 | ||
|
|
8bd22b545c | ||
|
|
8d3796324d | ||
|
|
af53fe8e79 | ||
|
|
4bcff181c7 | ||
|
|
783da0c45d | ||
|
|
6ef4a6eb08 | ||
|
|
9e52513138 | ||
|
|
e9043d1e93 | ||
|
|
3dd821a975 | ||
|
|
18ba7ed086 | ||
|
|
0128385195 | ||
|
|
4c3efab946 | ||
|
|
858d427690 | ||
|
|
486666279d | ||
|
|
24d2ddada7 | ||
|
|
023d757964 | ||
|
|
e4b12d6a2d | ||
|
|
d67625a966 | ||
|
|
608f671c48 | ||
|
|
9ef1c70eb2 | ||
|
|
b7e236a693 | ||
|
|
d519a92719 | ||
|
|
a83d7c6140 | ||
|
|
d74a8636b3 | ||
|
|
d010271f5d | ||
|
|
f868d3eead | ||
|
|
166ae08465 | ||
|
|
15f3450f8c | ||
|
|
b2bc2700b3 | ||
|
|
8183f57b85 | ||
|
|
79ffb7b9b8 | ||
|
|
af108e1ac9 | ||
|
|
627bca09c0 | ||
|
|
08de2cc920 | ||
|
|
f1c87b6604 | ||
|
|
9f6c5ccccb | ||
|
|
41fab091d0 | ||
|
|
484d5a5968 | ||
|
|
eabacfafb2 | ||
|
|
2ec2e85679 | ||
|
|
e0bb6d106c | ||
|
|
20a16de9de | ||
|
|
e3d8c06ad0 | ||
|
|
7e3563f64b | ||
|
|
f188db2dab | ||
|
|
0473d232ed | ||
|
|
861e43a25b | ||
|
|
3e0fcc4b87 | ||
|
|
a355892ce5 | ||
|
|
52c0f31578 | ||
|
|
e132b54c9f | ||
|
|
dc942c5734 | ||
|
|
a7038a9eaf | ||
|
|
7664e0b187 | ||
|
|
e8ccc48815 | ||
|
|
eda40621c4 | ||
|
|
5b4c6b62a7 | ||
|
|
b7bab76232 | ||
|
|
bd3c39eaaf | ||
|
|
2fb1d6f731 | ||
|
|
ef299acbe8 | ||
|
|
005c4ded24 | ||
|
|
cfceabb4ec | ||
|
|
06095ec343 | ||
|
|
a753a654ca | ||
|
|
2dfd6c79c0 | ||
|
|
abbf0cd856 | ||
|
|
83ec50e4ab | ||
|
|
d51b6fd61d | ||
|
|
894bb05cba | ||
|
|
669720c6dc | ||
|
|
fdcbc2db86 | ||
|
|
37f0e4af3e | ||
|
|
7c14e63fef | ||
|
|
7b5088b921 | ||
|
|
66fe22d716 | ||
|
|
d2339cc7c2 | ||
|
|
d53c7f5d2d | ||
|
|
efdc6053ff | ||
|
|
ab3ec443d2 | ||
|
|
f5873ae0e4 | ||
|
|
e9197817f5 | ||
|
|
c04c8ef815 | ||
|
|
c5d1181d72 | ||
|
|
4b479ad327 | ||
|
|
be4497f768 | ||
|
|
6ad79b12a6 | ||
|
|
24fe6b3c4d | ||
|
|
f4d5f1c584 | ||
|
|
9a18ab44a6 | ||
|
|
a97530bde8 | ||
|
|
ec176bbec5 | ||
|
|
76e194ab1a | ||
|
|
460e1c87d9 | ||
|
|
66db3fd6d6 | ||
|
|
15ec342519 | ||
|
|
136d262d4c | ||
|
|
582dafd50d | ||
|
|
a827a1b105 | ||
|
|
50a62edbaf | ||
|
|
4924b39f93 | ||
|
|
afe2c9db2f | ||
|
|
d18b30da10 | ||
|
|
d6b07185ae | ||
|
|
1a32753ce9 | ||
|
|
0bab743936 | ||
|
|
6f82912701 | ||
|
|
827ffa88fe | ||
|
|
83534e2848 | ||
|
|
a7dcbea8ef | ||
|
|
36a35ef303 | ||
|
|
91eced4b26 | ||
|
|
ec5f33179a | ||
|
|
e180ae4cbd | ||
|
|
98bc81cdd5 | ||
|
|
2b549c358d | ||
|
|
d170b0d0e1 | ||
|
|
5fbdd03acb | ||
|
|
3e3ba6e7ed | ||
|
|
ea929a78e0 | ||
|
|
c845c19477 | ||
|
|
ef0d2c6234 | ||
|
|
8af5f54767 | ||
|
|
fb601ee80f | ||
|
|
72fa9d1a4a | ||
|
|
d1b21708e6 | ||
|
|
703aa07407 | ||
|
|
6e2ed61743 | ||
|
|
c9ce98c5d5 | ||
|
|
f0c23b7244 | ||
|
|
00e49e76be | ||
|
|
05eb7b35f8 | ||
|
|
f6df412350 | ||
|
|
f952b9bbcb | ||
|
|
9160021442 | ||
|
|
77e245aec3 | ||
|
|
eaf8193d37 | ||
|
|
8257b05c8f | ||
|
|
0912139fc5 | ||
|
|
4592566748 | ||
|
|
22851dd9e8 | ||
|
|
87bab96097 | ||
|
|
81ed566467 | ||
|
|
336220d998 | ||
|
|
859e71d976 | ||
|
|
deb25d916d | ||
|
|
c412a01fa6 | ||
|
|
2a9be8a28c | ||
|
|
310704e0c5 | ||
|
|
03f89c9131 | ||
|
|
8ed39f43b4 | ||
|
|
84292beef9 | ||
|
|
d612b86d7f | ||
|
|
93180d6843 | ||
|
|
644ec3caec | ||
|
|
bb5aa47d7b | ||
|
|
b9338b31bc | ||
|
|
5ed3b39219 | ||
|
|
ee55afe8c0 | ||
|
|
6bfab3d04a | ||
|
|
5f84f1378b | ||
|
|
18a63504ed | ||
|
|
44f80dc385 | ||
|
|
fe5af8308c | ||
|
|
197fc48d92 | ||
|
|
293268a004 | ||
|
|
c558d8fcaa | ||
|
|
b13ad57ea5 | ||
|
|
eba839b58e | ||
|
|
36a480a5fc | ||
|
|
68c83ea156 | ||
|
|
9102c94db2 | ||
|
|
26d6330771 | ||
|
|
c123d27b89 | ||
|
|
8aa5324892 | ||
|
|
fb448e27ad | ||
|
|
b24c872b52 | ||
|
|
fdb31f37ba | ||
|
|
87733729b1 | ||
|
|
09cbbb4570 | ||
|
|
cc2489e4ed | ||
|
|
82d71b637d | ||
|
|
c4c0e67407 | ||
|
|
d0c5e98366 | ||
|
|
83c5afdd2d | ||
|
|
c46663007b | ||
|
|
df748e5e75 | ||
|
|
e98685b6cc | ||
|
|
2374c67975 | ||
|
|
30f288a6b9 | ||
|
|
aea7609e0b | ||
|
|
700b256cad | ||
|
|
64b4372a18 | ||
|
|
32461d221a | ||
|
|
b9190e116a | ||
|
|
2d6247d48a | ||
|
|
4aaf001885 | ||
|
|
cc5726577e | ||
|
|
626ae53057 | ||
|
|
ff69f6fdfc | ||
|
|
3178af0074 | ||
|
|
98a93346fc | ||
|
|
01eea12f4e | ||
|
|
1b78881f78 | ||
|
|
a0b5f87b7d | ||
|
|
557fbc21ef | ||
|
|
7de27389aa | ||
|
|
049148305f | ||
|
|
90f468c329 | ||
|
|
cd7acbc4ce | ||
|
|
907f020bf6 | ||
|
|
a6af89755d | ||
|
|
e3ee49a868 | ||
|
|
af538c4feb | ||
|
|
4e5d5aac8c | ||
|
|
5c8526d197 | ||
|
|
4f13055a45 | ||
|
|
2d7a035297 | ||
|
|
cc6f2c00df | ||
|
|
3293a33f38 | ||
|
|
5e6dd56933 | ||
|
|
6104d6193c | ||
|
|
b45c711483 | ||
|
|
bebcefddcc | ||
|
|
68a9089d14 | ||
|
|
c6f96906ca | ||
|
|
9733fb22fd | ||
|
|
e6010e334a | ||
|
|
4f427601d4 | ||
|
|
a716a5788d | ||
|
|
a308ffebeb | ||
|
|
649667a403 | ||
|
|
97f9805afa | ||
|
|
6d0cdcd20b | ||
|
|
a8e85f2c41 | ||
|
|
2e11551bd7 | ||
|
|
ea7aae603d | ||
|
|
6c3976e657 | ||
|
|
09abd1e5cd | ||
|
|
d5d467192d | ||
|
|
d455e50a27 | ||
|
|
f7d9970842 | ||
|
|
b4a7ba239c | ||
|
|
86e3fc7075 | ||
|
|
be2ef28fad | ||
|
|
97fcdf9ce6 | ||
|
|
b9f7ea187d | ||
|
|
c8f5f1ae1d | ||
|
|
92b8b00a49 | ||
|
|
eeddb32ab6 | ||
|
|
c1a59a015c | ||
|
|
bc3b13d719 | ||
|
|
29dcbaeaa3 | ||
|
|
46f6e6d1ea | ||
|
|
c76b7a8b77 | ||
|
|
8514513af3 | ||
|
|
dc2ee92404 | ||
|
|
7cd5b881b2 | ||
|
|
63545c1f08 | ||
|
|
171862097e | ||
|
|
ab69f64957 | ||
|
|
91bf2a85d0 | ||
|
|
6315aad0bc | ||
|
|
613a0386bd | ||
|
|
a79565bb65 | ||
|
|
63213d7f10 | ||
|
|
218d7a7f15 | ||
|
|
4f5e87b1e1 | ||
|
|
8ef27ccbf6 | ||
|
|
b1e3aaf399 | ||
|
|
1af1c84132 | ||
|
|
c6a00d0e45 | ||
|
|
319556daec | ||
|
|
c096736e2b | ||
|
|
afea1c4175 | ||
|
|
f00dda7f43 | ||
|
|
8bc52b29e7 | ||
|
|
967b10311e | ||
|
|
09a600d955 | ||
|
|
a99e064c28 | ||
|
|
01f1043e1a | ||
|
|
c3316346ac | ||
|
|
19da676caf | ||
|
|
39a14d6528 | ||
|
|
198c4c7b5a | ||
|
|
698f3b4fad | ||
|
|
f3bee9e85f | ||
|
|
75f1b045c9 | ||
|
|
24bcee02c1 | ||
|
|
2b159dfb02 | ||
|
|
67f79f20dc | ||
|
|
a992871cb9 | ||
|
|
802e67d8ba | ||
|
|
5169ba8798 | ||
|
|
f41f9c2d87 | ||
|
|
d720433880 | ||
|
|
11747f43ee | ||
|
|
66b0163f7b | ||
|
|
e7006a9ac4 | ||
|
|
9ace4d7cc6 | ||
|
|
d3d8641053 | ||
|
|
2de46d7038 | ||
|
|
d1062ec050 | ||
|
|
079ba05b88 | ||
|
|
a47fef9d19 | ||
|
|
adbca4ba1a | ||
|
|
41ac9563ef | ||
|
|
9a48bcc013 | ||
|
|
aba08042ed | ||
|
|
9f9804c8a3 | ||
|
|
1f1ac06c91 | ||
|
|
d2f3f9d1b5 | ||
|
|
111688ff18 | ||
|
|
a81a29c952 | ||
|
|
9c3e677e0c | ||
|
|
02ce13c858 | ||
|
|
523d111ec6 | ||
|
|
dd6d186a08 | ||
|
|
9b8aae29dd | ||
|
|
cf406c280d | ||
|
|
7917343593 | ||
|
|
588e0c9bbc | ||
|
|
f054a0f4fd | ||
|
|
dac5b6cae8 | ||
|
|
4c1fe51786 | ||
|
|
bcafd3c9b9 | ||
|
|
318a485a92 | ||
|
|
1a46f37e92 | ||
|
|
f9484c1ba5 | ||
|
|
6f3a3c9514 | ||
|
|
2e9b009aa5 | ||
|
|
4458ebd03e | ||
|
|
84e5e488a9 | ||
|
|
1df41fbd29 | ||
|
|
b5d95fda22 | ||
|
|
3c5e144493 | ||
|
|
b1e467d34f | ||
|
|
390bc93e54 | ||
|
|
a7b2a1ed70 | ||
|
|
7e7fd97075 | ||
|
|
4bf97204d1 | ||
|
|
b9b2b179e1 | ||
|
|
e3ef424a41 | ||
|
|
387e7bc2f5 | ||
|
|
328d21e526 | ||
|
|
85579403e9 | ||
|
|
08358a52a7 | ||
|
|
6d1c190a13 | ||
|
|
4208c9f2ff | ||
|
|
a14c3a2a60 | ||
|
|
c8afca6485 | ||
|
|
eecaa2a394 | ||
|
|
62a37ac1f4 | ||
|
|
a8dd424211 | ||
|
|
9e9fafcc5c | ||
|
|
78dc8c3188 | ||
|
|
6ddcc74697 | ||
|
|
79c34eb6d2 | ||
|
|
cdf08821bb | ||
|
|
e54e9068dc | ||
|
|
2af32c76eb | ||
|
|
ae8ffeabc9 | ||
|
|
e818d40c2a | ||
|
|
e52a01abbe | ||
|
|
b81f57f1c9 | ||
|
|
8221ff520c | ||
|
|
b68f1e278e | ||
|
|
18b996e5bd | ||
|
|
50cc857a3a | ||
|
|
ea04588865 | ||
|
|
47d1202e57 | ||
|
|
1ab5b8ed9c | ||
|
|
61f944fdaa | ||
|
|
5d2ee3140e | ||
|
|
ba461c7e98 | ||
|
|
389ddefc1d | ||
|
|
2a2421896d | ||
|
|
b3c0d021fd | ||
|
|
f21ddc0f7f | ||
|
|
2e4dec741a | ||
|
|
2fc1253836 | ||
|
|
479308637d | ||
|
|
eb513e87d2 | ||
|
|
96ead6d1c6 | ||
|
|
a9db99c569 | ||
|
|
42084e1302 | ||
|
|
3e75af7c14 | ||
|
|
c7ad60522d | ||
|
|
7d8834027d | ||
|
|
7a64719708 | ||
|
|
228c36d164 | ||
|
|
085a542b4b | ||
|
|
db6546a959 | ||
|
|
d47f443a25 | ||
|
|
4c261ff49e | ||
|
|
02d11108de | ||
|
|
3534325d7c | ||
|
|
ce48a29499 | ||
|
|
4a34a610fe | ||
|
|
840e2b6b0b | ||
|
|
f95b058b99 | ||
|
|
cafe8b5953 | ||
|
|
dbce44fe24 | ||
|
|
04289d5233 | ||
|
|
67afe993a7 | ||
|
|
fadfa11ea1 | ||
|
|
decfcad2af | ||
|
|
bb29f633c5 | ||
|
|
5fd2212278 | ||
|
|
6f4a29e6f8 | ||
|
|
517552fed8 | ||
|
|
9427c89456 | ||
|
|
758663c3a1 | ||
|
|
7364d99b6b | ||
|
|
694c38dc62 | ||
|
|
164a751f3e | ||
|
|
4f8042a96b | ||
|
|
1fcc8c764f | ||
|
|
eeb3580d42 | ||
|
|
3165c2904b | ||
|
|
3b7bbdcc7d | ||
|
|
80024875ca | ||
|
|
4ff679af11 | ||
|
|
e3a52f8c00 | ||
|
|
4ac7dcf5b0 | ||
|
|
6808b50e94 | ||
|
|
5d229373e6 | ||
|
|
d710e96f85 | ||
|
|
bd5be629e8 | ||
|
|
a5b25fadd5 | ||
|
|
06e2f3e5f8 | ||
|
|
c5923eef6a | ||
|
|
6b344b8566 | ||
|
|
953cea1318 | ||
|
|
c870ac47c2 | ||
|
|
2dfd1925f3 | ||
|
|
36fc5c85f8 | ||
|
|
b285c3e74c | ||
|
|
1bb553d0c1 | ||
|
|
95c122f50d | ||
|
|
2242b4d117 | ||
|
|
955199c238 | ||
|
|
72dde7eb2f | ||
|
|
dcccbcfab2 | ||
|
|
97f3161256 | ||
|
|
e0df528e0f | ||
|
|
de0d2487ab | ||
|
|
71f306ebe3 | ||
|
|
cd99c661fa | ||
|
|
bc132769e3 | ||
|
|
6bd8f79399 | ||
|
|
fce55c836c | ||
|
|
58a1118bfc | ||
|
|
d23fd9d2c1 | ||
|
|
b9fd23912d | ||
|
|
122195156a | ||
|
|
15b3809a50 | ||
|
|
e0031ddc42 | ||
|
|
526e065e7d | ||
|
|
5ac0eda8a6 | ||
|
|
19336609d3 | ||
|
|
1fee42bee9 | ||
|
|
5acc3cd03f | ||
|
|
c84521edf8 | ||
|
|
648dbf7e25 | ||
|
|
20f3ab8e2c | ||
|
|
d7a1c89b7d | ||
|
|
52897e5888 | ||
|
|
07652429a3 | ||
|
|
fff402f2b1 | ||
|
|
0091de918b | ||
|
|
d18d2a5921 | ||
|
|
44a7c8589c | ||
|
|
b6fd50c9cd | ||
|
|
b2ee415fba | ||
|
|
f863a263b7 | ||
|
|
2cbfa16e53 | ||
|
|
0d5bed389f | ||
|
|
e78191714a | ||
|
|
375f169020 | ||
|
|
ee81249c79 | ||
|
|
b7a17b05e9 | ||
|
|
b7a7cd953e | ||
|
|
3d4ee9ee53 | ||
|
|
63a6ef021a | ||
|
|
cfb987e7e3 | ||
|
|
9aa629d36e | ||
|
|
29b0de2210 | ||
|
|
49b30eb290 | ||
|
|
de9d8e65bb | ||
|
|
cdc102de70 | ||
|
|
fd1067b41f | ||
|
|
06031d1c79 | ||
|
|
ecd0a36721 | ||
|
|
e400d49ac9 | ||
|
|
c9da10c9cb | ||
|
|
6600b52cf2 | ||
|
|
cfb19d4ad7 | ||
|
|
4c37ad1f9f | ||
|
|
1b99b50262 | ||
|
|
544796917e | ||
|
|
03b89ea78f | ||
|
|
44dddd28ef | ||
|
|
d74cf435ed | ||
|
|
056eb22c7a | ||
|
|
15a65cfe93 | ||
|
|
eeb00ce467 | ||
|
|
10ac19db72 | ||
|
|
48eff16ac7 | ||
|
|
bb7fe8cd7d | ||
|
|
5d73bffd28 | ||
|
|
bb46b9c652 | ||
|
|
dafae3dfd3 | ||
|
|
1db2d6f5d0 | ||
|
|
0ed1bbf53c | ||
|
|
63f2c2a3aa | ||
|
|
0808a10b03 | ||
|
|
ba0e505d78 | ||
|
|
43a33a8303 | ||
|
|
10fc730230 | ||
|
|
18b01ca0c5 | ||
|
|
48ad154079 | ||
|
|
24668267e8 | ||
|
|
d6cf23ab78 | ||
|
|
e5009af67e | ||
|
|
75e2edb471 | ||
|
|
ff8b580d17 | ||
|
|
0c68765e2d | ||
|
|
3a7adaa247 | ||
|
|
247d8a75f7 | ||
|
|
b60daca055 | ||
|
|
fc3b175100 | ||
|
|
8d54b587d0 | ||
|
|
a4c811dc43 | ||
|
|
4004d53da4 | ||
|
|
8465332598 | ||
|
|
9a2b7cbefc | ||
|
|
09c599cc62 | ||
|
|
17aa9350c5 | ||
|
|
f2481989c7 | ||
|
|
adbddf3299 | ||
|
|
94e4fa42bf | ||
|
|
0ae37db4ec | ||
|
|
8237ec8a2a | ||
|
|
9396982fa7 | ||
|
|
aff72de4e1 | ||
|
|
755fb1f4b6 | ||
|
|
070f4276de | ||
|
|
d9626faaec | ||
|
|
8cdacf3899 | ||
|
|
d8140b87d7 | ||
|
|
1cdc111e31 | ||
|
|
567d912bf7 | ||
|
|
2c482dab31 | ||
|
|
11c6af9d82 | ||
|
|
d4e5dcea70 | ||
|
|
438129689c | ||
|
|
8a5109c0fd | ||
|
|
9cc0faee2f | ||
|
|
25935e0323 | ||
|
|
8f4840b564 | ||
|
|
6e9276b55d | ||
|
|
122f4c835a | ||
|
|
49025734aa | ||
|
|
06a3fa8338 | ||
|
|
02b6f0ac10 | ||
|
|
e1e4dd0524 | ||
|
|
b85b958127 | ||
|
|
b5190d1eff | ||
|
|
03edc362a9 | ||
|
|
783fb7ff1a | ||
|
|
c13d1a5d63 | ||
|
|
1997f9ab9e | ||
|
|
f55a8eb82f | ||
|
|
598fff8429 | ||
|
|
69834ef930 | ||
|
|
316ab93660 | ||
|
|
55c056c52c | ||
|
|
ea07cba3fb | ||
|
|
49b80a4f71 | ||
|
|
fe0bd6a0c0 | ||
|
|
889b15a967 | ||
|
|
cdf960ff66 | ||
|
|
f0b80c72a5 | ||
|
|
b359543cdb | ||
|
|
e6d8c715e4 | ||
|
|
10337967ea | ||
|
|
24ad42f0d0 | ||
|
|
d0d2b0b6cc | ||
|
|
4ed057677e | ||
|
|
e28817829c | ||
|
|
841882510e | ||
|
|
5ebf6899b3 | ||
|
|
3ec52fa83d | ||
|
|
46e44131d3 | ||
|
|
3c28277f15 | ||
|
|
2c7334b1c1 | ||
|
|
f055b9ee17 | ||
|
|
307008e9bc | ||
|
|
f08fc31e64 | ||
|
|
85e578f5ae | ||
|
|
7b31e75298 | ||
|
|
ccda6ba9ba | ||
|
|
042163eb58 | ||
|
|
3518b4d2de | ||
|
|
07afc8a130 | ||
|
|
9c7e13fc64 | ||
|
|
45b184b628 | ||
|
|
c589080ef2 | ||
|
|
cc0f76d75b | ||
|
|
bc3be0f1ff | ||
|
|
b3c23c474a | ||
|
|
0e7bee7a79 | ||
|
|
fb8af21c93 | ||
|
|
754c38ced4 | ||
|
|
ae353dc771 | ||
|
|
9417d11d37 | ||
|
|
9ff1915e49 | ||
|
|
7b5415ad0d | ||
|
|
943247187c | ||
|
|
f4def1966b | ||
|
|
f5dc639211 | ||
|
|
58929684d2 | ||
|
|
042c0509d6 | ||
|
|
be4104c5cf | ||
|
|
dc1a16054b | ||
|
|
9f3577b8b9 | ||
|
|
cae8e00083 | ||
|
|
4c03aad795 | ||
|
|
e2eb73e546 | ||
|
|
f44ae2848f | ||
|
|
0bb852a51c | ||
|
|
3b3cb6bdec | ||
|
|
34850a89fa | ||
|
|
469d398988 | ||
|
|
b127e90e93 | ||
|
|
0d49108cb1 | ||
|
|
629a98bbb5 | ||
|
|
7c9d379aba | ||
|
|
a4a8b5c93b | ||
|
|
0cea2b2e3c | ||
|
|
d70f112014 | ||
|
|
a1d21a07a1 | ||
|
|
baed5ce686 | ||
|
|
db73bf9295 | ||
|
|
a336b44ddb | ||
|
|
f8b2fa0cc8 | ||
|
|
63a192ae8e | ||
|
|
16c26c09fb | ||
|
|
d22beae5a2 | ||
|
|
76fc3f896e | ||
|
|
dfe71f0725 | ||
|
|
103d7a94d2 | ||
|
|
fe0b5abee1 | ||
|
|
4f03e5ee70 | ||
|
|
c07f7475ae | ||
|
|
2028c064f1 | ||
|
|
f97cf7c38e | ||
|
|
3c692c59fe | ||
|
|
f7874bd745 | ||
|
|
1345083f58 | ||
|
|
2106d025a5 | ||
|
|
46a767249c | ||
|
|
8f50593aa8 | ||
|
|
8da1812502 | ||
|
|
831dbfbe4e | ||
|
|
a8f98b7880 | ||
|
|
f2b59e06b2 | ||
|
|
a158f63b4d | ||
|
|
82cfefc3d9 | ||
|
|
995d3a4493 | ||
|
|
2fae115531 | ||
|
|
9bf81ef702 | ||
|
|
5ed2d4a1af | ||
|
|
a9792880e8 | ||
|
|
ba5e11cd69 | ||
|
|
6ab51cd207 | ||
|
|
efc1ed4151 | ||
|
|
d2e1670ffc | ||
|
|
b67797879f | ||
|
|
1d63993604 | ||
|
|
a45cc1d6c9 | ||
|
|
1bbf9960da | ||
|
|
c879ded4b4 | ||
|
|
74edabe6ec | ||
|
|
02c4373d08 | ||
|
|
fae1cdae93 | ||
|
|
ca2fa83e80 | ||
|
|
19e55a517c | ||
|
|
8bffc01e76 | ||
|
|
a2728325f9 | ||
|
|
318f5ad737 | ||
|
|
5c64c3d49f | ||
|
|
d7cc7cdf5e | ||
|
|
55e251e74c | ||
|
|
d97f9c79ee | ||
|
|
b0d60cc9da | ||
|
|
b29869e0cd | ||
|
|
56406d6ca5 | ||
|
|
706f936831 | ||
|
|
5d9363a61d | ||
|
|
474b28366b | ||
|
|
f7d4376147 | ||
|
|
0a8111a34d | ||
|
|
a384051942 | ||
|
|
693add8df9 | ||
|
|
2ec05fea85 | ||
|
|
a6a23615b3 | ||
|
|
42178355cb | ||
|
|
4860ae6980 | ||
|
|
6655b28810 | ||
|
|
cb89cde5f4 | ||
|
|
5632e15006 | ||
|
|
38cc0b14ce | ||
|
|
20b68c76fd | ||
|
|
b2eec3cba7 | ||
|
|
7053632a72 | ||
|
|
b85cf92ce7 | ||
|
|
07081edafa | ||
|
|
35183f894c | ||
|
|
373f457b2c | ||
|
|
98cc352856 | ||
|
|
fe2be594be | ||
|
|
88ffcd8c1c | ||
|
|
d74030917a | ||
|
|
5c5397bf50 | ||
|
|
fb829423e7 | ||
|
|
19d2203517 | ||
|
|
f722115cde | ||
|
|
94d1958cae | ||
|
|
1ab1336d6f | ||
|
|
0ddea70420 | ||
|
|
f4d8570b9c | ||
|
|
fa73baea9e | ||
|
|
c83f4e7d88 | ||
|
|
78e4d1349c | ||
|
|
338197ba3f | ||
|
|
c3fdbd694f | ||
|
|
edf6fd8a20 | ||
|
|
20d8b00ccf | ||
|
|
f6f991a2cb | ||
|
|
dd2f11988f | ||
|
|
52b6a2ecf9 | ||
|
|
14a335fc49 | ||
|
|
3d96824174 | ||
|
|
20c524d78c | ||
|
|
5cec72b77c | ||
|
|
9bae2577a2 | ||
|
|
a8560c8fe1 | ||
|
|
01c21d8bb5 | ||
|
|
5c7fa7e85a | ||
|
|
4a3df80ecd | ||
|
|
6714e2bc7b | ||
|
|
8c07d610ec | ||
|
|
ae917885e9 | ||
|
|
52a7947b14 | ||
|
|
9ecba6691b | ||
|
|
4b33b6f75c | ||
|
|
fb21ee098d | ||
|
|
f9f2371487 | ||
|
|
d6fb0d7187 | ||
|
|
9f0b7df490 | ||
|
|
2483385c69 | ||
|
|
569166d836 | ||
|
|
1c9dea9f99 | ||
|
|
c8e66e82b2 | ||
|
|
9454d35d4e | ||
|
|
99b2946dbb | ||
|
|
a1eca43bb2 | ||
|
|
ebef2f0647 | ||
|
|
55ead98e0e | ||
|
|
87ab0f55d8 | ||
|
|
868636f313 | ||
|
|
0345d482b2 | ||
|
|
32bb03f0eb | ||
|
|
75a43f51e0 | ||
|
|
9b8a407763 | ||
|
|
db005ab949 | ||
|
|
68d9e8b472 | ||
|
|
4455bd4f35 | ||
|
|
3e59ff25a4 | ||
|
|
344a5c068d | ||
|
|
81b56daedf | ||
|
|
d328557927 | ||
|
|
c2e3723ce3 | ||
|
|
475d018e07 | ||
|
|
124397624f | ||
|
|
b589949bf4 | ||
|
|
eaa2314d9c | ||
|
|
ddf0b5de70 | ||
|
|
a435be1af2 | ||
|
|
238a918182 | ||
|
|
9ad85cd826 | ||
|
|
ea3ffbcd0b | ||
|
|
ba67031ca0 | ||
|
|
34acb8ad51 | ||
|
|
8159e7ed8c | ||
|
|
a16d1c2e08 | ||
|
|
589647ca20 | ||
|
|
aad3d5efa5 | ||
|
|
9ef16fa008 | ||
|
|
f2a62947f8 | ||
|
|
82eafb859b | ||
|
|
d7233583ed | ||
|
|
f1ac2fe022 | ||
|
|
18ca125d8f | ||
|
|
2dedb7400d | ||
|
|
e6ea48c8c9 | ||
|
|
fa27248aa3 | ||
|
|
5ff53df075 | ||
|
|
27f7085a3a | ||
|
|
7bd21f499e | ||
|
|
5e1d8ee639 | ||
|
|
dce273f714 | ||
|
|
82813f57e1 | ||
|
|
f76cb3bcba | ||
|
|
9321bfa207 | ||
|
|
ea9ac052ee | ||
|
|
585e08b210 | ||
|
|
9697ab0e62 | ||
|
|
d20014c87c | ||
|
|
04d7c2b511 | ||
|
|
055c01c467 | ||
|
|
dcc4b303f9 | ||
|
|
677686b83a | ||
|
|
7fbba23e97 | ||
|
|
5e2290d7c0 | ||
|
|
c630501011 | ||
|
|
ad54ef4793 | ||
|
|
8a222ce032 | ||
|
|
b529b94e57 | ||
|
|
cf1b2fbc2e | ||
|
|
84e7b6b3a9 | ||
|
|
049c576864 | ||
|
|
1fea63a953 | ||
|
|
809947cdd7 | ||
|
|
85f872013b | ||
|
|
0719b2a9ab | ||
|
|
9961146cd0 | ||
|
|
6ecd147aad | ||
|
|
dc24c1faad | ||
|
|
03ce9602ea | ||
|
|
35772ab786 | ||
|
|
a8fc6df210 | ||
|
|
350904ac3b | ||
|
|
618212ea84 | ||
|
|
97a7fad692 | ||
|
|
fb489f65fe | ||
|
|
f8ff42192b | ||
|
|
24615358a0 | ||
|
|
21c3148afb | ||
|
|
eb469de2a3 | ||
|
|
bfe3759423 | ||
|
|
0dad966d26 | ||
|
|
e43bbe79bd | ||
|
|
cec026495f | ||
|
|
0225f481de | ||
|
|
67f00e70a3 | ||
|
|
8146bbca65 | ||
|
|
eeff184daa | ||
|
|
e8f27a7f1a | ||
|
|
bbe9d9a390 | ||
|
|
f8ad2f2f6a | ||
|
|
2bd9bdbf27 | ||
|
|
bfda4c78b3 | ||
|
|
ce41eba996 | ||
|
|
243056a797 | ||
|
|
a7d73217f7 | ||
|
|
e8d5d6a190 | ||
|
|
32f73fb816 | ||
|
|
e0dc84c14a | ||
|
|
65414f2b55 | ||
|
|
2cdc977064 | ||
|
|
715373c086 | ||
|
|
2550366c92 | ||
|
|
ae8e677e7e | ||
|
|
1d80fd5802 | ||
|
|
150e993130 | ||
|
|
dde89eda8c | ||
|
|
bcf9a7e0db | ||
|
|
8f590b73fa | ||
|
|
ebb52d9486 | ||
|
|
97de742043 | ||
|
|
3deedffb77 | ||
|
|
1534ac4828 | ||
|
|
721b38ed7b | ||
|
|
4c984985fa | ||
|
|
1e1f2c5c1f | ||
|
|
4fcf4a8593 | ||
|
|
81dbbb0755 | ||
|
|
6dc96d71ee | ||
|
|
5dc22f6dd7 | ||
|
|
1e097361e1 | ||
|
|
334fb00864 | ||
|
|
d042db7964 | ||
|
|
4cffa15a4b | ||
|
|
f5129d2ab0 | ||
|
|
c5f686683f | ||
|
|
6faf936e6c | ||
|
|
cbec030bc7 | ||
|
|
b3feaf91d4 | ||
|
|
587fc99023 | ||
|
|
e1396673d9 | ||
|
|
c2ba3da429 | ||
|
|
6b75a8e143 | ||
|
|
e29994a131 | ||
|
|
eab6e54862 | ||
|
|
6148a47f61 | ||
|
|
302235138d | ||
|
|
9040110608 | ||
|
|
41c78d5411 | ||
|
|
7a3795acc9 | ||
|
|
7444743ec5 | ||
|
|
3d03b32487 | ||
|
|
b83a19c1fe | ||
|
|
ca1ab4478b | ||
|
|
fd96555a79 | ||
|
|
e5184d23c9 | ||
|
|
aa70017547 | ||
|
|
ec6bfb6280 | ||
|
|
c617b2aae1 | ||
|
|
db11fa7a9b | ||
|
|
de56508914 | ||
|
|
d9dd955d69 | ||
|
|
1a45f2cfc1 | ||
|
|
ce3cee68ec | ||
|
|
b00fcb2476 | ||
|
|
28c2e2d0d3 | ||
|
|
77e8641c32 | ||
|
|
e84a96d343 | ||
|
|
be2ea53bcc | ||
|
|
6b22342bb5 | ||
|
|
a6299e7b9b | ||
|
|
93e7dc8709 | ||
|
|
c490721d6a | ||
|
|
5d937a9d24 | ||
|
|
e33251e351 | ||
|
|
d93c3552c9 | ||
|
|
e106e5f8ec | ||
|
|
5027504d73 | ||
|
|
8fadc40656 | ||
|
|
5ee6ccdf48 | ||
|
|
fe3b5073bc | ||
|
|
833a5af74f | ||
|
|
6555881a79 | ||
|
|
1f3f2d04eb | ||
|
|
de4a86ca50 | ||
|
|
ed80d02ee0 | ||
|
|
1789b38dec | ||
|
|
3081189517 | ||
|
|
2f66dbfe8a | ||
|
|
ca98412dec | ||
|
|
0658f454b3 | ||
|
|
1f0fd28baa | ||
|
|
f6371ac1f6 | ||
|
|
d7c62c3022 | ||
|
|
99a7ac1e13 | ||
|
|
8422ff4e31 | ||
|
|
7bea6d54c9 | ||
|
|
372f698357 | ||
|
|
a10a504558 | ||
|
|
f5b7a05e28 | ||
|
|
b0e9011372 | ||
|
|
6be37b9dc3 | ||
|
|
430c239171 | ||
|
|
99fb649ba7 | ||
|
|
50057ec289 | ||
|
|
e870eceaca | ||
|
|
e0a1691621 | ||
|
|
8891630f69 | ||
|
|
c5913542f0 | ||
|
|
44cdadabca | ||
|
|
2b8875d19d | ||
|
|
2aa64bb2cd | ||
|
|
164ad16328 | ||
|
|
f0c78b02df | ||
|
|
be8608eb47 | ||
|
|
ecb7bfc786 | ||
|
|
c07d9cc8cb | ||
|
|
6c2431912e | ||
|
|
7fc282a2d5 | ||
|
|
7782bcddac | ||
|
|
b67239ef3e | ||
|
|
7f6a14131d | ||
|
|
21fc6938ca | ||
|
|
ed22876b1d | ||
|
|
00fb558db8 | ||
|
|
ccd5971445 | ||
|
|
03facd1765 | ||
|
|
d3ee18fe71 | ||
|
|
592798b40f | ||
|
|
de305f9831 | ||
|
|
75ee0d0ae2 | ||
|
|
05956f8160 | ||
|
|
e9c55f47c6 | ||
|
|
1330726470 | ||
|
|
3033868814 | ||
|
|
9b2bd07074 | ||
|
|
39ff90474c | ||
|
|
cfd5abc1a7 | ||
|
|
03d7d494fa | ||
|
|
52b13da2b3 | ||
|
|
e3b7269f3b | ||
|
|
4e183439b5 | ||
|
|
c4fa174fad | ||
|
|
cc59f62420 | ||
|
|
00b052bddf | ||
|
|
81c22fcbc2 | ||
|
|
0139618f37 | ||
|
|
8ed4f47f82 | ||
|
|
22dd8e1c3a | ||
|
|
a6a0207718 | ||
|
|
b00d0dc083 | ||
|
|
54d0442fe0 | ||
|
|
cf7c774b09 | ||
|
|
eef059736f | ||
|
|
17001129d1 | ||
|
|
434ea9b9ef | ||
|
|
61dd1b9a34 | ||
|
|
2cf0a44d5f | ||
|
|
0853c1c419 | ||
|
|
20734d5162 | ||
|
|
c88440243f | ||
|
|
5a2971fe6f | ||
|
|
bdd28b5cd4 | ||
|
|
bb9117bdb6 | ||
|
|
921c66abf3 | ||
|
|
da525b1856 | ||
|
|
cc237560c6 | ||
|
|
74f39fb080 | ||
|
|
86e4541225 | ||
|
|
9002502163 | ||
|
|
49747c58f1 | ||
|
|
bf48bd6ac2 | ||
|
|
b445471d76 | ||
|
|
d88f402a34 | ||
|
|
6ee5f9201f | ||
|
|
d051785d20 | ||
|
|
719f0d9442 | ||
|
|
2065c6119b | ||
|
|
6c1ee933f7 | ||
|
|
343f6727c6 | ||
|
|
346eb576f7 | ||
|
|
35ea453b06 | ||
|
|
c717c6932c | ||
|
|
0be1117bd0 | ||
|
|
186732fb05 | ||
|
|
54e901f881 | ||
|
|
c3330b85b8 | ||
|
|
843fe39cdc | ||
|
|
8eee7d590d | ||
|
|
7839d2512f | ||
|
|
195dbf518f | ||
|
|
cc1d6a300f | ||
|
|
4c8c9f8432 | ||
|
|
03ab4a29a1 | ||
|
|
6218ed2bac | ||
|
|
3bac806f61 | ||
|
|
ffaa1675e5 | ||
|
|
bed2acc7f1 | ||
|
|
f2a8d91b5d | ||
|
|
999b98e1f0 | ||
|
|
3eeaf8f300 | ||
|
|
5a5a583ac6 | ||
|
|
08eca9d1c2 | ||
|
|
5f0f6745a8 | ||
|
|
2d2c5bcb00 | ||
|
|
824035898b | ||
|
|
2afb2fad56 | ||
|
|
34edc88413 | ||
|
|
5c8d1c2755 | ||
|
|
0b276db586 | ||
|
|
c1f59da49d | ||
|
|
aa5b727cd2 | ||
|
|
6afcc59c05 | ||
|
|
dbaff30da3 | ||
|
|
ce42192334 | ||
|
|
aad7218df6 | ||
|
|
23a9322e5e | ||
|
|
a84014402b | ||
|
|
865431c58a | ||
|
|
6496f271d2 | ||
|
|
32b9971cfa | ||
|
|
c8cf0df6e1 | ||
|
|
c987a0a9af | ||
|
|
7b315f99bd | ||
|
|
0cdeb09ab0 | ||
|
|
a92f1c5c40 | ||
|
|
b179ce2437 | ||
|
|
be0b55ffe7 | ||
|
|
0ada90777a | ||
|
|
3006ee4764 | ||
|
|
2b31a22f09 | ||
|
|
02f852cb89 | ||
|
|
1e3d9f16df | ||
|
|
561ae52422 | ||
|
|
b81a1eb2d7 | ||
|
|
12d786f810 | ||
|
|
c7313e169c | ||
|
|
a3eede4d4e | ||
|
|
13ae1bcdb9 | ||
|
|
7820b82f6a | ||
|
|
f0e57cfa93 | ||
|
|
283d125901 | ||
|
|
f127079c62 | ||
|
|
81fdcba4c9 | ||
|
|
fcacd91f69 | ||
|
|
fe6fa0bb5a | ||
|
|
ea71dbe18b | ||
|
|
e86076c2e6 | ||
|
|
f6e0b94078 | ||
|
|
bbce8a072b | ||
|
|
755327d721 | ||
|
|
48207f17aa | ||
|
|
a0c5f7b65f | ||
|
|
ae462cb4bf | ||
|
|
8e7c040f51 | ||
|
|
d30febc151 | ||
|
|
b7147ba64c | ||
|
|
0f698e1306 | ||
|
|
8844967d5d | ||
|
|
1e1f53a8fc | ||
|
|
1338a12ac6 | ||
|
|
77847d848c | ||
|
|
599f6d8c89 | ||
|
|
c35979a69f | ||
|
|
589e2e77b1 | ||
|
|
efddb39ff5 | ||
|
|
1b4e1e5b51 | ||
|
|
7b81eaea0c | ||
|
|
110a61a92f | ||
|
|
1cfc143618 | ||
|
|
993eaae2f7 | ||
|
|
58cae8f526 | ||
|
|
9086c5b61d | ||
|
|
136a9fe6f6 | ||
|
|
034b8b8a7c | ||
|
|
d358518ab5 | ||
|
|
729ea4c26c | ||
|
|
76548ad6a9 | ||
|
|
356d5e9d39 | ||
|
|
e493b724b4 | ||
|
|
7cd383ab85 | ||
|
|
63cecd884f | ||
|
|
934b2022af | ||
|
|
80827e9ef2 | ||
|
|
50faf8dd64 | ||
|
|
8c3903c086 | ||
|
|
c19800b3ed | ||
|
|
1ca5830e5b | ||
|
|
04553c014f | ||
|
|
25d659de0a | ||
|
|
eac6d4c074 | ||
|
|
ce84b1ee2c | ||
|
|
0f7fcad8ff | ||
|
|
77521d91e5 | ||
|
|
9f444293eb | ||
|
|
96fd4d95cc | ||
|
|
5aae8e9134 | ||
|
|
7e01297be8 | ||
|
|
545118b4d3 | ||
|
|
e75f065191 | ||
|
|
61e877b5c6 | ||
|
|
3e31640a25 |
No files matched your search
@@ -0,0 +1,4 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'xcpretty'
|
||||
gem 'xcpretty-travis-formatter'
|
||||
+17
-3
@@ -93,7 +93,21 @@ xcuserdata
|
||||
*.hmap
|
||||
*.ipa
|
||||
|
||||
# Performance test baselines
|
||||
*.xcbaseline
|
||||
|
||||
##
|
||||
GRDB Tests/Carthage/Carthage
|
||||
GRDB Tests/Carthage/Cartfile.resolved
|
||||
# GRDBCustomSQLite USER configuration files
|
||||
SQLiteCustom/GRDBCustomSQLite-USER.h
|
||||
SQLiteCustom/GRDBCustomSQLite-USER.xcconfig
|
||||
|
||||
# CocoaPods test
|
||||
Podfile.lock
|
||||
Pods
|
||||
|
||||
# SPM
|
||||
.build
|
||||
Package.resolved
|
||||
Tests/SPM/Packages
|
||||
|
||||
# Ruby
|
||||
.ruby-version
|
||||
+13
-4
@@ -1,6 +1,15 @@
|
||||
[submodule "GRDB Tests/Performance/fmdb"]
|
||||
path = GRDB Tests/Performance/fmdb
|
||||
[submodule "Tests/Performance/fmdb"]
|
||||
path = Tests/Performance/fmdb
|
||||
url = https://github.com/ccgus/fmdb.git
|
||||
[submodule "GRDB Tests/Performance/SQLite.swift"]
|
||||
path = GRDB Tests/Performance/SQLite.swift
|
||||
[submodule "Tests/Performance/SQLite.swift"]
|
||||
path = Tests/Performance/SQLite.swift
|
||||
url = https://github.com/stephencelis/SQLite.swift.git
|
||||
[submodule "Tests/Performance/Realm"]
|
||||
path = Tests/Performance/Realm
|
||||
url = https://github.com/realm/realm-cocoa.git
|
||||
[submodule "SQLCipher/src"]
|
||||
path = SQLCipher/src
|
||||
url = https://github.com/groue/sqlcipher.git
|
||||
[submodule "SQLiteCustom/src"]
|
||||
path = SQLiteCustom/src
|
||||
url = https://github.com/swiftlyfalling/SQLiteLib
|
||||
@@ -0,0 +1 @@
|
||||
4.0
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
language: objective-c
|
||||
xcode_project: GRDB.xcodeproj
|
||||
|
||||
# Disable the default Travis-CI submodule logic
|
||||
# The various make commands ensure that the appropriate submodules are retrieved
|
||||
git:
|
||||
submodules: false
|
||||
|
||||
jobs:
|
||||
include:
|
||||
|
||||
###########################################
|
||||
## Test GRDB
|
||||
|
||||
# Test GRDBOSX (Xcode 9)
|
||||
- stage: Test GRDB
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=GRDBOSX (Xcode 9, macOS 10.12)
|
||||
script: make test_framework_GRDBOSX
|
||||
|
||||
# Test GRDBWatchOS (Xcode 9)
|
||||
- stage: Test GRDB
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=GRDBWatchOS (Xcode 9, watchOS)
|
||||
script: make test_framework_GRDBWatchOS
|
||||
|
||||
# Test GRDBiOS (Xcode 9, iOS <MAXIMUM VERSION>)
|
||||
- stage: Test GRDB
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=GRDBiOS (Xcode 9, iOS <MAX>)
|
||||
script: make test_framework_GRDBiOS_maxTarget
|
||||
|
||||
# Test GRDBiOS (Xcode 9, iOS <MINIMUM VERSION>))
|
||||
- stage: Test GRDB
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=GRDBiOS (Xcode 9, iOS <MIN>)
|
||||
script: make test_framework_GRDBiOS_minTarget
|
||||
|
||||
# Test GRDB [SPM] (Xcode 9, macOS 10.12)
|
||||
- stage: Test GRDB
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=GRDB [SPM] (Xcode 9, macOS 10.12)
|
||||
script: make test_SPM
|
||||
|
||||
###########################################
|
||||
## Test GRDB (Custom SQLite)
|
||||
|
||||
# Test GRDBCustomSQLiteOSX (Xcode 9)
|
||||
- stage: Test GRDB + Custom SQLite
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=GRDBCustomSQLiteOSX (Xcode 9, macOS 10.12)
|
||||
script: make test_framework_GRDBCustomSQLiteOSX
|
||||
|
||||
# Test GRDBCustomSQLiteiOS (Xcode 9, iOS <MAXIMUM VERSION>)
|
||||
- stage: Test GRDB + Custom SQLite
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=GRDBCustomSQLiteiOS (Xcode 9, iOS <MAX>)
|
||||
script: make test_framework_GRDBCustomSQLiteiOS_maxTarget
|
||||
|
||||
# Test GRDBCustomSQLiteiOS (Xcode 9, iOS <MINIMUM VERSION>))
|
||||
- stage: Test GRDB + Custom SQLite
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=GRDBCustomSQLiteiOS (Xcode 9, iOS <MIN>)
|
||||
script: make test_framework_GRDBCustomSQLiteiOS_minTarget
|
||||
|
||||
###########################################
|
||||
## Test GRDB (SQLCipher)
|
||||
|
||||
# Test GRDBCipherOSX (Xcode 9)
|
||||
- stage: Test GRDB + SQLCipher
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=GRDBCipherOSX (Xcode 9, macOS 10.12)
|
||||
script: make test_framework_GRDBCipherOSX
|
||||
|
||||
# Test GRDBCipheriOS (Xcode 9, iOS <MAXIMUM VERSION>)
|
||||
- stage: Test GRDB + SQLCipher
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=GRDBCipheriOS (Xcode 9, iOS <MAX>)
|
||||
script: make test_framework_GRDBCipheriOS_maxTarget
|
||||
|
||||
# Test GRDBCipheriOS (Xcode 9, iOS <MINIMUM VERSION>))
|
||||
- stage: Test GRDB + SQLCipher
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=GRDBCipheriOS (Xcode 9, iOS <MIN>)
|
||||
script: make test_framework_GRDBCipheriOS_minTarget
|
||||
|
||||
###########################################
|
||||
## Test Installation Methods
|
||||
|
||||
# Manual Install
|
||||
- stage: Test Installation
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=Manual Install
|
||||
script: make test_install_manual
|
||||
|
||||
# Manual Install (GRDBCipher)
|
||||
- stage: Test Installation
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=Manual Install (GRDBCipher)
|
||||
script: make test_install_GRDBCipher
|
||||
|
||||
# Cocoapods Lint
|
||||
- stage: Test Installation
|
||||
osx_image: xcode9
|
||||
install:
|
||||
- gem install cocoapods # Since Travis is not always on latest version
|
||||
env:
|
||||
- TID=Cocoapods
|
||||
script: make test_CocoaPodsLint
|
||||
|
||||
# SPM Install
|
||||
- stage: Test Installation
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- TID=SPM
|
||||
script: make test_install_SPM
|
||||
|
||||
## The following doesn’t work, as `make test_CarthageBuild` does not yet work.
|
||||
## Carthage Build
|
||||
#- stage: Carthage
|
||||
# osx_image: xcode9
|
||||
# before_install:
|
||||
# - brew update
|
||||
# - brew outdated carthage || brew upgrade carthage
|
||||
# script: make test_CarthageBuild
|
||||
+3222
-5
File diff suppressed because it is too large.
Load diff
@@ -1,120 +0,0 @@
|
||||
The Design of GRDB.swift
|
||||
========================
|
||||
|
||||
More than caveats or defects, there are a few glitches, or surprises in the GRDB.swift API. We try to explain them here. The interested readers can take them as Swift challenges!
|
||||
|
||||
|
||||
### Why is Record a class, when protocols are all the rage?
|
||||
|
||||
Easy: Swift protocols don't provide `super`, and `super` is what turns Record into the flexible base class you need when you implement your specific needs:
|
||||
|
||||
```swift
|
||||
// A Record that makes sure its UUID is set before insertion:
|
||||
class A : Record {
|
||||
var UUID: NSString?
|
||||
override func insert(db: Database) throws {
|
||||
if UUID == nil {
|
||||
UUID = NSUUID().UUIDString
|
||||
}
|
||||
try super.insert()
|
||||
}
|
||||
}
|
||||
|
||||
// A Record that validates itself before saving:
|
||||
class B : Record {
|
||||
override func insert(db: Database) throws {
|
||||
try validate()
|
||||
try super.insert(db)
|
||||
}
|
||||
override func update(db: Database) throws {
|
||||
try validate()
|
||||
try super.update(db)
|
||||
}
|
||||
func validate() throws {
|
||||
...
|
||||
}
|
||||
}
|
||||
|
||||
// A Record that deletes an external resource after being deleted from
|
||||
// the database:
|
||||
class C : Record {
|
||||
public func delete(db: Database) throws -> DeletionResult {
|
||||
switch try super.delete(db) {
|
||||
case .RowDeleted:
|
||||
try NSFileManager.defaultManager().removeItemAtPath(...)
|
||||
case .NoRowDeleted:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
A second reason: the `databaseEdited` flag, which is true when a Record has unsaved changes, is easily provided by the base class Record. Record can manage its internal state *accross method calls*. Protocols could not provide this service without extra complexity.
|
||||
|
||||
Yet, don't miss the [RowConvertible](http://cocoadocs.org/docsets/GRDB.swift/0.12.0/Protocols/RowConvertible.html) and [DatabaseMapping](http://cocoadocs.org/docsets/GRDB.swift/0.12.0/Protocols/DatabaseTableMapping.html) protocols: they provide fetching from custom SQL queries and fetching by primary key for free.
|
||||
|
||||
|
||||
### Why must we provide query arguments in an Array, when Swift provides variadic method parameters?
|
||||
|
||||
I admit that the array argument below looks odd:
|
||||
|
||||
```swift
|
||||
Int.fetch(db,
|
||||
"SELECT COUNT(*) FROM persons WHERE name = ?",
|
||||
arguments: ["Arthur"])
|
||||
```
|
||||
|
||||
Well, GRDB provides three fetching methods for each fetchable type:
|
||||
|
||||
```swift
|
||||
// Row
|
||||
Row.fetch(db, "SELECT ...", arguments: ...) // DatabaseSequence<Row>
|
||||
Row.fetchAll(db, "SELECT ...", arguments: ...) // [Row]
|
||||
Row.fetchOne(db, "SELECT ...", arguments: ...) // Row?
|
||||
|
||||
// DatabaseValueConvertible
|
||||
String.fetch(db, "SELECT ...", arguments: ...) // DatabaseSequence<String>
|
||||
String.fetchAll(db, "SELECT ...", arguments: ...) // [String]
|
||||
String.fetchOne(db, "SELECT ...", arguments: ...) // String?
|
||||
|
||||
// Record (via RowConvertible)
|
||||
Person.fetch(db, "SELECT ...", arguments: ...) // DatabaseSequence<Person>
|
||||
Person.fetchAll(db, "SELECT ...", arguments: ...) // [Person]
|
||||
Person.fetchOne(db, "SELECT ...", arguments: ...) // Person?
|
||||
```
|
||||
|
||||
The `arguments` parameter type is StatementArguments, which is both ArrayLiteralConvertible and DictionaryLiteralConvertible, so that you can write both:
|
||||
|
||||
```swift
|
||||
Int.fetch(db,
|
||||
"SELECT COUNT(*) FROM persons WHERE name = ?",
|
||||
arguments: ["Arthur"])
|
||||
Int.fetch(db,
|
||||
"SELECT COUNT(*) FROM persons WHERE name = :name",
|
||||
arguments: ["name": "Arthur"])
|
||||
```
|
||||
|
||||
Without StatementArguments, that number would be six (three for Array and three for Dictionary), or even nine (three more for variadic parameters). I prefer limiting the API footprint: three methods per fetchable type is just quite fine.
|
||||
|
||||
Moreover, one of my pet peeves with SQLite is that it is a pain to write an SQL query with the `IN` operator. SQLite won't natively feed a single `?` placeholder with an array of values, and this forces users to build their own `IN(?,?,?,...)` SQL snippets:
|
||||
|
||||
```swift
|
||||
// Let's load persons whose name is in names:
|
||||
let names = ["Arthur", "Barbara"]
|
||||
let questionMarks = Array(count: names.count, repeatedValue: "?").joinWithSeparator(",") // OMG Swift come on
|
||||
let sql = "SELECT * FROM persons WHERE name IN (\(questionMarks))"
|
||||
let persons = Person.fetchAll(db, sql, arguments: StatementArguments(names))
|
||||
```
|
||||
|
||||
I wish that in a future version of GRDB we can write instead:
|
||||
|
||||
```swift
|
||||
Person.fetchAll(db,
|
||||
"SELECT * FROM persons WHERE name IN (?)",
|
||||
arguments: [["Arthur", "Barbara"]]) // one array argument
|
||||
Person.fetchAll(db,
|
||||
"SELECT * FROM persons WHERE name = ? OR name = ?",
|
||||
arguments: ["Arthur", "Barbara"]) // two string arguments
|
||||
```
|
||||
|
||||
This will require to distinguish arrays of values from arrays of arrays of values.
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "watch",
|
||||
"screenWidth" : "{130,145}",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "watch",
|
||||
"screenWidth" : "{146,165}",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"assets" : [
|
||||
{
|
||||
"idiom" : "watch",
|
||||
"filename" : "Circular.imageset",
|
||||
"role" : "circular"
|
||||
},
|
||||
{
|
||||
"idiom" : "watch",
|
||||
"filename" : "Extra Large.imageset",
|
||||
"role" : "extra-large"
|
||||
},
|
||||
{
|
||||
"idiom" : "watch",
|
||||
"filename" : "Modular.imageset",
|
||||
"role" : "modular"
|
||||
},
|
||||
{
|
||||
"idiom" : "watch",
|
||||
"filename" : "Utilitarian.imageset",
|
||||
"role" : "utilitarian"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "watch",
|
||||
"screenWidth" : "{130,145}",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "watch",
|
||||
"screenWidth" : "{146,165}",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "watch",
|
||||
"screenWidth" : "{130,145}",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "watch",
|
||||
"screenWidth" : "{146,165}",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "watch",
|
||||
"screenWidth" : "{130,145}",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "watch",
|
||||
"screenWidth" : "{146,165}",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import WatchKit
|
||||
|
||||
class ExtensionDelegate: NSObject, WKExtensionDelegate {
|
||||
|
||||
func applicationDidFinishLaunching() {
|
||||
// Perform any final initialization of your application.
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive() {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
func applicationWillResignActive() {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, etc.
|
||||
}
|
||||
|
||||
func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) {
|
||||
// Sent when the system needs to launch the application in the background to process tasks. Tasks arrive in a set, so loop through and process each one.
|
||||
for task in backgroundTasks {
|
||||
// Use a switch statement to check the task type
|
||||
switch task {
|
||||
case let backgroundTask as WKApplicationRefreshBackgroundTask:
|
||||
// Be sure to complete the background task once you’re done.
|
||||
backgroundTask.setTaskCompleted()
|
||||
case let snapshotTask as WKSnapshotRefreshBackgroundTask:
|
||||
// Snapshot tasks have a unique completion call, make sure to set your expiration date
|
||||
snapshotTask.setTaskCompleted(restoredDefaultState: true, estimatedSnapshotExpiration: Date.distantFuture, userInfo: nil)
|
||||
case let connectivityTask as WKWatchConnectivityRefreshBackgroundTask:
|
||||
// Be sure to complete the connectivity task once you’re done.
|
||||
connectivityTask.setTaskCompleted()
|
||||
case let urlSessionTask as WKURLSessionRefreshBackgroundTask:
|
||||
// Be sure to complete the URL session task once you’re done.
|
||||
urlSessionTask.setTaskCompleted()
|
||||
default:
|
||||
// make sure to complete unhandled task types
|
||||
task.setTaskCompleted()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,8 @@
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>GRDBDemoWatchOS Extension</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@@ -13,12 +15,22 @@
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionAttributes</key>
|
||||
<dict>
|
||||
<key>WKAppBundleIdentifier</key>
|
||||
<string>com.github.groue.GRDBDemoiOS.watchkitapp</string>
|
||||
</dict>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.watchkit</string>
|
||||
</dict>
|
||||
<key>WKExtensionDelegateClassName</key>
|
||||
<string>$(PRODUCT_MODULE_NAME).ExtensionDelegate</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,16 @@
|
||||
import WatchKit
|
||||
import Foundation
|
||||
import GRDB
|
||||
import SQLite3
|
||||
|
||||
class InterfaceController: WKInterfaceController {
|
||||
|
||||
@IBOutlet var versionLabel: WKInterfaceLabel!
|
||||
|
||||
override func awake(withContext context: Any?) {
|
||||
super.awake(withContext: context)
|
||||
|
||||
let sqliteVersion = String(cString: sqlite3_libversion(), encoding: .utf8)
|
||||
versionLabel.setText(sqliteVersion)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "24x24",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "notificationCenter",
|
||||
"subtype" : "38mm"
|
||||
},
|
||||
{
|
||||
"size" : "27.5x27.5",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "notificationCenter",
|
||||
"subtype" : "42mm"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "watch",
|
||||
"role" : "companionSettings",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "watch",
|
||||
"role" : "companionSettings",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "appLauncher",
|
||||
"subtype" : "38mm"
|
||||
},
|
||||
{
|
||||
"size" : "86x86",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "quickLook",
|
||||
"subtype" : "38mm"
|
||||
},
|
||||
{
|
||||
"size" : "98x98",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "quickLook",
|
||||
"subtype" : "42mm"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="12118" systemVersion="16E195" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="AgC-eL-Hgc">
|
||||
<device id="watch38" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="watchOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="12029"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Interface Controller-->
|
||||
<scene sceneID="aou-V4-d1y">
|
||||
<objects>
|
||||
<controller id="AgC-eL-Hgc" customClass="InterfaceController" customModule="GRDBDemoWatchOS" customModuleProvider="target">
|
||||
<items>
|
||||
<group width="1" alignment="left" verticalAlignment="center" layout="vertical" id="tkk-aG-QQF">
|
||||
<items>
|
||||
<label alignment="center" text="SQLite version" id="dGA-xX-x8V"/>
|
||||
<label alignment="center" text="Label" id="whi-N6-h8U"/>
|
||||
</items>
|
||||
</group>
|
||||
</items>
|
||||
<connections>
|
||||
<outlet property="versionLabel" destination="whi-N6-h8U" id="5xN-Gj-yNt"/>
|
||||
</connections>
|
||||
</controller>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
+12
-3
@@ -4,6 +4,8 @@
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>GRDBDemoiOS</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@@ -13,12 +15,19 @@
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
</array>
|
||||
<key>WKCompanionAppBundleIdentifier</key>
|
||||
<string>com.github.groue.GRDBDemoiOS</string>
|
||||
<key>WKWatchKitApp</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
File diff suppressed because it is too large.
Load diff
+141
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "568E5FBE1E926430002582E0"
|
||||
BuildableName = "GRDBDemoWatchOS.app"
|
||||
BlueprintName = "GRDBDemoWatchOS"
|
||||
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56B036021E8D9EBE003B6DA4"
|
||||
BuildableName = "GRDBDemoiOS.app"
|
||||
BlueprintName = "GRDBDemoiOS"
|
||||
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "568E5FCA1E926430002582E0"
|
||||
BuildableName = "GRDBDemoWatchOS Extension.appex"
|
||||
BlueprintName = "GRDBDemoWatchOS Extension"
|
||||
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "568E5FBE1E926430002582E0"
|
||||
BuildableName = "GRDBDemoWatchOS.app"
|
||||
BlueprintName = "GRDBDemoWatchOS"
|
||||
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.carousel"
|
||||
RemotePath = "/GRDBDemoiOS">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "568E5FBE1E926430002582E0"
|
||||
BuildableName = "GRDBDemoWatchOS.app"
|
||||
BlueprintName = "GRDBDemoWatchOS"
|
||||
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</RemoteRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "568E5FBE1E926430002582E0"
|
||||
BuildableName = "GRDBDemoWatchOS.app"
|
||||
BlueprintName = "GRDBDemoWatchOS"
|
||||
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.carousel"
|
||||
RemotePath = "/GRDBDemoiOS">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "568E5FBE1E926430002582E0"
|
||||
BuildableName = "GRDBDemoWatchOS.app"
|
||||
BlueprintName = "GRDBDemoWatchOS"
|
||||
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</RemoteRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "568E5FBE1E926430002582E0"
|
||||
BuildableName = "GRDBDemoWatchOS.app"
|
||||
BlueprintName = "GRDBDemoWatchOS"
|
||||
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56B036021E8D9EBE003B6DA4"
|
||||
BuildableName = "GRDBDemoiOS.app"
|
||||
BlueprintName = "GRDBDemoiOS"
|
||||
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56B036021E8D9EBE003B6DA4"
|
||||
BuildableName = "GRDBDemoiOS.app"
|
||||
BlueprintName = "GRDBDemoiOS"
|
||||
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56B036021E8D9EBE003B6DA4"
|
||||
BuildableName = "GRDBDemoiOS.app"
|
||||
BlueprintName = "GRDBDemoiOS"
|
||||
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56B036021E8D9EBE003B6DA4"
|
||||
BuildableName = "GRDBDemoiOS.app"
|
||||
BlueprintName = "GRDBDemoiOS"
|
||||
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,63 +1,11 @@
|
||||
import UIKit
|
||||
import GRDB
|
||||
|
||||
// The shared database queue, stored in a global.
|
||||
// It is created in AppDelegate.application(_:didFinishLaunchingWithOptions:)
|
||||
var dbQueue: DatabaseQueue!
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
var window: UIWindow?
|
||||
|
||||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
|
||||
|
||||
// Connect to the database
|
||||
|
||||
let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first! as NSString
|
||||
let databasePath = documentsPath.stringByAppendingPathComponent("db.sqlite")
|
||||
dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
|
||||
|
||||
// Use DatabaseMigrator to setup the database
|
||||
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.registerMigration("createPersons") { db in
|
||||
try db.execute(
|
||||
"CREATE TABLE persons (" +
|
||||
"id INTEGER PRIMARY KEY, " +
|
||||
"firstName TEXT, " +
|
||||
"lastName TEXT " +
|
||||
")")
|
||||
}
|
||||
migrator.registerMigration("addPersons") { db in
|
||||
try Person(firstName: "Arthur", lastName: "Miller").insert(db)
|
||||
try Person(firstName: "Barbara", lastName: "Streisand").insert(db)
|
||||
try Person(firstName: "Cinderella").insert(db)
|
||||
}
|
||||
try! migrator.migrate(dbQueue)
|
||||
|
||||
|
||||
// Setup view controllers
|
||||
|
||||
let splitViewController = self.window!.rootViewController as! UISplitViewController
|
||||
let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
|
||||
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
|
||||
splitViewController.delegate = self
|
||||
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
|
||||
try! setupDatabase(application)
|
||||
return true
|
||||
}
|
||||
|
||||
// MARK: - Split view
|
||||
|
||||
func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController:UIViewController, ontoPrimaryViewController primaryViewController:UIViewController) -> Bool {
|
||||
guard let secondaryAsNavController = secondaryViewController as? UINavigationController else { return false }
|
||||
guard let topAsDetailController = secondaryAsNavController.topViewController as? DetailViewController else { return false }
|
||||
if topAsDetailController.person == nil {
|
||||
// Return true to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded.
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
@@ -21,15 +31,27 @@
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
@@ -59,6 +81,11 @@
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "83.5x83.5",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
@@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
@@ -16,29 +15,8 @@
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright © 2015 Gwendal Roué. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
|
||||
<rect key="frame" x="20" y="559" width="560" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="GRDBDemoiOS" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
|
||||
<rect key="frame" x="20" y="180" width="560" height="43"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
|
||||
<constraint firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
|
||||
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="SfN-ll-jLj"/>
|
||||
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
|
||||
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
|
||||
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="x7j-FC-K8j"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
|
||||
@@ -1,131 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="H1p-Uh-vWS">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11129.15" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="UAh-8N-CM8">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11103.10"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Master-->
|
||||
<scene sceneID="pY4-Hu-kfo">
|
||||
<!--Hall Of Fame-->
|
||||
<scene sceneID="8jG-C9-QsI">
|
||||
<objects>
|
||||
<navigationController title="Master" id="RMx-3f-FxP" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="Pmd-2v-anx">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="7bK-jq-Zjz" kind="relationship" relationship="rootViewController" id="tsl-Nk-0bq"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="8fS-aE-onr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-38" y="-630"/>
|
||||
</scene>
|
||||
<!--Detail-->
|
||||
<scene sceneID="yUG-lL-AsK">
|
||||
<objects>
|
||||
<viewController title="Detail" id="JEX-9P-axG" customClass="DetailViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="SYR-Wa-9uf"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="GAO-Cl-Wes"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="svH-Pt-448">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<tableViewController id="cyv-nk-Plb" customClass="SimplePersonsViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="oON-zg-8kO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Detail view content goes here" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="0XM-y9-sOw">
|
||||
<rect key="frame" x="20" y="292" width="560" height="17"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<fontDescription key="fontDescription" type="system" size="system"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="0XM-y9-sOw" firstAttribute="leading" secondItem="svH-Pt-448" secondAttribute="leading" constant="20" symbolic="YES" id="Tsc-yG-G1q"/>
|
||||
<constraint firstItem="0XM-y9-sOw" firstAttribute="centerY" secondItem="svH-Pt-448" secondAttribute="centerY" id="jWN-iV-94e"/>
|
||||
<constraint firstAttribute="trailing" secondItem="0XM-y9-sOw" secondAttribute="trailing" constant="20" symbolic="YES" id="tHV-ZD-HQj"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Person" textLabel="XIE-DF-pSO" detailTextLabel="vyz-CH-eMb" style="IBUITableViewCellStyleValue1" id="V5t-oJ-KD9">
|
||||
<frame key="frameInset" minY="92" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="V5t-oJ-KD9" id="Coo-th-ywF">
|
||||
<frame key="frameInset" width="342" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="XIE-DF-pSO">
|
||||
<frame key="frameInset" minX="15" minY="12" width="31.5" height="19.5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="vyz-CH-eMb">
|
||||
<frame key="frameInset" minX="298.5" minY="12" width="41.5" height="19.5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="iNr-Oe-muq" kind="show" identifier="EditPerson" id="czF-1h-sYn"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="cyv-nk-Plb" id="uBb-Bn-Lhg"/>
|
||||
<outlet property="delegate" destination="cyv-nk-Plb" id="nLb-Ak-ZXS"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<toolbarItems/>
|
||||
<navigationItem key="navigationItem" title="Detail" id="mOI-FS-AaM"/>
|
||||
<navigationItem key="navigationItem" title="Hall Of Fame" id="YLU-iz-PGw"/>
|
||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||
<connections>
|
||||
<outlet property="detailDescriptionLabel" destination="0XM-y9-sOw" id="deQ-Na-JPF"/>
|
||||
<segue destination="ein-Sr-i8w" kind="presentation" identifier="NewPerson" id="zii-bJ-cOA"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="FJe-Yq-33r" sceneMemberID="firstResponder"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="PrM-ex-2C8" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="709" y="129"/>
|
||||
<point key="canvasLocation" x="630" y="640"/>
|
||||
</scene>
|
||||
<!--Person Edition View Controller-->
|
||||
<scene sceneID="hZT-8U-F5G">
|
||||
<scene sceneID="Juk-Ad-tZ2">
|
||||
<objects>
|
||||
<tableViewController id="yMU-Wr-YuI" customClass="PersonEditionViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="W7Z-fg-c9y">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<tableViewController id="iNr-Oe-muq" customClass="PersonEditionViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="vlV-lc-eQA">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<sections>
|
||||
<tableViewSection id="jAm-13-xC3">
|
||||
<tableViewSection id="Nzq-eO-jT3">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="M9a-av-50p">
|
||||
<rect key="frame" x="0.0" y="99" width="600" height="44"/>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="2gb-gB-918">
|
||||
<rect key="frame" x="0.0" y="64" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="M9a-av-50p" id="z18-Cs-DYr">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2gb-gB-918" id="iyM-TJ-JB4">
|
||||
<frame key="frameInset" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="BDD-vR-uvL">
|
||||
<rect key="frame" x="106" y="11" width="479" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" spellCheckingType="no"/>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalCompressionResistancePriority="250" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Name" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="m5m-Zs-j0z">
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" spellCheckingType="no" returnKeyType="next"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="yMU-Wr-YuI" id="kl9-oG-bcm"/>
|
||||
<outlet property="delegate" destination="iNr-Oe-muq" id="K2p-7d-teD"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="First Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fUF-iv-npM">
|
||||
<rect key="frame" x="15" y="11" width="83" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.1137254902" green="0.47843137250000001" blue="0.98039215690000003" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="BDD-vR-uvL" firstAttribute="centerY" secondItem="z18-Cs-DYr" secondAttribute="centerY" id="9Rw-U2-gEE"/>
|
||||
<constraint firstAttribute="trailing" secondItem="BDD-vR-uvL" secondAttribute="trailing" constant="15" id="nQF-Sy-r5l"/>
|
||||
<constraint firstItem="fUF-iv-npM" firstAttribute="centerY" secondItem="z18-Cs-DYr" secondAttribute="centerY" id="ofb-oL-lAk"/>
|
||||
<constraint firstItem="BDD-vR-uvL" firstAttribute="leading" secondItem="fUF-iv-npM" secondAttribute="trailing" constant="8" symbolic="YES" id="pL4-Tm-5q7"/>
|
||||
<constraint firstItem="fUF-iv-npM" firstAttribute="leading" secondItem="z18-Cs-DYr" secondAttribute="leading" constant="15" id="tBn-VL-Q7E"/>
|
||||
<constraint firstItem="m5m-Zs-j0z" firstAttribute="leading" secondItem="iyM-TJ-JB4" secondAttribute="leadingMargin" constant="10" id="9cK-nj-70V"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="m5m-Zs-j0z" secondAttribute="trailing" id="JsE-8v-XAS"/>
|
||||
<constraint firstItem="m5m-Zs-j0z" firstAttribute="centerY" secondItem="iyM-TJ-JB4" secondAttribute="centerY" id="psG-tW-QrM"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="TEu-C2-7tX">
|
||||
<rect key="frame" x="0.0" y="143" width="600" height="44"/>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="vp3-Ft-Gth">
|
||||
<rect key="frame" x="0.0" y="108" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="TEu-C2-7tX" id="awh-JA-Hz6">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="vp3-Ft-Gth" id="ccO-0O-u72">
|
||||
<frame key="frameInset" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="iqx-ux-kA0">
|
||||
<rect key="frame" x="105" y="11" width="480" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" spellCheckingType="no"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="yMU-Wr-YuI" id="pIN-qZ-ntI"/>
|
||||
</connections>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalCompressionResistancePriority="250" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Score" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="rZ9-Fa-cyr">
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="numberPad" returnKeyType="done"/>
|
||||
</textField>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="Last Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7dD-VT-wdQ">
|
||||
<rect key="frame" x="15" y="11" width="82" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.1137254902" green="0.47843137250000001" blue="0.98039215690000003" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="iqx-ux-kA0" secondAttribute="trailing" constant="15" id="UVH-DD-pHC"/>
|
||||
<constraint firstItem="7dD-VT-wdQ" firstAttribute="centerY" secondItem="awh-JA-Hz6" secondAttribute="centerY" id="Vwn-I3-e7h"/>
|
||||
<constraint firstItem="iqx-ux-kA0" firstAttribute="centerY" secondItem="awh-JA-Hz6" secondAttribute="centerY" id="VzL-HK-apN"/>
|
||||
<constraint firstItem="iqx-ux-kA0" firstAttribute="leading" secondItem="7dD-VT-wdQ" secondAttribute="trailing" constant="8" symbolic="YES" id="fDY-Ju-iSw"/>
|
||||
<constraint firstItem="7dD-VT-wdQ" firstAttribute="leading" secondItem="awh-JA-Hz6" secondAttribute="leading" constant="15" id="j64-an-fjP"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="rZ9-Fa-cyr" secondAttribute="trailing" id="Gso-FU-Ct1"/>
|
||||
<constraint firstItem="rZ9-Fa-cyr" firstAttribute="centerY" secondItem="ccO-0O-u72" secondAttribute="centerY" id="UqA-ea-emb"/>
|
||||
<constraint firstItem="rZ9-Fa-cyr" firstAttribute="leading" secondItem="ccO-0O-u72" secondAttribute="leadingMargin" constant="10" id="WrY-St-72v"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
@@ -133,129 +116,195 @@
|
||||
</tableViewSection>
|
||||
</sections>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="yMU-Wr-YuI" id="fDY-MJ-pJo"/>
|
||||
<outlet property="delegate" destination="yMU-Wr-YuI" id="Un1-A3-CJp"/>
|
||||
<outlet property="dataSource" destination="iNr-Oe-muq" id="67O-XE-MeV"/>
|
||||
<outlet property="delegate" destination="iNr-Oe-muq" id="vLD-QQ-zR2"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<toolbarItems/>
|
||||
<navigationItem key="navigationItem" id="Rwz-Rp-lmd">
|
||||
<barButtonItem key="rightBarButtonItem" style="done" systemItem="done" id="NJu-k4-mIi">
|
||||
<navigationItem key="navigationItem" id="U4g-xG-W8b">
|
||||
<barButtonItem key="leftBarButtonItem" systemItem="cancel" id="VIN-Hi-Twt">
|
||||
<connections>
|
||||
<segue destination="FMm-Lo-i3b" kind="unwind" identifier="commit" unwindAction="commitPersonEdition:" id="dkC-cp-6iC"/>
|
||||
<segue destination="lTz-K0-aRY" kind="unwind" unwindAction="cancelPersonEdition:" id="fOs-ol-qJL"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
<barButtonItem key="rightBarButtonItem" systemItem="done" id="2um-u5-BhV">
|
||||
<connections>
|
||||
<segue destination="lTz-K0-aRY" kind="unwind" identifier="" unwindAction="commitPersonEdition:" id="Y1E-dI-wcl"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||
<connections>
|
||||
<outlet property="firstNameTableViewCell" destination="M9a-av-50p" id="vXh-ik-bqv"/>
|
||||
<outlet property="firstNameTextField" destination="BDD-vR-uvL" id="BYU-BL-kha"/>
|
||||
<outlet property="lastNameTableViewCell" destination="TEu-C2-7tX" id="wDv-if-Gkl"/>
|
||||
<outlet property="lastNameTextField" destination="iqx-ux-kA0" id="wOu-gU-WlV"/>
|
||||
<outlet property="cancelBarButtonItem" destination="VIN-Hi-Twt" id="dET-mF-ZXe"/>
|
||||
<outlet property="commitBarButtonItem" destination="2um-u5-BhV" id="Jym-us-zdP"/>
|
||||
<outlet property="nameCell" destination="2gb-gB-918" id="ch2-MB-uRm"/>
|
||||
<outlet property="nameTextField" destination="m5m-Zs-j0z" id="A6a-pw-q8s"/>
|
||||
<outlet property="scoreCell" destination="vp3-Ft-Gth" id="b8A-42-8Dw"/>
|
||||
<outlet property="scoreTextField" destination="rZ9-Fa-cyr" id="4kw-gV-uih"/>
|
||||
</connections>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="23u-wY-35e" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<exit id="FMm-Lo-i3b" userLabel="Exit" sceneMemberID="exit"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="fNC-Ls-uRw" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<exit id="lTz-K0-aRY" userLabel="Exit" sceneMemberID="exit"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="2301" y="-630"/>
|
||||
<point key="canvasLocation" x="1450" y="1435"/>
|
||||
</scene>
|
||||
<!--GRDB Demo-->
|
||||
<scene sceneID="XjB-aQ-v94">
|
||||
<objects>
|
||||
<tableViewController id="9kw-c5-KTk" customClass="DemoViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="f4Y-o2-7VW">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<sections>
|
||||
<tableViewSection id="dCg-qU-h2X">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="clL-nG-zPX" style="IBUITableViewCellStyleDefault" id="kJB-sX-YAb">
|
||||
<rect key="frame" x="0.0" y="64" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="kJB-sX-YAb" id="f5l-ob-3DG">
|
||||
<frame key="frameInset" width="342" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Simple TableView" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="clL-nG-zPX">
|
||||
<frame key="frameInset" minX="15" width="325" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="cyv-nk-Plb" kind="show" id="Bgq-9t-jRc"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="I78-c5-0kp" style="IBUITableViewCellStyleDefault" id="q4C-mT-5mi">
|
||||
<rect key="frame" x="0.0" y="108" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="q4C-mT-5mi" id="2Cu-K1-hiz">
|
||||
<frame key="frameInset" width="342" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="FetchedRecordsController" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="I78-c5-0kp">
|
||||
<frame key="frameInset" minX="15" width="325" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="PJp-Eq-ZjA" kind="show" id="1fk-ZR-6XN"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
</sections>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="9kw-c5-KTk" id="IK7-Os-Odc"/>
|
||||
<outlet property="delegate" destination="9kw-c5-KTk" id="U7E-yB-s8d"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="GRDB Demo" id="z0z-02-Ucy"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="OhY-4B-BcJ" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-190" y="1435"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="GQC-vK-8JG">
|
||||
<scene sceneID="2KX-IU-Z5Q">
|
||||
<objects>
|
||||
<navigationController id="IJV-AU-xKl" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="y7A-ea-ZFU">
|
||||
<navigationController id="ein-Sr-i8w" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="zIT-dB-Mfo">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="yMU-Wr-YuI" kind="relationship" relationship="rootViewController" id="1PW-hN-E5f"/>
|
||||
<segue destination="iNr-Oe-muq" kind="relationship" relationship="rootViewController" id="e5b-3U-9Vz"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="4jR-xV-SBm" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="kNr-vk-I5l" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1481" y="-630"/>
|
||||
</scene>
|
||||
<!--Split View Controller-->
|
||||
<scene sceneID="Nki-YV-4Qg">
|
||||
<objects>
|
||||
<splitViewController id="H1p-Uh-vWS" sceneMemberID="viewController">
|
||||
<toolbarItems/>
|
||||
<connections>
|
||||
<segue destination="RMx-3f-FxP" kind="relationship" relationship="masterViewController" id="BlO-5A-QYV"/>
|
||||
<segue destination="vC3-pB-5Vb" kind="relationship" relationship="detailViewController" id="Tll-UG-LXB"/>
|
||||
</connections>
|
||||
</splitViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="cZU-Oi-B1e" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-856" y="-330"/>
|
||||
</scene>
|
||||
<!--Master-->
|
||||
<scene sceneID="smW-Zh-WAh">
|
||||
<objects>
|
||||
<tableViewController title="Master" clearsSelectionOnViewWillAppear="NO" id="7bK-jq-Zjz" customClass="MasterViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="r7i-6Z-zg0">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<prototypes>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="Arm-wq-HPj" style="IBUITableViewCellStyleDefault" id="WCw-Qf-5nD">
|
||||
<rect key="frame" x="0.0" y="86" width="600" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WCw-Qf-5nD" id="37f-cq-3Eg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Arm-wq-HPj">
|
||||
<rect key="frame" x="15" y="0.0" width="570" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<connections>
|
||||
<segue destination="vC3-pB-5Vb" kind="showDetail" identifier="showPerson" id="vhz-QC-pld"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<sections/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="7bK-jq-Zjz" id="Gho-Na-rnu"/>
|
||||
<outlet property="delegate" destination="7bK-jq-Zjz" id="RA6-mI-bju"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Master" id="Zdf-7t-Un8">
|
||||
<barButtonItem key="rightBarButtonItem" systemItem="add" id="q2y-Jp-QNL">
|
||||
<connections>
|
||||
<segue destination="IJV-AU-xKl" kind="popoverPresentation" identifier="editNewPerson" popoverAnchorBarButtonItem="q2y-Jp-QNL" id="KcV-Yc-DEu">
|
||||
<popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/>
|
||||
</segue>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Rux-fX-hf1" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="709" y="-630"/>
|
||||
<point key="canvasLocation" x="630" y="1435"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="r7l-gg-dq7">
|
||||
<scene sceneID="N1X-4j-Re4">
|
||||
<objects>
|
||||
<navigationController id="vC3-pB-5Vb" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="DjV-YW-jjY">
|
||||
<navigationController id="UAh-8N-CM8" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="U7d-1C-GnL">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="JEX-9P-axG" kind="relationship" relationship="rootViewController" id="GKi-kA-LjT"/>
|
||||
<segue destination="9kw-c5-KTk" kind="relationship" relationship="rootViewController" id="qDW-qI-Hyg"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="SLD-UC-DBI" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="sVt-e9-ghQ" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-45" y="129"/>
|
||||
<point key="canvasLocation" x="-1006" y="1435"/>
|
||||
</scene>
|
||||
<!--Hall Of Fame-->
|
||||
<scene sceneID="9su-ms-vdJ">
|
||||
<objects>
|
||||
<tableViewController id="PJp-Eq-ZjA" customClass="PersonsViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="tX0-ON-WSI">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Person" textLabel="G8y-VE-YRu" detailTextLabel="NNc-J4-xiE" style="IBUITableViewCellStyleValue1" id="bFj-Hd-fwd">
|
||||
<frame key="frameInset" minY="92" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="bFj-Hd-fwd" id="kDf-TZ-xhb">
|
||||
<frame key="frameInset" width="342" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="G8y-VE-YRu">
|
||||
<frame key="frameInset" minX="15" minY="12" width="31.5" height="19.5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="NNc-J4-xiE">
|
||||
<frame key="frameInset" minX="298.5" minY="12" width="41.5" height="19.5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<color key="textColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="iNr-Oe-muq" kind="show" identifier="EditPerson" id="Lgu-Yd-HSy"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="PJp-Eq-ZjA" id="MkQ-WQ-sTh"/>
|
||||
<outlet property="delegate" destination="PJp-Eq-ZjA" id="quj-Sp-DuL"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<toolbarItems>
|
||||
<barButtonItem title="Item" id="hMF-Rv-dAe"/>
|
||||
</toolbarItems>
|
||||
<navigationItem key="navigationItem" title="Hall Of Fame" id="QIv-M6-kT1">
|
||||
<barButtonItem key="rightBarButtonItem" systemItem="add" id="2bK-Fl-55Q"/>
|
||||
</navigationItem>
|
||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||
<connections>
|
||||
<segue destination="ein-Sr-i8w" kind="presentation" identifier="NewPerson" id="7PC-xN-zD4"/>
|
||||
</connections>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="af5-Qo-AkD" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="630" y="2254"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="vhz-QC-pld"/>
|
||||
<segue reference="7PC-xN-zD4"/>
|
||||
<segue reference="czF-1h-sYn"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
</document>
|
||||
@@ -0,0 +1,56 @@
|
||||
import GRDB
|
||||
import UIKit
|
||||
|
||||
// The shared database queue
|
||||
var dbQueue: DatabaseQueue!
|
||||
|
||||
func setupDatabase(_ application: UIApplication) throws {
|
||||
|
||||
// Connect to the database
|
||||
// See https://github.com/groue/GRDB.swift/#database-connections
|
||||
|
||||
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first! as NSString
|
||||
let databasePath = documentsPath.appendingPathComponent("db.sqlite")
|
||||
dbQueue = try DatabaseQueue(path: databasePath)
|
||||
|
||||
|
||||
// Be a nice iOS citizen, and don't consume too much memory
|
||||
// See https://github.com/groue/GRDB.swift/#memory-management
|
||||
|
||||
dbQueue.setupMemoryManagement(in: application)
|
||||
|
||||
|
||||
// Use DatabaseMigrator to setup the database
|
||||
// See https://github.com/groue/GRDB.swift/#migrations
|
||||
|
||||
var migrator = DatabaseMigrator()
|
||||
|
||||
migrator.registerMigration("createPersons") { db in
|
||||
|
||||
// Create a table
|
||||
// See https://github.com/groue/GRDB.swift#create-tables
|
||||
|
||||
try db.create(table: "persons") { t in
|
||||
// An integer primary key auto-generates unique IDs
|
||||
t.column("id", .integer).primaryKey()
|
||||
|
||||
// Sort person names in a localized case insensitive fashion by default
|
||||
// See https://github.com/groue/GRDB.swift/#unicode
|
||||
t.column("name", .text).notNull().collate(.localizedCaseInsensitiveCompare)
|
||||
|
||||
t.column("score", .integer).notNull()
|
||||
}
|
||||
|
||||
// Populate the persons table with random data
|
||||
for _ in 0..<8 {
|
||||
try Person(name: Person.randomName(), score: Person.randomScore()).insert(db)
|
||||
}
|
||||
}
|
||||
|
||||
// // Migrations for future application versions will be inserted here:
|
||||
// migrator.registerMigration(...) { db in
|
||||
// ...
|
||||
// }
|
||||
|
||||
try migrator.migrate(dbQueue)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import UIKit
|
||||
|
||||
class DemoViewController: UITableViewController {
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(true)
|
||||
navigationController?.isToolbarHidden = true
|
||||
navigationItem.backBarButtonItem = UIBarButtonItem(title: "Demo", style: .plain, target: nil, action: nil)
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import UIKit
|
||||
|
||||
class DetailViewController: UIViewController {
|
||||
@IBOutlet weak var detailDescriptionLabel: UILabel!
|
||||
|
||||
var person: Person! {
|
||||
didSet {
|
||||
self.configureView()
|
||||
}
|
||||
}
|
||||
|
||||
func configureView() {
|
||||
guard isViewLoaded() else {
|
||||
return
|
||||
}
|
||||
detailDescriptionLabel.text = person.fullName
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
configureView()
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -4,6 +4,8 @@
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>GRDB Demo</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@@ -16,8 +18,6 @@
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
@@ -30,28 +30,9 @@
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UIStatusBarTintParameters</key>
|
||||
<dict>
|
||||
<key>UINavigationBar</key>
|
||||
<dict>
|
||||
<key>Style</key>
|
||||
<string>UIBarStyleDefault</string>
|
||||
<key>Translucent</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,96 +0,0 @@
|
||||
import UIKit
|
||||
|
||||
class MasterViewController: UITableViewController {
|
||||
var detailViewController: DetailViewController? = nil
|
||||
var persons = [Person]()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.navigationItem.leftBarButtonItem = self.editButtonItem()
|
||||
if let split = self.splitViewController {
|
||||
let controllers = split.viewControllers
|
||||
self.detailViewController = (controllers[controllers.count-1] as! UINavigationController).topViewController as? DetailViewController
|
||||
}
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
// Reload persons, and the tableView
|
||||
reloadPersons()
|
||||
tableView.reloadData()
|
||||
|
||||
self.clearsSelectionOnViewWillAppear = self.splitViewController!.collapsed
|
||||
super.viewWillAppear(animated)
|
||||
}
|
||||
|
||||
func reloadPersons() {
|
||||
persons = dbQueue.inDatabase { db in
|
||||
Person.fetchAll(db, "SELECT * FROM persons ORDER BY LOWER(firstName), LOWER(lastName)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Segues
|
||||
|
||||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
|
||||
if segue.identifier == "showPerson" {
|
||||
let detailViewController = (segue.destinationViewController as! UINavigationController).topViewController as! DetailViewController
|
||||
detailViewController.person = persons[self.tableView.indexPathForSelectedRow!.row]
|
||||
detailViewController.navigationItem.leftBarButtonItem = self.splitViewController?.displayModeButtonItem()
|
||||
detailViewController.navigationItem.leftItemsSupplementBackButton = true
|
||||
}
|
||||
else if segue.identifier == "editNewPerson" {
|
||||
let personEditionViewController = (segue.destinationViewController as! UINavigationController).topViewController as! PersonEditionViewController
|
||||
personEditionViewController.person = Person()
|
||||
}
|
||||
}
|
||||
|
||||
// Unwind action: commit person edition
|
||||
@IBAction func commitPersonEdition(segue: UIStoryboardSegue) {
|
||||
let personEditionViewController = segue.sourceViewController as! PersonEditionViewController
|
||||
let person = personEditionViewController.person
|
||||
|
||||
// Ignore person with no name
|
||||
guard (person.firstName ?? "").characters.count > 0 || (person.lastName ?? "").characters.count > 0 else {
|
||||
return
|
||||
}
|
||||
|
||||
// Save person
|
||||
try! dbQueue.inDatabase { db in
|
||||
try person.save(db)
|
||||
}
|
||||
|
||||
// Reload persons, and insert a cell.
|
||||
reloadPersons()
|
||||
let index = persons.indexOf { $0.id == person.id }!
|
||||
tableView.insertRowsAtIndexPaths([NSIndexPath(forRow: index, inSection: 0)], withRowAnimation: .Automatic)
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Table View
|
||||
|
||||
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return persons.count
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
|
||||
|
||||
let person = persons[indexPath.row]
|
||||
cell.textLabel!.text = person.fullName
|
||||
return cell
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
|
||||
// Delete the person
|
||||
let person = persons[indexPath.row]
|
||||
try! dbQueue.inTransaction { db in
|
||||
try person.delete(db)
|
||||
return .Commit
|
||||
}
|
||||
persons.removeAtIndex(indexPath.row)
|
||||
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,40 +1,49 @@
|
||||
import GRDB
|
||||
|
||||
class Person : Record {
|
||||
var id: Int64!
|
||||
var firstName: String?
|
||||
var lastName: String?
|
||||
var fullName: String {
|
||||
return [firstName, lastName].flatMap { $0 }.joinWithSeparator(" ")
|
||||
}
|
||||
class Person: Record {
|
||||
var id: Int64?
|
||||
var name: String
|
||||
var score: Int
|
||||
|
||||
init(firstName: String? = nil, lastName: String? = nil) {
|
||||
self.firstName = firstName
|
||||
self.lastName = lastName
|
||||
init(name: String, score: Int) {
|
||||
self.name = name
|
||||
self.score = score
|
||||
super.init()
|
||||
}
|
||||
|
||||
// MARK: - Record
|
||||
// MARK: Record overrides
|
||||
|
||||
override class func databaseTableName() -> String? {
|
||||
override class var databaseTableName: String {
|
||||
return "persons"
|
||||
}
|
||||
|
||||
override func updateFromRow(row: Row) {
|
||||
if let dbv = row["id"] { id = dbv.value() }
|
||||
if let dbv = row["firstName"] { firstName = dbv.value() }
|
||||
if let dbv = row["lastName"] { lastName = dbv.value() }
|
||||
super.updateFromRow(row) // Subclasses are required to call super.
|
||||
}
|
||||
|
||||
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
|
||||
return [
|
||||
"id": id,
|
||||
"firstName": firstName,
|
||||
"lastName": lastName]
|
||||
}
|
||||
|
||||
required init(row: Row) {
|
||||
id = row["id"]
|
||||
name = row["name"]
|
||||
score = row["score"]
|
||||
super.init(row: row)
|
||||
}
|
||||
|
||||
override func encode(to container: inout PersistenceContainer) {
|
||||
container["id"] = id
|
||||
container["name"] = name
|
||||
container["score"] = score
|
||||
}
|
||||
|
||||
override func didInsert(with rowID: Int64, for column: String?) {
|
||||
id = rowID
|
||||
}
|
||||
|
||||
// MARK: Random
|
||||
|
||||
private static let names = ["Arthur", "Anita", "Barbara", "Bernard", "Craig", "Chiara", "David", "Dean", "Éric", "Elena", "Fatima", "Frederik", "Gilbert", "Georgette", "Henriette", "Hassan", "Ignacio", "Irene", "Julie", "Jack", "Karl", "Kristel", "Louis", "Liz", "Masashi", "Mary", "Noam", "Nicole", "Ophelie", "Oleg", "Pascal", "Patricia", "Quentin", "Quinn", "Raoul", "Rachel", "Stephan", "Susie", "Tristan", "Tatiana", "Ursule", "Urbain", "Victor", "Violette", "Wilfried", "Wilhelmina", "Yvon", "Yann", "Zazie", "Zoé"]
|
||||
|
||||
class func randomName() -> String {
|
||||
return names[Int(arc4random_uniform(UInt32(names.count)))]
|
||||
}
|
||||
|
||||
class func randomScore() -> Int {
|
||||
return 10 * Int(arc4random_uniform(101))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,61 +1,104 @@
|
||||
import UIKit
|
||||
|
||||
class PersonEditionViewController: UITableViewController, UITextFieldDelegate {
|
||||
@IBOutlet weak var firstNameTableViewCell: UITableViewCell!
|
||||
@IBOutlet weak var firstNameTextField: UITextField!
|
||||
@IBOutlet weak var lastNameTableViewCell: UITableViewCell!
|
||||
@IBOutlet weak var lastNameTextField: UITextField!
|
||||
protocol PersonEditionViewControllerDelegate: class {
|
||||
func personEditionControllerDidComplete(_ controller: PersonEditionViewController)
|
||||
}
|
||||
|
||||
class PersonEditionViewController: UITableViewController {
|
||||
weak var delegate: PersonEditionViewControllerDelegate?
|
||||
var person: Person! { didSet { configureView() } }
|
||||
var cancelButtonHidden: Bool = false { didSet { configureView() } }
|
||||
var commitButtonHidden: Bool = false { didSet { configureView() } }
|
||||
|
||||
@IBOutlet fileprivate weak var cancelBarButtonItem: UIBarButtonItem!
|
||||
@IBOutlet fileprivate weak var commitBarButtonItem: UIBarButtonItem!
|
||||
@IBOutlet fileprivate weak var nameCell: UITableViewCell!
|
||||
@IBOutlet fileprivate weak var nameTextField: UITextField!
|
||||
@IBOutlet fileprivate weak var scoreCell: UITableViewCell!
|
||||
@IBOutlet fileprivate weak var scoreTextField: UITextField!
|
||||
|
||||
// The edited person
|
||||
var person: Person!
|
||||
func applyChanges() {
|
||||
if let name = nameTextField.text, !name.isEmpty {
|
||||
person.name = name
|
||||
}
|
||||
person.score = scoreTextField.text.flatMap { Int($0) } ?? 0
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Initializes textFields with the person's names
|
||||
firstNameTextField.text = person.firstName
|
||||
lastNameTextField.text = person.lastName
|
||||
configureView()
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
private func configureView() {
|
||||
guard isViewLoaded else { return }
|
||||
|
||||
// Auto focus firstName
|
||||
firstNameTextField.becomeFirstResponder()
|
||||
nameTextField.text = person.name
|
||||
if person.score == 0 && person.id == nil {
|
||||
scoreTextField.text = ""
|
||||
} else {
|
||||
scoreTextField.text = "\(person.score)"
|
||||
}
|
||||
|
||||
if cancelButtonHidden {
|
||||
navigationItem.leftBarButtonItem = nil
|
||||
} else {
|
||||
navigationItem.leftBarButtonItem = cancelBarButtonItem
|
||||
}
|
||||
|
||||
if cancelButtonHidden {
|
||||
navigationItem.rightBarButtonItem = nil
|
||||
} else {
|
||||
navigationItem.rightBarButtonItem = commitBarButtonItem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Navigation
|
||||
|
||||
extension PersonEditionViewController {
|
||||
|
||||
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
|
||||
// Force keyboard to dismiss early
|
||||
view.endEditing(true)
|
||||
return true
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
|
||||
// Tapping a cell selects its text fields.
|
||||
if indexPath == tableView.indexPathForCell(firstNameTableViewCell) {
|
||||
firstNameTextField.becomeFirstResponder()
|
||||
} else if indexPath == tableView.indexPathForCell(lastNameTableViewCell) {
|
||||
lastNameTextField.becomeFirstResponder()
|
||||
override func willMove(toParentViewController parent: UIViewController?) {
|
||||
super.willMove(toParentViewController: parent)
|
||||
|
||||
if parent == nil {
|
||||
// Self is popping from its navigation controller
|
||||
delegate?.personEditionControllerDidComplete(self)
|
||||
}
|
||||
}
|
||||
|
||||
func textFieldShouldReturn(textField: UITextField) -> Bool {
|
||||
// Tapping Return key focuses next text field.
|
||||
if textField == firstNameTextField {
|
||||
lastNameTextField.becomeFirstResponder()
|
||||
} else {
|
||||
textField.resignFirstResponder()
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Form
|
||||
|
||||
extension PersonEditionViewController: UITextFieldDelegate {
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
nameTextField.becomeFirstResponder()
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
tableView.deselectRow(at: indexPath, animated: false)
|
||||
let cell = tableView.cellForRow(at: indexPath)
|
||||
if cell === nameCell {
|
||||
nameTextField.becomeFirstResponder()
|
||||
} else if cell === scoreCell {
|
||||
scoreTextField.becomeFirstResponder()
|
||||
}
|
||||
}
|
||||
|
||||
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
||||
if textField == nameTextField {
|
||||
scoreTextField.becomeFirstResponder()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func textFieldDidEndEditing(textField: UITextField) {
|
||||
// Update person when text field ends editing.
|
||||
if textField == firstNameTextField {
|
||||
person.firstName = textField.text
|
||||
} else if textField == lastNameTextField {
|
||||
person.lastName = textField.text
|
||||
}
|
||||
}
|
||||
|
||||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
|
||||
// About to cancel or commit: end editing.
|
||||
// This dismisses the keyboard early, and apply pending changes through
|
||||
// textFieldDidEndEditing(_).
|
||||
view.endEditing(true)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
import UIKit
|
||||
import GRDB
|
||||
|
||||
class PersonsViewController: UITableViewController {
|
||||
var personsController: FetchedRecordsController<Person>!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
navigationItem.rightBarButtonItems = [
|
||||
UIBarButtonItem(barButtonSystemItem: .add, target: self, action: .addPerson),
|
||||
editButtonItem
|
||||
]
|
||||
|
||||
personsController = try! FetchedRecordsController(dbQueue, request: personsSortedByScore)
|
||||
personsController.trackChanges(
|
||||
willChange: { [unowned self] _ in
|
||||
self.tableView.beginUpdates()
|
||||
},
|
||||
onChange: { [unowned self] (controller, record, change) in
|
||||
switch change {
|
||||
case .insertion(let indexPath):
|
||||
self.tableView.insertRows(at: [indexPath], with: .fade)
|
||||
|
||||
case .deletion(let indexPath):
|
||||
self.tableView.deleteRows(at: [indexPath], with: .fade)
|
||||
|
||||
case .update(let indexPath, _):
|
||||
if let cell = self.tableView.cellForRow(at: indexPath) {
|
||||
self.configure(cell, at: indexPath)
|
||||
}
|
||||
|
||||
case .move(let indexPath, let newIndexPath, _):
|
||||
// Actually move cells around for more demo effect :-)
|
||||
let cell = self.tableView.cellForRow(at: indexPath)
|
||||
self.tableView.moveRow(at: indexPath, to: newIndexPath)
|
||||
if let cell = cell {
|
||||
self.configure(cell, at: newIndexPath)
|
||||
}
|
||||
|
||||
// A quieter animation:
|
||||
// self.tableView.deleteRows(at: [indexPath], with: .fade)
|
||||
// self.tableView.insertRows(at: [newIndexPath], with: .fade)
|
||||
}
|
||||
},
|
||||
didChange: { [unowned self] _ in
|
||||
self.tableView.endUpdates()
|
||||
})
|
||||
try! personsController.performFetch()
|
||||
|
||||
configureToolbar()
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
navigationController?.isToolbarHidden = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Navigation
|
||||
|
||||
extension PersonsViewController : PersonEditionViewControllerDelegate {
|
||||
|
||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||
if segue.identifier == "EditPerson" {
|
||||
let person = personsController.record(at: tableView.indexPathForSelectedRow!)
|
||||
let controller = segue.destination as! PersonEditionViewController
|
||||
controller.title = person.name
|
||||
controller.person = person
|
||||
controller.delegate = self // we will save person when back button is tapped
|
||||
controller.cancelButtonHidden = true
|
||||
controller.commitButtonHidden = true
|
||||
}
|
||||
else if segue.identifier == "NewPerson" {
|
||||
setEditing(false, animated: true)
|
||||
let navigationController = segue.destination as! UINavigationController
|
||||
let controller = navigationController.viewControllers.first as! PersonEditionViewController
|
||||
controller.title = "New Person"
|
||||
controller.person = Person(name: "", score: 0)
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func addPerson(_ sender: AnyObject?) {
|
||||
performSegue(withIdentifier: "NewPerson", sender: sender)
|
||||
}
|
||||
|
||||
@IBAction func cancelPersonEdition(_ segue: UIStoryboardSegue) {
|
||||
// Person creation: cancel button was tapped
|
||||
}
|
||||
|
||||
@IBAction func commitPersonEdition(_ segue: UIStoryboardSegue) {
|
||||
// Person creation: commit button was tapped
|
||||
let controller = segue.source as! PersonEditionViewController
|
||||
controller.applyChanges()
|
||||
let person = controller.person!
|
||||
if !person.name.isEmpty {
|
||||
try! dbQueue.inDatabase { db in
|
||||
try person.save(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func personEditionControllerDidComplete(_ controller: PersonEditionViewController) {
|
||||
// Person edition: back button was tapped
|
||||
controller.applyChanges()
|
||||
let person = controller.person!
|
||||
if !person.name.isEmpty {
|
||||
try! dbQueue.inDatabase { db in
|
||||
try person.save(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - UITableViewDataSource
|
||||
|
||||
extension PersonsViewController {
|
||||
func configure(_ cell: UITableViewCell, at indexPath: IndexPath) {
|
||||
let person = personsController.record(at: indexPath)
|
||||
cell.textLabel?.text = person.name
|
||||
cell.detailTextLabel?.text = abs(person.score) > 1 ? "\(person.score) points" : "0 point"
|
||||
}
|
||||
|
||||
override func numberOfSections(in tableView: UITableView) -> Int {
|
||||
return personsController.sections.count
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return personsController.sections[section].numberOfRecords
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "Person", for: indexPath)
|
||||
configure(cell, at: indexPath)
|
||||
return cell
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
|
||||
// Delete the person
|
||||
let person = personsController.record(at: indexPath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
_ = try person.delete(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - FetchedRecordsController Demo
|
||||
|
||||
extension PersonsViewController {
|
||||
|
||||
fileprivate func configureToolbar() {
|
||||
toolbarItems = [
|
||||
UIBarButtonItem(title: "Name ⬆︎", style: .plain, target: self, action: .sortByName),
|
||||
UIBarButtonItem(title: "Score ⬇︎", style: .plain, target: self, action: .sortByScore),
|
||||
UIBarButtonItem(title: "Randomize", style: .plain, target: self, action: .randomizeScores),
|
||||
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil),
|
||||
UIBarButtonItem(title: "💣", style: .plain, target: self, action: .stressTest)
|
||||
]
|
||||
}
|
||||
|
||||
@IBAction func sortByName() {
|
||||
setEditing(false, animated: true)
|
||||
try! personsController.setRequest(personsSortedByName)
|
||||
}
|
||||
|
||||
@IBAction func sortByScore() {
|
||||
setEditing(false, animated: true)
|
||||
try! personsController.setRequest(personsSortedByScore)
|
||||
}
|
||||
|
||||
@IBAction func randomizeScores() {
|
||||
setEditing(false, animated: true)
|
||||
|
||||
try! dbQueue.inTransaction { db in
|
||||
for person in try Person.fetchAll(db) {
|
||||
person.score = Person.randomScore()
|
||||
try person.update(db)
|
||||
}
|
||||
return .commit
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func stressTest() {
|
||||
setEditing(false, animated: true)
|
||||
|
||||
for _ in 0..<50 {
|
||||
DispatchQueue.global().async {
|
||||
try! dbQueue.inTransaction { db in
|
||||
if try Person.fetchCount(db) == 0 {
|
||||
// Insert persons
|
||||
for _ in 0..<8 {
|
||||
try Person(name: Person.randomName(), score: Person.randomScore()).insert(db)
|
||||
}
|
||||
} else {
|
||||
// Insert a person
|
||||
if arc4random_uniform(2) == 0 {
|
||||
let person = Person(name: Person.randomName(), score: Person.randomScore())
|
||||
try person.insert(db)
|
||||
}
|
||||
// Delete a person
|
||||
if arc4random_uniform(2) == 0 {
|
||||
if let person = try Person.order(sql: "RANDOM()").fetchOne(db) {
|
||||
try person.delete(db)
|
||||
}
|
||||
}
|
||||
// Update some persons
|
||||
for person in try Person.fetchAll(db) {
|
||||
if arc4random_uniform(2) == 0 {
|
||||
person.score = Person.randomScore()
|
||||
try person.update(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
return .commit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://medium.com/swift-programming/swift-selector-syntax-sugar-81c8a8b10df3
|
||||
private extension Selector {
|
||||
static let addPerson = #selector(PersonsViewController.addPerson(_:))
|
||||
static let sortByName = #selector(PersonsViewController.sortByName)
|
||||
static let sortByScore = #selector(PersonsViewController.sortByScore)
|
||||
static let randomizeScores = #selector(PersonsViewController.randomizeScores)
|
||||
static let stressTest = #selector(PersonsViewController.stressTest)
|
||||
}
|
||||
|
||||
private let personsSortedByName = Person.order(Column("name"))
|
||||
private let personsSortedByScore = Person.order(Column("score").desc, Column("name"))
|
||||
@@ -0,0 +1,114 @@
|
||||
import UIKit
|
||||
import GRDB
|
||||
|
||||
class SimplePersonsViewController: UITableViewController {
|
||||
var persons: [Person]!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
navigationItem.rightBarButtonItems = [
|
||||
UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(SimplePersonsViewController.addPerson(_:))),
|
||||
editButtonItem
|
||||
]
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
loadPersons()
|
||||
tableView.reloadData()
|
||||
}
|
||||
|
||||
private func loadPersons() {
|
||||
persons = try! dbQueue.inDatabase { db in
|
||||
try Person.order(Column("score").desc, Column("name")).fetchAll(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Navigation
|
||||
|
||||
extension SimplePersonsViewController : PersonEditionViewControllerDelegate {
|
||||
|
||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||
if segue.identifier == "EditPerson" {
|
||||
let person = persons[tableView.indexPathForSelectedRow!.row]
|
||||
let controller = segue.destination as! PersonEditionViewController
|
||||
controller.title = person.name
|
||||
controller.person = person
|
||||
controller.delegate = self // we will save person when back button is tapped
|
||||
controller.cancelButtonHidden = true
|
||||
controller.commitButtonHidden = true
|
||||
}
|
||||
else if segue.identifier == "NewPerson" {
|
||||
setEditing(false, animated: true)
|
||||
let navigationController = segue.destination as! UINavigationController
|
||||
let controller = navigationController.viewControllers.first as! PersonEditionViewController
|
||||
controller.title = "New Person"
|
||||
controller.person = Person(name: "", score: 0)
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func addPerson(_ sender: AnyObject?) {
|
||||
performSegue(withIdentifier: "NewPerson", sender: sender)
|
||||
}
|
||||
|
||||
@IBAction func cancelPersonEdition(_ segue: UIStoryboardSegue) {
|
||||
// Person creation: cancel button was tapped
|
||||
}
|
||||
|
||||
@IBAction func commitPersonEdition(_ segue: UIStoryboardSegue) {
|
||||
// Person creation: commit button was tapped
|
||||
let controller = segue.source as! PersonEditionViewController
|
||||
controller.applyChanges()
|
||||
let person = controller.person!
|
||||
if !person.name.isEmpty {
|
||||
try! dbQueue.inDatabase { db in
|
||||
try person.save(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func personEditionControllerDidComplete(_ controller: PersonEditionViewController) {
|
||||
// Person edition: back button was tapped
|
||||
controller.applyChanges()
|
||||
let person = controller.person!
|
||||
if !person.name.isEmpty {
|
||||
try! dbQueue.inDatabase { db in
|
||||
try person.save(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - UITableViewDataSource
|
||||
|
||||
extension SimplePersonsViewController {
|
||||
func configure(_ cell: UITableViewCell, at indexPath: IndexPath) {
|
||||
let person = persons[indexPath.row]
|
||||
cell.textLabel?.text = person.name
|
||||
cell.detailTextLabel?.text = abs(person.score) > 1 ? "\(person.score) points" : "0 point"
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return persons.count
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "Person", for: indexPath)
|
||||
configure(cell, at: indexPath)
|
||||
return cell
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
|
||||
// Delete the person
|
||||
let person = persons[indexPath.row]
|
||||
try! dbQueue.inDatabase { db in
|
||||
_ = try person.delete(db)
|
||||
}
|
||||
persons.remove(at: indexPath.row)
|
||||
tableView.deleteRows(at: [indexPath], with: .fade)
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
GRDBDemoiOS
|
||||
===========
|
||||
|
||||
This application runs an universal (iPhone + iPad) application that displays an editable list of persons.
|
||||
|
||||
**To manually integrate GRDB as a Framework in your iOS application:**
|
||||
|
||||
1. Drag the [GRDB project](../../GRDB.xcodeproj) in your own project.
|
||||
|
||||
2. In the **Build Phase** tab of your target, add `GRDBiOS` in the **Target Dependencies** section.
|
||||
|
||||
3. In the **Embedded Binaries** section of the **General** tab of your target, add GRDB.xcodeproj/Products/GRDB.framework (iOS).
|
||||
|
||||
4. Run.
|
||||
|
||||
|
||||
**To see usage of GRDB, check the following files:**
|
||||
|
||||
- [AppDelegate.swift](GRDBDemoiOS/AppDelegate.swift)
|
||||
|
||||
AppDelegate sets up a global dbQueue that is accessible in the whole application.
|
||||
|
||||
It uses migrations to initialize the database.
|
||||
|
||||
- [MasterViewController.swift](GRDBDemoiOS/MasterViewController.swift)
|
||||
|
||||
MasterViewController is responsible for displaying the list of persons in a table view, deleting persons, and present a person edition form.
|
||||
|
||||
- [Person.swift](GRDBDemoiOS/Person.swift)
|
||||
|
||||
Person is a simple Record subclass.
|
||||
|
||||
- [DetailViewController.swift](GRDBDemoiOS/DetailViewController.swift) and [PersonEditionViewController.swift](GRDBDemoiOS/PersonEditionViewController.swift)
|
||||
|
||||
Those two view controllers display and edit a Person, in total isolation from the database.
|
||||
@@ -1,526 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
562FF9951BCE8FA400759400 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9941BCE8FA400759400 /* AppDelegate.swift */; };
|
||||
562FF9971BCE8FA400759400 /* PersonsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9961BCE8FA400759400 /* PersonsViewController.swift */; };
|
||||
562FF99A1BCE8FA400759400 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 562FF9981BCE8FA400759400 /* Main.storyboard */; };
|
||||
562FF99C1BCE8FA400759400 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 562FF99B1BCE8FA400759400 /* Assets.xcassets */; };
|
||||
562FF99F1BCE8FA400759400 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 562FF99D1BCE8FA400759400 /* LaunchScreen.storyboard */; };
|
||||
562FF9CD1BCE902400759400 /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9AA1BCE902400759400 /* Configuration.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9CE1BCE902400759400 /* Database.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9AB1BCE902400759400 /* Database.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9CF1BCE902400759400 /* DatabaseChanges.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9AC1BCE902400759400 /* DatabaseChanges.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9D01BCE902400759400 /* DatabaseError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9AD1BCE902400759400 /* DatabaseError.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9D11BCE902400759400 /* DatabaseQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9AE1BCE902400759400 /* DatabaseQueue.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9D21BCE902400759400 /* DatabaseValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9AF1BCE902400759400 /* DatabaseValue.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9D31BCE902400759400 /* DatabaseTableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B11BCE902400759400 /* DatabaseTableMapping.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9D41BCE902400759400 /* DatabaseValueConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B21BCE902400759400 /* DatabaseValueConvertible.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9D51BCE902400759400 /* RowConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B31BCE902400759400 /* RowConvertible.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9D61BCE902400759400 /* SQLiteStatementConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B41BCE902400759400 /* SQLiteStatementConvertible.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9D71BCE902400759400 /* Row.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B51BCE902400759400 /* Row.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9D81BCE902400759400 /* SelectStatement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B61BCE902400759400 /* SelectStatement.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9D91BCE902400759400 /* Statement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B71BCE902400759400 /* Statement.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9DA1BCE902400759400 /* StatementArguments.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B81BCE902400759400 /* StatementArguments.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9DB1BCE902400759400 /* UpdateStatement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B91BCE902400759400 /* UpdateStatement.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9DC1BCE902400759400 /* DatabaseDateComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9BB1BCE902400759400 /* DatabaseDateComponents.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9DD1BCE902400759400 /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9BC1BCE902400759400 /* NSData.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9DE1BCE902400759400 /* NSDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9BD1BCE902400759400 /* NSDate.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9DF1BCE902400759400 /* NSNull.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9BE1BCE902400759400 /* NSNull.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9E01BCE902400759400 /* NSNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9BF1BCE902400759400 /* NSNumber.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9E11BCE902400759400 /* NSString.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C01BCE902400759400 /* NSString.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9E21BCE902400759400 /* NSURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C11BCE902400759400 /* NSURL.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9E31BCE902400759400 /* Row+Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C21BCE902400759400 /* Row+Foundation.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9E41BCE902400759400 /* RowConvertible+Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C31BCE902400759400 /* RowConvertible+Foundation.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9E51BCE902400759400 /* StatementArguments+Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C41BCE902400759400 /* StatementArguments+Foundation.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9E61BCE902400759400 /* DatabaseMigrator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C61BCE902400759400 /* DatabaseMigrator.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9E71BCE902400759400 /* DatabaseStorable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C81BCE902400759400 /* DatabaseStorable.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9E81BCE902400759400 /* Record.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C91BCE902400759400 /* Record.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9E91BCE902400759400 /* RawRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9CB1BCE902400759400 /* RawRepresentable.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9EA1BCE902400759400 /* StandardLibraryTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9CC1BCE902400759400 /* StandardLibraryTypes.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9EC1BCE903D00759400 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 562FF9EB1BCE903D00759400 /* libsqlite3.tbd */; };
|
||||
562FF9EF1BCE912C00759400 /* PersonEditionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9EE1BCE912C00759400 /* PersonEditionViewController.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
562FF9F21BCE914E00759400 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9F11BCE914E00759400 /* Person.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
562FF9911BCE8FA400759400 /* GRDBDemoiOS7.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GRDBDemoiOS7.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
562FF9941BCE8FA400759400 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
562FF9961BCE8FA400759400 /* PersonsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersonsViewController.swift; sourceTree = "<group>"; };
|
||||
562FF9991BCE8FA400759400 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
562FF99B1BCE8FA400759400 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
562FF99E1BCE8FA400759400 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
562FF9A01BCE8FA400759400 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
562FF9AA1BCE902400759400 /* Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = "<group>"; };
|
||||
562FF9AB1BCE902400759400 /* Database.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Database.swift; sourceTree = "<group>"; };
|
||||
562FF9AC1BCE902400759400 /* DatabaseChanges.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseChanges.swift; sourceTree = "<group>"; };
|
||||
562FF9AD1BCE902400759400 /* DatabaseError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseError.swift; sourceTree = "<group>"; };
|
||||
562FF9AE1BCE902400759400 /* DatabaseQueue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseQueue.swift; sourceTree = "<group>"; };
|
||||
562FF9AF1BCE902400759400 /* DatabaseValue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseValue.swift; sourceTree = "<group>"; };
|
||||
562FF9B11BCE902400759400 /* DatabaseTableMapping.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseTableMapping.swift; sourceTree = "<group>"; };
|
||||
562FF9B21BCE902400759400 /* DatabaseValueConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseValueConvertible.swift; sourceTree = "<group>"; };
|
||||
562FF9B31BCE902400759400 /* RowConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowConvertible.swift; sourceTree = "<group>"; };
|
||||
562FF9B41BCE902400759400 /* SQLiteStatementConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteStatementConvertible.swift; sourceTree = "<group>"; };
|
||||
562FF9B51BCE902400759400 /* Row.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Row.swift; sourceTree = "<group>"; };
|
||||
562FF9B61BCE902400759400 /* SelectStatement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectStatement.swift; sourceTree = "<group>"; };
|
||||
562FF9B71BCE902400759400 /* Statement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Statement.swift; sourceTree = "<group>"; };
|
||||
562FF9B81BCE902400759400 /* StatementArguments.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementArguments.swift; sourceTree = "<group>"; };
|
||||
562FF9B91BCE902400759400 /* UpdateStatement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UpdateStatement.swift; sourceTree = "<group>"; };
|
||||
562FF9BB1BCE902400759400 /* DatabaseDateComponents.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseDateComponents.swift; sourceTree = "<group>"; };
|
||||
562FF9BC1BCE902400759400 /* NSData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSData.swift; sourceTree = "<group>"; };
|
||||
562FF9BD1BCE902400759400 /* NSDate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSDate.swift; sourceTree = "<group>"; };
|
||||
562FF9BE1BCE902400759400 /* NSNull.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSNull.swift; sourceTree = "<group>"; };
|
||||
562FF9BF1BCE902400759400 /* NSNumber.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSNumber.swift; sourceTree = "<group>"; };
|
||||
562FF9C01BCE902400759400 /* NSString.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSString.swift; sourceTree = "<group>"; };
|
||||
562FF9C11BCE902400759400 /* NSURL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSURL.swift; sourceTree = "<group>"; };
|
||||
562FF9C21BCE902400759400 /* Row+Foundation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Row+Foundation.swift"; sourceTree = "<group>"; };
|
||||
562FF9C31BCE902400759400 /* RowConvertible+Foundation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "RowConvertible+Foundation.swift"; sourceTree = "<group>"; };
|
||||
562FF9C41BCE902400759400 /* StatementArguments+Foundation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "StatementArguments+Foundation.swift"; sourceTree = "<group>"; };
|
||||
562FF9C61BCE902400759400 /* DatabaseMigrator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseMigrator.swift; sourceTree = "<group>"; };
|
||||
562FF9C81BCE902400759400 /* DatabaseStorable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseStorable.swift; sourceTree = "<group>"; };
|
||||
562FF9C91BCE902400759400 /* Record.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Record.swift; sourceTree = "<group>"; };
|
||||
562FF9CB1BCE902400759400 /* RawRepresentable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RawRepresentable.swift; sourceTree = "<group>"; };
|
||||
562FF9CC1BCE902400759400 /* StandardLibraryTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StandardLibraryTypes.swift; sourceTree = "<group>"; };
|
||||
562FF9EB1BCE903D00759400 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };
|
||||
562FF9EE1BCE912C00759400 /* PersonEditionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonEditionViewController.swift; sourceTree = "<group>"; };
|
||||
562FF9F11BCE914E00759400 /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = "<group>"; };
|
||||
562FF9F41BCE930C00759400 /* GRDBDemoiOS7-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GRDBDemoiOS7-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
562FF98E1BCE8FA400759400 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
562FF9EC1BCE903D00759400 /* libsqlite3.tbd in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
562FF9881BCE8FA400759400 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9931BCE8FA400759400 /* GRDBDemoiOS7 */,
|
||||
562FF9921BCE8FA400759400 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF9921BCE8FA400759400 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9911BCE8FA400759400 /* GRDBDemoiOS7.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF9931BCE8FA400759400 /* GRDBDemoiOS7 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9941BCE8FA400759400 /* AppDelegate.swift */,
|
||||
562FF9F01BCE913900759400 /* Controllers */,
|
||||
562FF9F31BCE915B00759400 /* Models */,
|
||||
562FF9A61BCE8FB000759400 /* Resources */,
|
||||
562FF9ED1BCE904D00759400 /* Libraries */,
|
||||
562FF9A71BCE8FB600759400 /* Supporting Files */,
|
||||
);
|
||||
path = GRDBDemoiOS7;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF9A61BCE8FB000759400 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9981BCE8FA400759400 /* Main.storyboard */,
|
||||
562FF99B1BCE8FA400759400 /* Assets.xcassets */,
|
||||
562FF99D1BCE8FA400759400 /* LaunchScreen.storyboard */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF9A71BCE8FB600759400 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9A01BCE8FA400759400 /* Info.plist */,
|
||||
562FF9F41BCE930C00759400 /* GRDBDemoiOS7-Bridging-Header.h */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF9A81BCE900100759400 /* GRDB */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9A91BCE902400759400 /* Core */,
|
||||
562FF9BA1BCE902400759400 /* Foundation */,
|
||||
562FF9C51BCE902400759400 /* Migrations */,
|
||||
562FF9C71BCE902400759400 /* Record */,
|
||||
562FF9CA1BCE902400759400 /* Swift */,
|
||||
);
|
||||
name = GRDB;
|
||||
path = ../../GRDB;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
562FF9A91BCE902400759400 /* Core */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9AA1BCE902400759400 /* Configuration.swift */,
|
||||
562FF9AB1BCE902400759400 /* Database.swift */,
|
||||
562FF9AC1BCE902400759400 /* DatabaseChanges.swift */,
|
||||
562FF9AD1BCE902400759400 /* DatabaseError.swift */,
|
||||
562FF9AE1BCE902400759400 /* DatabaseQueue.swift */,
|
||||
562FF9AF1BCE902400759400 /* DatabaseValue.swift */,
|
||||
562FF9B01BCE902400759400 /* Protocols */,
|
||||
562FF9B51BCE902400759400 /* Row.swift */,
|
||||
562FF9B61BCE902400759400 /* SelectStatement.swift */,
|
||||
562FF9B71BCE902400759400 /* Statement.swift */,
|
||||
562FF9B81BCE902400759400 /* StatementArguments.swift */,
|
||||
562FF9B91BCE902400759400 /* UpdateStatement.swift */,
|
||||
);
|
||||
path = Core;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF9B01BCE902400759400 /* Protocols */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9B11BCE902400759400 /* DatabaseTableMapping.swift */,
|
||||
562FF9B21BCE902400759400 /* DatabaseValueConvertible.swift */,
|
||||
562FF9B31BCE902400759400 /* RowConvertible.swift */,
|
||||
562FF9B41BCE902400759400 /* SQLiteStatementConvertible.swift */,
|
||||
);
|
||||
path = Protocols;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF9BA1BCE902400759400 /* Foundation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9BB1BCE902400759400 /* DatabaseDateComponents.swift */,
|
||||
562FF9BC1BCE902400759400 /* NSData.swift */,
|
||||
562FF9BD1BCE902400759400 /* NSDate.swift */,
|
||||
562FF9BE1BCE902400759400 /* NSNull.swift */,
|
||||
562FF9BF1BCE902400759400 /* NSNumber.swift */,
|
||||
562FF9C01BCE902400759400 /* NSString.swift */,
|
||||
562FF9C11BCE902400759400 /* NSURL.swift */,
|
||||
562FF9C21BCE902400759400 /* Row+Foundation.swift */,
|
||||
562FF9C31BCE902400759400 /* RowConvertible+Foundation.swift */,
|
||||
562FF9C41BCE902400759400 /* StatementArguments+Foundation.swift */,
|
||||
);
|
||||
path = Foundation;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF9C51BCE902400759400 /* Migrations */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9C61BCE902400759400 /* DatabaseMigrator.swift */,
|
||||
);
|
||||
path = Migrations;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF9C71BCE902400759400 /* Record */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9C81BCE902400759400 /* DatabaseStorable.swift */,
|
||||
562FF9C91BCE902400759400 /* Record.swift */,
|
||||
);
|
||||
path = Record;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF9CA1BCE902400759400 /* Swift */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9CB1BCE902400759400 /* RawRepresentable.swift */,
|
||||
562FF9CC1BCE902400759400 /* StandardLibraryTypes.swift */,
|
||||
);
|
||||
path = Swift;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF9ED1BCE904D00759400 /* Libraries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9EB1BCE903D00759400 /* libsqlite3.tbd */,
|
||||
562FF9A81BCE900100759400 /* GRDB */,
|
||||
);
|
||||
name = Libraries;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF9F01BCE913900759400 /* Controllers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9EE1BCE912C00759400 /* PersonEditionViewController.swift */,
|
||||
562FF9961BCE8FA400759400 /* PersonsViewController.swift */,
|
||||
);
|
||||
name = Controllers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF9F31BCE915B00759400 /* Models */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
562FF9F11BCE914E00759400 /* Person.swift */,
|
||||
);
|
||||
name = Models;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
562FF9901BCE8FA400759400 /* GRDBDemoiOS7 */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 562FF9A31BCE8FA400759400 /* Build configuration list for PBXNativeTarget "GRDBDemoiOS7" */;
|
||||
buildPhases = (
|
||||
562FF98D1BCE8FA400759400 /* Sources */,
|
||||
562FF98E1BCE8FA400759400 /* Frameworks */,
|
||||
562FF98F1BCE8FA400759400 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = GRDBDemoiOS7;
|
||||
productName = GRDBDemoiOS7;
|
||||
productReference = 562FF9911BCE8FA400759400 /* GRDBDemoiOS7.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
562FF9891BCE8FA400759400 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0700;
|
||||
ORGANIZATIONNAME = "Gwendal Roué";
|
||||
TargetAttributes = {
|
||||
562FF9901BCE8FA400759400 = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 562FF98C1BCE8FA400759400 /* Build configuration list for PBXProject "GRDBDemoiOS7" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 562FF9881BCE8FA400759400;
|
||||
productRefGroup = 562FF9921BCE8FA400759400 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
562FF9901BCE8FA400759400 /* GRDBDemoiOS7 */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
562FF98F1BCE8FA400759400 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
562FF99F1BCE8FA400759400 /* LaunchScreen.storyboard in Resources */,
|
||||
562FF99C1BCE8FA400759400 /* Assets.xcassets in Resources */,
|
||||
562FF99A1BCE8FA400759400 /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
562FF98D1BCE8FA400759400 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
562FF9D21BCE902400759400 /* DatabaseValue.swift in Sources */,
|
||||
562FF9CD1BCE902400759400 /* Configuration.swift in Sources */,
|
||||
562FF9E81BCE902400759400 /* Record.swift in Sources */,
|
||||
562FF9D41BCE902400759400 /* DatabaseValueConvertible.swift in Sources */,
|
||||
562FF9E31BCE902400759400 /* Row+Foundation.swift in Sources */,
|
||||
562FF9D81BCE902400759400 /* SelectStatement.swift in Sources */,
|
||||
562FF9D71BCE902400759400 /* Row.swift in Sources */,
|
||||
562FF9EF1BCE912C00759400 /* PersonEditionViewController.swift in Sources */,
|
||||
562FF9971BCE8FA400759400 /* PersonsViewController.swift in Sources */,
|
||||
562FF9CE1BCE902400759400 /* Database.swift in Sources */,
|
||||
562FF9E01BCE902400759400 /* NSNumber.swift in Sources */,
|
||||
562FF9CF1BCE902400759400 /* DatabaseChanges.swift in Sources */,
|
||||
562FF9E51BCE902400759400 /* StatementArguments+Foundation.swift in Sources */,
|
||||
562FF9D61BCE902400759400 /* SQLiteStatementConvertible.swift in Sources */,
|
||||
562FF9F21BCE914E00759400 /* Person.swift in Sources */,
|
||||
562FF9D91BCE902400759400 /* Statement.swift in Sources */,
|
||||
562FF9E91BCE902400759400 /* RawRepresentable.swift in Sources */,
|
||||
562FF9951BCE8FA400759400 /* AppDelegate.swift in Sources */,
|
||||
562FF9EA1BCE902400759400 /* StandardLibraryTypes.swift in Sources */,
|
||||
562FF9D31BCE902400759400 /* DatabaseTableMapping.swift in Sources */,
|
||||
562FF9DD1BCE902400759400 /* NSData.swift in Sources */,
|
||||
562FF9D11BCE902400759400 /* DatabaseQueue.swift in Sources */,
|
||||
562FF9DE1BCE902400759400 /* NSDate.swift in Sources */,
|
||||
562FF9E41BCE902400759400 /* RowConvertible+Foundation.swift in Sources */,
|
||||
562FF9E61BCE902400759400 /* DatabaseMigrator.swift in Sources */,
|
||||
562FF9D01BCE902400759400 /* DatabaseError.swift in Sources */,
|
||||
562FF9DB1BCE902400759400 /* UpdateStatement.swift in Sources */,
|
||||
562FF9E21BCE902400759400 /* NSURL.swift in Sources */,
|
||||
562FF9DA1BCE902400759400 /* StatementArguments.swift in Sources */,
|
||||
562FF9E71BCE902400759400 /* DatabaseStorable.swift in Sources */,
|
||||
562FF9E11BCE902400759400 /* NSString.swift in Sources */,
|
||||
562FF9DC1BCE902400759400 /* DatabaseDateComponents.swift in Sources */,
|
||||
562FF9DF1BCE902400759400 /* NSNull.swift in Sources */,
|
||||
562FF9D51BCE902400759400 /* RowConvertible.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
562FF9981BCE8FA400759400 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
562FF9991BCE8FA400759400 /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
562FF99D1BCE8FA400759400 /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
562FF99E1BCE8FA400759400 /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
562FF9A11BCE8FA400759400 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
562FF9A21BCE8FA400759400 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
562FF9A41BCE8FA400759400 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = GRDBDemoiOS7/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS7;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "GRDBDemoiOS7/GRDBDemoiOS7-Bridging-Header.h";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
562FF9A51BCE8FA400759400 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = GRDBDemoiOS7/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS7;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "GRDBDemoiOS7/GRDBDemoiOS7-Bridging-Header.h";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
562FF98C1BCE8FA400759400 /* Build configuration list for PBXProject "GRDBDemoiOS7" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
562FF9A11BCE8FA400759400 /* Debug */,
|
||||
562FF9A21BCE8FA400759400 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
562FF9A31BCE8FA400759400 /* Build configuration list for PBXNativeTarget "GRDBDemoiOS7" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
562FF9A41BCE8FA400759400 /* Debug */,
|
||||
562FF9A51BCE8FA400759400 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 562FF9891BCE8FA400759400 /* Project object */;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
import UIKit
|
||||
|
||||
// The shared database queue, stored in a global.
|
||||
// It is created in AppDelegate.application(_:didFinishLaunchingWithOptions:)
|
||||
var dbQueue: DatabaseQueue!
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
|
||||
|
||||
// Connect to the database
|
||||
|
||||
let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first! as NSString
|
||||
let databasePath = documentsPath.stringByAppendingPathComponent("db.sqlite")
|
||||
dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
|
||||
|
||||
// Use DatabaseMigrator to setup the database
|
||||
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.registerMigration("createPersons") { db in
|
||||
try db.execute(
|
||||
"CREATE TABLE persons (" +
|
||||
"id INTEGER PRIMARY KEY, " +
|
||||
"firstName TEXT, " +
|
||||
"lastName TEXT " +
|
||||
")")
|
||||
}
|
||||
migrator.registerMigration("addPersons") { db in
|
||||
try Person(firstName: "Arthur", lastName: "Miller").insert(db)
|
||||
try Person(firstName: "Barbara", lastName: "Streisand").insert(db)
|
||||
try Person(firstName: "Cinderella").insert(db)
|
||||
}
|
||||
try! migrator.migrate(dbQueue)
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Xbj-yc-Aiu">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Persons View Controller-->
|
||||
<scene sceneID="1fE-hv-cjH">
|
||||
<objects>
|
||||
<tableViewController id="ynz-7l-fNg" customClass="PersonsViewController" customModule="GRDBDemoiOS7" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="wb6-9X-0tl">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<prototypes>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="0eG-T5-kyh" style="IBUITableViewCellStyleDefault" id="eJm-gh-sbD">
|
||||
<rect key="frame" x="0.0" y="92" width="600" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="eJm-gh-sbD" id="njP-8B-rhM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="0eG-T5-kyh">
|
||||
<rect key="frame" x="15" y="0.0" width="570" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="ynz-7l-fNg" id="5FA-Zc-cZO"/>
|
||||
<outlet property="delegate" destination="ynz-7l-fNg" id="B8Y-qi-fJZ"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<toolbarItems/>
|
||||
<navigationItem key="navigationItem" id="gMJ-R9-ZaQ">
|
||||
<barButtonItem key="rightBarButtonItem" systemItem="add" id="XY0-Dc-M7c">
|
||||
<connections>
|
||||
<segue destination="oMH-Sb-bab" kind="presentation" identifier="editNewPerson" id="i19-Bf-uNJ"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="0kz-GI-OO0" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1195" y="377"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="cvq-JR-nHN">
|
||||
<objects>
|
||||
<navigationController id="Xbj-yc-Aiu" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="Hgn-6S-1iz">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="ynz-7l-fNg" kind="relationship" relationship="rootViewController" id="C4a-4A-4Md"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="OyF-YK-p9J" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="375" y="377"/>
|
||||
</scene>
|
||||
<!--Person Edition View Controller-->
|
||||
<scene sceneID="nA8-Ek-eRe">
|
||||
<objects>
|
||||
<tableViewController id="8yj-TG-7Iv" customClass="PersonEditionViewController" customModule="GRDBDemoiOS7" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="jhE-wh-IDm">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||
<sections>
|
||||
<tableViewSection id="9vV-wM-aZ9">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="oKc-Vh-GAg">
|
||||
<rect key="frame" x="0.0" y="99" width="600" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="oKc-Vh-GAg" id="EWB-Ks-FwX">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="eF9-yN-ByV">
|
||||
<rect key="frame" x="106" y="11" width="479" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" spellCheckingType="no"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="8yj-TG-7Iv" id="tG8-8g-5h8"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="First Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xbk-eb-6vS">
|
||||
<rect key="frame" x="15" y="11" width="83" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.1137254902" green="0.47843137250000001" blue="0.98039215690000003" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="eF9-yN-ByV" secondAttribute="trailing" constant="15" id="5YN-K6-y1e"/>
|
||||
<constraint firstItem="xbk-eb-6vS" firstAttribute="leading" secondItem="EWB-Ks-FwX" secondAttribute="leading" constant="15" id="6ZF-52-FFn"/>
|
||||
<constraint firstItem="xbk-eb-6vS" firstAttribute="centerY" secondItem="EWB-Ks-FwX" secondAttribute="centerY" id="9zo-vh-Z4q"/>
|
||||
<constraint firstItem="eF9-yN-ByV" firstAttribute="leading" secondItem="xbk-eb-6vS" secondAttribute="trailing" constant="8" symbolic="YES" id="aKR-sh-Dh7"/>
|
||||
<constraint firstItem="eF9-yN-ByV" firstAttribute="centerY" secondItem="EWB-Ks-FwX" secondAttribute="centerY" id="kqk-6N-RLq"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="jUE-io-HLU">
|
||||
<rect key="frame" x="0.0" y="143" width="600" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="jUE-io-HLU" id="utc-hw-ReT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="D1U-mQ-lvp">
|
||||
<rect key="frame" x="105" y="11" width="480" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" spellCheckingType="no"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="8yj-TG-7Iv" id="2pv-xY-VtW"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="Last Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oYd-Lu-Kgd">
|
||||
<rect key="frame" x="15" y="11" width="82" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.1137254902" green="0.47843137250000001" blue="0.98039215690000003" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="D1U-mQ-lvp" firstAttribute="leading" secondItem="oYd-Lu-Kgd" secondAttribute="trailing" constant="8" symbolic="YES" id="FHD-Pe-EkI"/>
|
||||
<constraint firstItem="oYd-Lu-Kgd" firstAttribute="centerY" secondItem="utc-hw-ReT" secondAttribute="centerY" id="Kdt-DU-1us"/>
|
||||
<constraint firstItem="D1U-mQ-lvp" firstAttribute="centerY" secondItem="utc-hw-ReT" secondAttribute="centerY" id="RVU-rE-8Aq"/>
|
||||
<constraint firstItem="oYd-Lu-Kgd" firstAttribute="leading" secondItem="utc-hw-ReT" secondAttribute="leading" constant="15" id="Wlm-uX-s7l"/>
|
||||
<constraint firstAttribute="trailing" secondItem="D1U-mQ-lvp" secondAttribute="trailing" constant="15" id="fs6-Mj-Cug"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
</sections>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="8yj-TG-7Iv" id="DrV-HH-zW8"/>
|
||||
<outlet property="delegate" destination="8yj-TG-7Iv" id="5Ta-JL-Sse"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<toolbarItems/>
|
||||
<navigationItem key="navigationItem" id="0rI-r6-PKi">
|
||||
<barButtonItem key="rightBarButtonItem" style="done" systemItem="done" id="jGa-U1-8mj">
|
||||
<connections>
|
||||
<segue destination="eQQ-Mr-J7f" kind="unwind" identifier="commit" unwindAction="commitPersonEdition:" id="LQt-5H-hX8"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||
<connections>
|
||||
<outlet property="firstNameTableViewCell" destination="oKc-Vh-GAg" id="GgP-dg-jJI"/>
|
||||
<outlet property="firstNameTextField" destination="eF9-yN-ByV" id="CwB-oL-I3U"/>
|
||||
<outlet property="lastNameTableViewCell" destination="jUE-io-HLU" id="8SU-t1-EJR"/>
|
||||
<outlet property="lastNameTextField" destination="D1U-mQ-lvp" id="4b9-am-ANQ"/>
|
||||
</connections>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="sm8-PY-oAW" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<exit id="eQQ-Mr-J7f" userLabel="Exit" sceneMemberID="exit"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="2843" y="377"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="n5c-pj-sKx">
|
||||
<objects>
|
||||
<navigationController id="oMH-Sb-bab" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="d5l-tl-lRt">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="8yj-TG-7Iv" kind="relationship" relationship="rootViewController" id="rAN-NO-1Mw"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="UxC-4D-edS" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="2023" y="377"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
@@ -1,14 +0,0 @@
|
||||
//
|
||||
// GRDBDemoiOS7-Bridging-Header.h
|
||||
// GRDBDemoiOS7
|
||||
//
|
||||
// Created by Gwendal Roué on 14/10/2015.
|
||||
// Copyright © 2015 Gwendal Roué. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef GRDBDemoiOS7_Bridging_Header_h
|
||||
#define GRDBDemoiOS7_Bridging_Header_h
|
||||
|
||||
#import "sqlite3.h"
|
||||
|
||||
#endif /* GRDBDemoiOS7_Bridging_Header_h */
|
||||
@@ -1,38 +0,0 @@
|
||||
class Person : Record {
|
||||
var id: Int64!
|
||||
var firstName: String?
|
||||
var lastName: String?
|
||||
var fullName: String {
|
||||
return [firstName, lastName].flatMap { $0 }.joinWithSeparator(" ")
|
||||
}
|
||||
|
||||
init(firstName: String? = nil, lastName: String? = nil) {
|
||||
self.firstName = firstName
|
||||
self.lastName = lastName
|
||||
super.init()
|
||||
}
|
||||
|
||||
// MARK: - Record
|
||||
|
||||
override class func databaseTableName() -> String? {
|
||||
return "persons"
|
||||
}
|
||||
|
||||
override func updateFromRow(row: Row) {
|
||||
if let dbv = row["id"] { id = dbv.value() }
|
||||
if let dbv = row["firstName"] { firstName = dbv.value() }
|
||||
if let dbv = row["lastName"] { lastName = dbv.value() }
|
||||
super.updateFromRow(row) // Subclasses are required to call super.
|
||||
}
|
||||
|
||||
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
|
||||
return [
|
||||
"id": id,
|
||||
"firstName": firstName,
|
||||
"lastName": lastName]
|
||||
}
|
||||
|
||||
required init(row: Row) {
|
||||
super.init(row: row)
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
import UIKit
|
||||
|
||||
class PersonEditionViewController: UITableViewController, UITextFieldDelegate {
|
||||
@IBOutlet weak var firstNameTableViewCell: UITableViewCell!
|
||||
@IBOutlet weak var firstNameTextField: UITextField!
|
||||
@IBOutlet weak var lastNameTableViewCell: UITableViewCell!
|
||||
@IBOutlet weak var lastNameTextField: UITextField!
|
||||
|
||||
// The edited person
|
||||
var person: Person!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Initializes textFields with the person's names
|
||||
firstNameTextField.text = person.firstName
|
||||
lastNameTextField.text = person.lastName
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
// Auto focus firstName
|
||||
firstNameTextField.becomeFirstResponder()
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
|
||||
// Tapping a cell selects its text fields.
|
||||
if indexPath == tableView.indexPathForCell(firstNameTableViewCell) {
|
||||
firstNameTextField.becomeFirstResponder()
|
||||
} else if indexPath == tableView.indexPathForCell(lastNameTableViewCell) {
|
||||
lastNameTextField.becomeFirstResponder()
|
||||
}
|
||||
}
|
||||
|
||||
func textFieldShouldReturn(textField: UITextField) -> Bool {
|
||||
// Tapping Return key focuses next text field.
|
||||
if textField == firstNameTextField {
|
||||
lastNameTextField.becomeFirstResponder()
|
||||
} else {
|
||||
textField.resignFirstResponder()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func textFieldDidEndEditing(textField: UITextField) {
|
||||
// Update person when text field ends editing.
|
||||
if textField == firstNameTextField {
|
||||
person.firstName = textField.text
|
||||
} else if textField == lastNameTextField {
|
||||
person.lastName = textField.text
|
||||
}
|
||||
}
|
||||
|
||||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
|
||||
// About to cancel or commit: end editing.
|
||||
// This dismisses the keyboard early, and apply pending changes through
|
||||
// textFieldDidEndEditing(_).
|
||||
view.endEditing(true)
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
import UIKit
|
||||
|
||||
class PersonsViewController: UITableViewController {
|
||||
var persons = [Person]()
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
// Reload persons, and the tableView
|
||||
reloadPersons()
|
||||
tableView.reloadData()
|
||||
|
||||
self.navigationItem.leftBarButtonItem = self.editButtonItem()
|
||||
super.viewWillAppear(animated)
|
||||
}
|
||||
|
||||
func reloadPersons() {
|
||||
persons = dbQueue.inDatabase { db in
|
||||
Person.fetchAll(db, "SELECT * FROM persons ORDER BY LOWER(firstName), LOWER(lastName)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Segues
|
||||
|
||||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
|
||||
if segue.identifier == "editNewPerson" {
|
||||
let personEditionViewController = (segue.destinationViewController as! UINavigationController).topViewController as! PersonEditionViewController
|
||||
personEditionViewController.person = Person()
|
||||
}
|
||||
}
|
||||
|
||||
// Unwind action: commit person edition
|
||||
@IBAction func commitPersonEdition(segue: UIStoryboardSegue) {
|
||||
let personEditionViewController = segue.sourceViewController as! PersonEditionViewController
|
||||
let person = personEditionViewController.person
|
||||
|
||||
// Ignore person with no name
|
||||
guard (person.firstName ?? "").characters.count > 0 || (person.lastName ?? "").characters.count > 0 else {
|
||||
return
|
||||
}
|
||||
|
||||
// Save person
|
||||
try! dbQueue.inDatabase { db in
|
||||
try person.save(db)
|
||||
}
|
||||
|
||||
// Reload persons, and insert a cell.
|
||||
reloadPersons()
|
||||
let index = persons.indexOf { $0.id == person.id }!
|
||||
tableView.insertRowsAtIndexPaths([NSIndexPath(forRow: index, inSection: 0)], withRowAnimation: .Automatic)
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Table View
|
||||
|
||||
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return persons.count
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
|
||||
|
||||
let person = persons[indexPath.row]
|
||||
cell.textLabel!.text = person.fullName
|
||||
return cell
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
|
||||
// Delete the person
|
||||
let person = persons[indexPath.row]
|
||||
try! dbQueue.inTransaction { db in
|
||||
try person.delete(db)
|
||||
return .Commit
|
||||
}
|
||||
persons.removeAtIndex(indexPath.row)
|
||||
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
GRDBDemoiOS7
|
||||
============
|
||||
|
||||
This application runs an application that displays an editable list of persons and targets iOS7.
|
||||
|
||||
**To integrate GRDB in your iOS7 application:**
|
||||
|
||||
1. Drag all Swift files contained in the [GRDB folder](../../GRDB/) in your project.
|
||||
|
||||
2. In the **Build Phase** tab of your target, add `libsqlite3.tbd` in the **Link Binary With Libraries** section.
|
||||
|
||||
3. [Add a Bridging header to your project](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html) in which you add:
|
||||
|
||||
```objc
|
||||
#import "sqlite3.h"
|
||||
```
|
||||
|
||||
4. Run
|
||||
@@ -0,0 +1,132 @@
|
||||
Custom SQLite Builds
|
||||
====================
|
||||
|
||||
By default, GRDB uses the version of SQLite that ships with the target operating system.
|
||||
|
||||
**You can build GRDB with a custom build of [SQLite 3.20.0](https://www.sqlite.org/changes.html).**
|
||||
|
||||
A custom SQLite build can activate extra SQLite features, and extra GRDB features as well, such as support for the [FTS5 full-text search engine](../../../#full-text-search), and [SQLite Pre-Update Hooks](../../../#support-for-sqlite-pre-update-hooks).
|
||||
|
||||
GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfalling/SQLiteLib), which uses the same SQLite configuration as the one used by Apple in its operating systems, and lets you add extra compilation options that leverage the features you need.
|
||||
|
||||
**To install GRDB with a custom SQLite build:**
|
||||
|
||||
1. Clone the GRDB git repository, checkout the latest tagged version, and download SQLite sources:
|
||||
|
||||
```sh
|
||||
cd [GRDB directory]
|
||||
git checkout v2.0
|
||||
git submodule update --init SQLiteCustom/src
|
||||
````
|
||||
|
||||
2. Choose your [extra compilation options](https://www.sqlite.org/compile.html). For example, `SQLITE_ENABLE_FTS5` and `SQLITE_ENABLE_PREUPDATE_HOOK`.
|
||||
|
||||
3. Create a folder named `GRDBCustomSQLite` somewhere in your project directory.
|
||||
|
||||
4. Create four files in the `GRDBCustomSQLite` folder:
|
||||
|
||||
- `SQLiteLib-USER.xcconfig`: this file sets the extra SQLite compilation flags.
|
||||
|
||||
```xcconfig
|
||||
// As many -D options as there are custom SQLite compilation options
|
||||
// Note: there is no space between -D and the option name.
|
||||
CUSTOM_SQLLIBRARY_CFLAGS = -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_PREUPDATE_HOOK
|
||||
```
|
||||
|
||||
- `GRDBCustomSQLite-USER.xcconfig`: this file lets GRDB know about extra compilation flags, and enables extra GRDB APIs.
|
||||
|
||||
```xcconfig
|
||||
// As many -D options as there are custom SQLite compilation options
|
||||
// Note: there is one space between -D and the option name.
|
||||
CUSTOM_OTHER_SWIFT_FLAGS = -D SQLITE_ENABLE_FTS5 -D SQLITE_ENABLE_PREUPDATE_HOOK
|
||||
```
|
||||
|
||||
- `GRDBCustomSQLite-USER.h`: this file lets your application know about extra compilation flags.
|
||||
|
||||
```c
|
||||
// As many #define as there are custom SQLite compilation options
|
||||
#define SQLITE_ENABLE_FTS5
|
||||
#define SQLITE_ENABLE_PREUPDATE_HOOK
|
||||
```
|
||||
|
||||
- `GRDBCustomSQLite-INSTALL.sh`: this file installs the three other files.
|
||||
|
||||
```sh
|
||||
# License: MIT License
|
||||
# https://github.com/swiftlyfalling/SQLiteLib/blob/master/LICENSE
|
||||
#
|
||||
#######################################################
|
||||
# PROJECT PATHS
|
||||
# !! MODIFY THESE TO MATCH YOUR PROJECT HIERARCHY !!
|
||||
#######################################################
|
||||
|
||||
# The path to the folder containing GRDB.xcodeproj:
|
||||
GRDB_SOURCE_PATH="${PROJECT_DIR}/GRDB"
|
||||
|
||||
# The path to your custom "SQLiteLib-USER.xcconfig":
|
||||
SQLITELIB_XCCONFIG_USER_PATH="${PROJECT_DIR}/GRDBCustomSQLite/SQLiteLib-USER.xcconfig"
|
||||
|
||||
# The path to your custom "GRDBCustomSQLite-USER.xcconfig":
|
||||
CUSTOMSQLITE_XCCONFIG_USER_PATH="${PROJECT_DIR}/GRDBCustomSQLite/GRDBCustomSQLite-USER.xcconfig"
|
||||
|
||||
# The path to your custom "GRDBCustomSQLite-USER.h":
|
||||
CUSTOMSQLITE_H_USER_PATH="${PROJECT_DIR}/GRDBCustomSQLite/GRDBCustomSQLite-USER.h"
|
||||
|
||||
#######################################################
|
||||
#
|
||||
#######################################################
|
||||
|
||||
|
||||
if [ ! -d "$GRDB_SOURCE_PATH" ];
|
||||
then
|
||||
echo "error: Path to GRDB source (GRDB_SOURCE_PATH) missing/incorrect: $GRDB_SOURCE_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SyncFileChanges () {
|
||||
SOURCE=$1
|
||||
DESTINATIONPATH=$2
|
||||
DESTINATIONFILENAME=$3
|
||||
DESTINATION="${DESTINATIONPATH}/${DESTINATIONFILENAME}"
|
||||
|
||||
if [ ! -f "$SOURCE" ];
|
||||
then
|
||||
echo "error: Source file missing: $SOURCE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rsync -a "$SOURCE" "$DESTINATION"
|
||||
}
|
||||
|
||||
SyncFileChanges $SQLITELIB_XCCONFIG_USER_PATH "${GRDB_SOURCE_PATH}/SQLiteCustom/src" "SQLiteLib-USER.xcconfig"
|
||||
SyncFileChanges $CUSTOMSQLITE_XCCONFIG_USER_PATH "${GRDB_SOURCE_PATH}/SQLiteCustom" "GRDBCustomSQLite-USER.xcconfig"
|
||||
SyncFileChanges $CUSTOMSQLITE_H_USER_PATH "${GRDB_SOURCE_PATH}/SQLiteCustom" "GRDBCustomSQLite-USER.h"
|
||||
|
||||
echo "Finished syncing"
|
||||
```
|
||||
|
||||
Modify the top of `GRDBCustomSQLite-INSTALL.sh` file so that it contains correct paths.
|
||||
|
||||
5. Embed the `GRDB.xcodeproj` project in your own project.
|
||||
|
||||
6. Add the `GRDBCustomSQLiteOSX` or `GRDBCustomSQLiteiOS` target in the **Target Dependencies** section of the **Build Phases** tab of your **application target**.
|
||||
|
||||
7. Add the `GRDBCustomSQLite.framework` from the targetted platform to the **Embedded Binaries** section of the **General** tab of your **application target**.
|
||||
|
||||
8. Add a Run Script phase for your target in the **Pre-actions** section of the **Build** tab of your **application scheme**:
|
||||
|
||||
```sh
|
||||
source "${PROJECT_DIR}/GRDBCustomSQLite/GRDBCustomSQLite-INSTALL.sh"
|
||||
```
|
||||
|
||||
The path should be the path to your `GRDBCustomSQLite-INSTALL.sh` file.
|
||||
|
||||
9. Check the "Shared" checkbox of your application scheme (this lets you commit the pre-action in your Version Control System).
|
||||
|
||||
Now you can use GRDB with your custom SQLite build:
|
||||
|
||||
```swift
|
||||
import GRDBCustomSQLite
|
||||
|
||||
let dbQueue = try DatabaseQueue(...)
|
||||
```
|
||||
@@ -0,0 +1,591 @@
|
||||
GRDB Extension Guide
|
||||
====================
|
||||
|
||||
**Some parts of GRDB are extensible, so that you can make it better fit your needs.**
|
||||
|
||||
This guide is a step-by-step tour of GRDB extensibility, around a few topics:
|
||||
|
||||
- **[Add a value type](#add-a-value-type)**
|
||||
|
||||
You'll learn how to turn UIColor into a value type that you can store, fetch, and use in your records:
|
||||
|
||||
```swift
|
||||
let rows = try Row.fetchCursor(db, "SELECT name, color FROM clothes")
|
||||
while let row = try rows.next() {
|
||||
let name: String = row["name"]
|
||||
let color: UIColor = row["color"] // <-- New! UIColor as value
|
||||
}
|
||||
```
|
||||
|
||||
- **[Add an SQLite function or operator](#add-an-sqlite-function-or-operator)**
|
||||
|
||||
You'll learn how to add support for the [STRFTIME](https://www.sqlite.org/lang_datefunc.html) function, and the [GLOB](https://www.sqlite.org/lang_expr.html#like) operator:
|
||||
|
||||
```swift
|
||||
Books.select(strftime("%Y", Column("publishedDate"))) // <-- New! strftime function
|
||||
Books.filter(Column("body").glob("*Moby-Dick*")) // <-- New! glob method
|
||||
```
|
||||
|
||||
- **[Add a new kind of SQLite expression](#add-a-new-kind-of-sqlite-expression)**
|
||||
|
||||
You'll learn how to add support for [CAST expressions](https://www.sqlite.org/lang_expr.html#castexpr):
|
||||
|
||||
```swift
|
||||
let jsonString = Column("jsonString")
|
||||
let request = Books.select(cast(jsonString, as: .blob)) // <-- New! cast function
|
||||
let rows = try Row.fetchCursor(db, request)
|
||||
while let row = try rows.next() {
|
||||
let data = row.dataNoCopy(atIndex: 0)
|
||||
}
|
||||
```
|
||||
|
||||
- **Extend the query interface requests**
|
||||
|
||||
You may need to extend the [query interface requests](../../../#requests) so that their SELECT queries could embed recursive clauses, table joins, etc.
|
||||
|
||||
Pull requests are welcome. Open issues if you have questions.
|
||||
|
||||
Meanwhile, you can build your own [custom requests](../../../#custom-requests).
|
||||
|
||||
- **[Add a custom FTS5 full-text tokenizer](FTS5Tokenizers.md)**
|
||||
|
||||
Custom tokenizers can leverage extra full-text features such as synonyms or stop words.
|
||||
|
||||
- **Support a new kind of SQL query**
|
||||
|
||||
For example, you may need to generate SQL triggers, or create specific kinds of virtual tables.
|
||||
|
||||
Pull requests are welcome. Open issues if you have questions.
|
||||
|
||||
|
||||
## Add a Value Type
|
||||
|
||||
**All value types adopt the [DatabaseValueConvertible protocol](../../../#custom-value-types).**
|
||||
|
||||
```swift
|
||||
protocol DatabaseValueConvertible {
|
||||
/// Returns a value that can be stored in the database.
|
||||
var databaseValue: DatabaseValue { get }
|
||||
|
||||
/// Returns a value initialized from databaseValue, if possible.
|
||||
static func fromDatabaseValue(_ databaseValue: DatabaseValue) -> Self?
|
||||
}
|
||||
```
|
||||
|
||||
The `databaseValue` property returns [DatabaseValue](../../../#databasevalue), a type that wraps the five values supported by SQLite: NULL, Int64, Double, String and Data. Since DatabaseValue has no public initializer, use `DatabaseValue.null`, or another type that already adopts the protocol: `1.databaseValue`, `"foo".databaseValue`, etc. Conversion to DatabaseValue *must not* fail.
|
||||
|
||||
The `fromDatabaseValue()` factory method returns an instance of your custom type if the databaseValue contains a suitable value. If the databaseValue does not contain a suitable value, such as "foo" for Date, `fromDatabaseValue` *must* return nil (GRDB will interpret this nil result as a conversion error, and react accordingly).
|
||||
|
||||
**What does the DatabaseValueConvertible protocol bring to a type like UIColor?**
|
||||
|
||||
Well, you will be able to use UIColor like all other [value types](../../../#values) (Bool, Int, String, Date, Swift enums, etc.):
|
||||
|
||||
- Use UIColor as [statement arguments](../../../#executing-updates):
|
||||
|
||||
```swift
|
||||
try db.execute(
|
||||
"INSERT INTO clothes (name, color) VALUES (?, ?)",
|
||||
arguments: ["Shirt", UIColor.red])
|
||||
```
|
||||
|
||||
- UIColor can be [extracted from rows](../../../#column-values):
|
||||
|
||||
```swift
|
||||
let rows = try Row.fetchCursor(db, "SELECT * FROM clothes")
|
||||
while let row = try rows.next() {
|
||||
let name: String = row["name"]
|
||||
let color: UIColor = row["color"]
|
||||
}
|
||||
```
|
||||
|
||||
- UIColor can be [directly fetched](../../../#value-queries):
|
||||
|
||||
```swift
|
||||
let colors = try UIColor.fetchAll(db, "SELECT DISTINCT color FROM clothes") // [UIColor]
|
||||
```
|
||||
|
||||
- Use UIColor in [Records](../../../#records):
|
||||
|
||||
```swift
|
||||
class ClothingItem : Record {
|
||||
var name: String
|
||||
var color: UIColor
|
||||
|
||||
required init(row: Row) {
|
||||
name = row["name"]
|
||||
color = row["color"]
|
||||
super.init(row: row)
|
||||
}
|
||||
|
||||
override func encode(to container: inout PersistenceContainer) {
|
||||
container["name"] = name
|
||||
container["color"] = color
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- Use UIColor in the [query interface](../../../#the-query-interface):
|
||||
|
||||
```swift
|
||||
let redClothes = try ClothingItem.filter(colorColumn == UIColor.red).fetchAll(db)
|
||||
```
|
||||
|
||||
**Let's have UIColor adopt DatabaseValueConvertible**
|
||||
|
||||
In order to preserve as most information as possible, we'll archive UIColor as a data blob using the NSCoding protocol. But YMMV.
|
||||
|
||||
```swift
|
||||
extension UIColor : DatabaseValueConvertible {
|
||||
|
||||
/// Encode UIColor as a data blob
|
||||
var databaseValue: DatabaseValue {
|
||||
// Use NSKeyedArchiver to build Data
|
||||
let data = NSKeyedArchiver.archivedData(withRootObject: self)
|
||||
|
||||
// Data is already DatabaseValueConvertible
|
||||
return data.databaseValue
|
||||
}
|
||||
|
||||
/// Returns a UIColor if databaseValue contains suitable data, and
|
||||
/// nil otherwise.
|
||||
static func fromDatabaseValue(_ databaseValue: DatabaseValue) -> Self? {
|
||||
// Only Data blobs can contain a UIColor
|
||||
guard let data = Data.fromDatabaseValue(databaseValue) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
// We're looking for an archived object
|
||||
guard let color = NSKeyedUnarchiver.unarchiveObject(with: data) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
// The cast function will return nil if the unarchived object doesn't
|
||||
// have the correct type
|
||||
return cast(color) // Converts Any to Self?
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Use the `cast` utility function when you want *non-final classes* to implement DatabaseValueConvertible. It avoids compiler errors that are not easy to deal with. Note that final classes and value types won't need it.
|
||||
|
||||
```swift
|
||||
// Workaround Swift inconvenience around factories methods of non-final classes
|
||||
func cast<T, U>(_ value: T) -> U? {
|
||||
return value as? U
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Add an SQLite Function or Operator
|
||||
|
||||
**When an SQLite [function](https://www.sqlite.org/lang_corefunc.html) or [operator](https://www.sqlite.org/lang_expr.html) is missing from GRDB**, this usually means that there hasn't been a [feature request](http://github.com/groue/GRDB.swift/issues) yet.
|
||||
|
||||
But you don't have to wait: you can extend GRDB and the query interface to add support for the missing syntax element (and eventually submit a pull request later).
|
||||
|
||||
Let's remind our goal: we'll add the [STRFTIME](https://www.sqlite.org/lang_datefunc.html) function, and the [GLOB](https://www.sqlite.org/lang_expr.html#like) operator.
|
||||
|
||||
Their SQL usage is the following:
|
||||
|
||||
```sql
|
||||
-- Publication years of books
|
||||
SELECT STRFTIME('%Y', publishedOn) FROM books;
|
||||
-- Books that talk about Moby Dick
|
||||
SELECT * FROM books WHERE body GLOB '*Moby-Dick*';
|
||||
```
|
||||
|
||||
Translated in the query interface, this gives:
|
||||
|
||||
```swift
|
||||
Books.select(strftime("%Y", Column("publishedDate")))
|
||||
Books.filter(Column("body").glob("*Moby-Dick*"))
|
||||
```
|
||||
|
||||
`strftime` is a top-level Swift function because this is how GRDB usually imports SQLite functions which do not have matching standard Swift counterpart, like AVG, LEGNTH, SUM. It helps the Swift code looking like SQL when it is relevant.
|
||||
|
||||
In the same fashion, we expose the GLOB SQL operator as the `glob` Swift method, just because `value.glob(pattern)` reads like `value GLOB pattern`.
|
||||
|
||||
Whenever you import a SQL feature to Swift, you'll have to decide: should you preserve the SQL look and feel, or adopt a well-established swiftism? It's really up to you.
|
||||
|
||||
|
||||
### STRFTIME
|
||||
|
||||
[**:fire: EXPERIMENTAL**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
||||
|
||||
The [STRFTIME](https://www.sqlite.org/lang_datefunc.html) SQL function accepts many arguments. We'll simplify it to `strftime(format, date)`, so that we can write:
|
||||
|
||||
```sql
|
||||
// Publication years of books
|
||||
// SELECT STRFTIME('%Y', publishedOn) FROM books
|
||||
Books.select(strftime("%Y", Column("publishedDate")))
|
||||
```
|
||||
|
||||
The signature of the Swift `strftime` function is:
|
||||
|
||||
```swift
|
||||
func strftime(_ format: String, _ date: SQLSpecificExpressible) -> SQLExpression
|
||||
```
|
||||
|
||||
SQLSpecificExpressible and SQLExpression are types of the [query interface](../../../#the-query-interface) that you do not usually see. We have moved down one floor, closer to the SQL guts of GRDB. We'll see more new types and protocols below.
|
||||
|
||||
The return value is SQLExpression. All GRDB functions and operators that build [query interface expressions](../../../#expressions) return values of this type. It represents actual [SQLite expressions](https://www.sqlite.org/lang_expr.html).
|
||||
|
||||
SQLExpression is a protocol, so that you can build your own [custom expressions](#add-a-new-kind-of-sqlite-expression). But GRDB ships with a variety of [built-in expressions](#built-in-expressions) that are ready-made, and here we'll use SQLExpressionFunction that is dedicated to function calls:
|
||||
|
||||
```swift
|
||||
struct SQLExpressionFunction : SQLExpression {
|
||||
/// Creates an SQL function call
|
||||
///
|
||||
/// // ABS(-1)
|
||||
/// SQLExpressionFunction(.abs, arguments: -1)
|
||||
init(_ functionName: SQLFunctionName, arguments: SQLExpressible...)
|
||||
}
|
||||
```
|
||||
|
||||
So here is the code that defines our `strftime` function:
|
||||
|
||||
```swift
|
||||
// Add a SQLFunctionName just like we add NSNotification.Name since
|
||||
// the release of Swift 3.
|
||||
extension SQLFunctionName {
|
||||
/// The `STRFTIME` SQL function
|
||||
static let strftime = SQLFunctionName("STRFTIME")
|
||||
}
|
||||
|
||||
/// Returns an expression that evaluates the `STRFTIME` SQL function.
|
||||
///
|
||||
/// // STRFTIME('%Y', date)
|
||||
/// strftime("%Y", Column("date"))
|
||||
func strftime(_ format: String, _ date: SQLSpecificExpressible) -> SQLExpression {
|
||||
return SQLExpressionFunction(.strftime, arguments: format, date)
|
||||
}
|
||||
```
|
||||
|
||||
The `strftime` function is now complete, ready to be used. We haven't yet described the SQLSpecificExpressible type of the `date` argument:
|
||||
|
||||
SQLSpecificExpressible is the protocol for all types that can be turned into a SQL expression, but types like Int, Date, or UIColor that exist outside of GRDB and the query interface. Having `strftime` accept a SQLSpecificExpressible date prevents it from polluting the global space. It is *specific* to GRDB:
|
||||
|
||||
```swift
|
||||
strftime("%Y", Date()) // Compiler error
|
||||
strftime("%Y", Column("date")) // SQLExpression: STRFTIME('%Y', date)
|
||||
```
|
||||
|
||||
You may want to compare it to another protocol, SQLExpressible, which will be described [below](#add-a-new-kind-of-sqlite-expression), when we add support for CAST SQL expressions.
|
||||
|
||||
> :point_up: **Note**: whenever you extend GRDB with a Swift function, method, or operator, you should generally make sure that its signature contains at least one GRDB-specific type. In the `strftime` function, it is the SQLSpecificExpressible protocol.
|
||||
|
||||
|
||||
### GLOB
|
||||
|
||||
[**:fire: EXPERIMENTAL**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
||||
|
||||
For the [GLOB](https://www.sqlite.org/lang_expr.html#like) operator, we want to define the glob Swift method:
|
||||
|
||||
```swift
|
||||
// Books that talk about Moby Dick
|
||||
// SELECT * FROM books WHERE body GLOB '*Moby-Dick*'
|
||||
Books.filter(Column("body").glob("*Moby-Dick*"))
|
||||
```
|
||||
|
||||
This time we can't use the SQLExpressionFunction type, because it can't generate the SQL for a binary operator. Instead, we'll use another [built-in expression](#built-in-expressions), SQLExpressionBinary:
|
||||
|
||||
```swift
|
||||
struct SQLExpressionBinary : SQLExpression {
|
||||
/// Creates an expression made of two expressions joined with a binary operator.
|
||||
///
|
||||
/// // length * width
|
||||
/// SQLExpressionBinary(.multiply, Column("length"), Column("width"))
|
||||
init(_ op: SQLBinaryOperator, _ lhs: SQLExpressible, _ rhs: SQLExpressible)
|
||||
}
|
||||
```
|
||||
|
||||
Now we have to find the signature of our Swift method. The GLOB operator accepts any value on both sides. However, what kind of Swift code should we accept?
|
||||
|
||||
```swift
|
||||
// 1) body GLOB '*Moby-Dick*' -- Yes, of course
|
||||
Column("body").glob("*Moby-Dick*")
|
||||
// 2) body GLOB pattern -- Sure, why not?
|
||||
Column("body").glob(Column("pattern"))
|
||||
// 3) 'Some Swift String' GLOB pattern - Not sure, but OK
|
||||
"Some Swift String".glob(Column("pattern"))
|
||||
// 4) 'Some Swift String' GLOB 'Another Swift String' -- NO
|
||||
"Some Swift String".glob("Another Swift String")
|
||||
```
|
||||
|
||||
We don't want the form 4, because this is an unacceptable pollution of the Swift global namespace. A good GRDB extension limits its scope to database-related code.
|
||||
|
||||
We thus have two overloaded definitions of the `glob` method:
|
||||
|
||||
```swift
|
||||
extension SQLSpecificExpressible {
|
||||
func glob(_ pattern: SQLExpressible) -> SQLExpression
|
||||
}
|
||||
extension SQLExpressible {
|
||||
func glob(_ pattern: SQLSpecificExpressible) -> SQLExpression
|
||||
}
|
||||
```
|
||||
|
||||
SQLExpressible is the protocol for all types that can be turned into a SQL expression. This includes all expressions, and all [value types](../../../#values) (including String).
|
||||
|
||||
SQLSpecificExpressible is a sub protocol of SQLExpressible protocol, restricted to all types that can be turned into a SQL expression, but types like Int, Date, or String that exist outside of GRDB and the query interface.
|
||||
|
||||
By extending both, we can define the GLOB operators for any pair that contains at least one type that is specific to GRDB - and leave the global Swift space clean.
|
||||
|
||||
The final implementation follows:
|
||||
|
||||
```swift
|
||||
// Add a SQLBinaryOperator just like we add NSNotification.Name since
|
||||
// the release of Swift 3.
|
||||
extension SQLBinaryOperator {
|
||||
/// The `GLOB` binary operator
|
||||
static let glob = SQLBinaryOperator("GLOB")
|
||||
}
|
||||
|
||||
extension SQLSpecificExpressible {
|
||||
/// Returns an SQL `GLOB` expression.
|
||||
///
|
||||
/// // body GLOB '*Moby-Dick*'
|
||||
/// Column("body").glob("*Moby-Dick*")
|
||||
func glob(_ pattern: SQLExpressible) -> SQLExpression {
|
||||
return SQLExpressionBinary(.glob, self, pattern)
|
||||
}
|
||||
}
|
||||
|
||||
extension SQLExpressible {
|
||||
/// Returns an SQL `GLOB` expression.
|
||||
///
|
||||
/// // 'Some Swift String' GLOB pattern
|
||||
/// "Some Swift String".glob(Column("pattern"))
|
||||
func glob(_ pattern: SQLSpecificExpressible) -> SQLExpression {
|
||||
return SQLExpressionBinary(.glob, self, pattern)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Built-in Expressions
|
||||
|
||||
When you extend GRDB with a new function, method, or operator that generates an [SQL expression](https://www.sqlite.org/lang_expr.html), you have to return a value the adopts the SQLExpression protocol.
|
||||
|
||||
We have already seen in our [previous](#strftime) [examples](#glob) two concrete types that generate SQL function calls and binary operators: SQLExpressionFunction and SQLExpressionBinary.
|
||||
|
||||
This section of the documentation lists all built-in expressions. Adding a custom SQLExpression type will be documented [below](#add-a-new-kind-of-sqlite-expression).
|
||||
|
||||
|
||||
#### Column and DatabaseValue
|
||||
|
||||
The [Column](../../../#the-query-interface) type from the query interface, and [DatabaseValue](../../../#databasevalue), the type that wraps the five values supported by SQLite (NULL, Int64, Double, String and Data) are expressions. They are rather trivial, and it is unlikely that you use them in your GRDB extensions.
|
||||
|
||||
|
||||
#### SQLExpressionLiteral
|
||||
|
||||
Use SQLExpressionLiteral when you need to go fast:
|
||||
|
||||
```swift
|
||||
struct SQLExpressionLiteral : SQLExpression {
|
||||
/// Creates an SQL literal expression.
|
||||
///
|
||||
/// SQLExpressionLiteral("1 + 2")
|
||||
/// SQLExpressionLiteral("? + ?", arguments: [1, 2])
|
||||
init(_ sql: String, arguments: StatementArguments? = nil)
|
||||
}
|
||||
```
|
||||
|
||||
For an example of use, see the [Add a new kind of SQLite expression](#add-a-new-kind-of-sqlite-expression) chapter.
|
||||
|
||||
|
||||
#### SQLExpressionUnary
|
||||
|
||||
[**:fire: EXPERIMENTAL**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
||||
|
||||
SQLExpressionUnary builds an expression by prefixing another expression with an unary operator:
|
||||
|
||||
```swift
|
||||
struct SQLExpressionUnary : SQLExpression {
|
||||
/// Creates an expression made of an unary operator and
|
||||
/// an operand expression.
|
||||
///
|
||||
/// // NOT favorite
|
||||
/// SQLExpressionUnary(.not, Column("favorite"))
|
||||
init(_ op: SQLUnaryOperator, _ value: SQLExpressible)
|
||||
}
|
||||
```
|
||||
|
||||
You add missing SQLite unary operators by extending SQLUnaryOperator:
|
||||
|
||||
```swift
|
||||
extension SQLUnaryOperator {
|
||||
/// The `+` unary operator
|
||||
static let plus = SQLUnaryOperator("+", needsRightSpace: false)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### SQLExpressionBinary
|
||||
|
||||
[**:fire: EXPERIMENTAL**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
||||
|
||||
SQLExpressionBinary builds an expression by joining two expressions with a binary operator:
|
||||
|
||||
```swift
|
||||
struct SQLExpressionBinary : SQLExpression {
|
||||
/// Creates an expression made of two expressions joined with a binary operator.
|
||||
///
|
||||
/// // length * width
|
||||
/// SQLExpressionBinary(.multiply, Column("length"), Column("width"))
|
||||
init(_ op: SQLBinaryOperator, _ lhs: SQLExpressible, _ rhs: SQLExpressible)
|
||||
}
|
||||
```
|
||||
|
||||
You add missing SQLite binary operators by extending SQLBinaryOperator:
|
||||
|
||||
```swift
|
||||
extension SQLBinaryOperator {
|
||||
/// The `GLOB` binary operator
|
||||
static let glob = SQLBinaryOperator("GLOB")
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### SQLExpressionFunction
|
||||
|
||||
[**:fire: EXPERIMENTAL**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
||||
|
||||
SQLExpressionFunction builds an SQL function call:
|
||||
|
||||
```swift
|
||||
struct SQLExpressionFunction : SQLExpression {
|
||||
/// Creates an SQL function call
|
||||
///
|
||||
/// // ABS(-1)
|
||||
/// SQLExpressionFunction(.abs, arguments: -1)
|
||||
init(_ functionName: SQLFunctionName, arguments: SQLExpressible...)
|
||||
}
|
||||
```
|
||||
|
||||
You add missing SQLite function names by extending SQLFunctionName:
|
||||
|
||||
```swift
|
||||
extension SQLFunctionName {
|
||||
/// The `STRFTIME` SQL function
|
||||
static let strftime = SQLFunctionName("STRFTIME")
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### The IN Operator
|
||||
|
||||
Build a `value IN (...)` expression from any sequence of [values](../../../#values):
|
||||
|
||||
```swift
|
||||
// SQLExpression: id IN (1, 2, 3)
|
||||
[1,2,3].contains(Column("id"))
|
||||
|
||||
// SQLExpression: id NOT IN (1, 2, 3)
|
||||
![1,2,3].contains(Column("id"))
|
||||
```
|
||||
|
||||
|
||||
#### The BETWEEN Operator
|
||||
|
||||
Build a `value BETWEEN min AND max` expression from Swift ranges:
|
||||
|
||||
```swift
|
||||
// SQLExpression: id BETWEEN 1 AND 10
|
||||
1...10.contains(Column("id")
|
||||
```
|
||||
|
||||
|
||||
#### The COUNT Function
|
||||
|
||||
Build a `COUNT(...)` expression from the [count](http://groue.github.io/GRDB.swift/docs/2.0/Functions.html) and [count(distinct:)](http://groue.github.io/GRDB.swift/docs/2.0/Functions.html) functions:
|
||||
|
||||
```swift
|
||||
// SQLExpression: COUNT(email)
|
||||
count(Column("email"))
|
||||
|
||||
// SQLExpression: COUNT(DISTINCT email)
|
||||
count(distinct: Column("email"))
|
||||
```
|
||||
|
||||
|
||||
#### The COLLATE Operator
|
||||
|
||||
Build a `expression COLLATE collation` expression with the `collating` method:
|
||||
|
||||
```swift
|
||||
// SQLExpression: name = 'Arthur' COLLATE NOCASE
|
||||
Column("name").collating(.nocase) == "Arthur"
|
||||
```
|
||||
|
||||
|
||||
## Add a New Kind of SQLite Expression
|
||||
|
||||
GRDB does not have built-in support for the full range of the SQLite [expression grammar](https://www.sqlite.org/lang_expr.html).
|
||||
|
||||
For example, [CAST expressions](https://www.sqlite.org/lang_expr.html#castexpr) are not ready-made. They can be useful, though: a CAST expression can efficiently convert json strings to UTF-8 data blobs for you:
|
||||
|
||||
```sql
|
||||
SELECT CAST(jsonString AS BLOB) FROM books
|
||||
```
|
||||
|
||||
We'll add below a Swift `cast` function:
|
||||
|
||||
```swift
|
||||
let request = Books.select(cast(Column("jsonString"), as: .blob))
|
||||
let jsonDatas = try Data.fetchAll(db, request) // [Data]
|
||||
```
|
||||
|
||||
`cast` is a top-level Swift function because this is how GRDB usually imports SQLite features which do not have matching standard Swift counterpart. It helps the Swift code looking like SQL when it is relevant. But YMMV.
|
||||
|
||||
The signature of the `cast` function is:
|
||||
|
||||
```swift
|
||||
func cast(_ value: SQLExpressible, as type: Database.ColumnType) -> SQLExpression
|
||||
```
|
||||
|
||||
Database.ColumnType is a String-based enumeration of all database column types (.integer, .text, .blob, etc.) You have already used if you have [created tables](../../../#create-tables) using the query interface.
|
||||
|
||||
The return type SQLExpression is the type returned by all GRDB functions and operators that build [query interface expressions](../../../#expressions).
|
||||
|
||||
SQLExpression is a protocol. But GRDB ships with a variety of [built-in expressions](#built-in-expressions) that are ready-made, so that you generally don't have to write your custom expression type. Here we need something new. So we'll use the most versatile of all, SQLExpressionLiteral:
|
||||
|
||||
```swift
|
||||
struct SQLExpressionLiteral : SQLExpression {
|
||||
/// Creates an SQL literal expression.
|
||||
///
|
||||
/// SQLExpressionLiteral("1 + 2")
|
||||
/// SQLExpressionLiteral("? + ?", arguments: [1, 2])
|
||||
init(_ sql: String, arguments: StatementArguments? = nil)
|
||||
}
|
||||
```
|
||||
|
||||
Here is the code that defines our `cast` function:
|
||||
|
||||
|
||||
```swift
|
||||
func cast(_ value: SQLExpressible, as type: Database.ColumnType) -> SQLExpression {
|
||||
// Turn the value into a literal expression
|
||||
let literal: SQLExpressionLiteral = value.sqlExpression.literal
|
||||
|
||||
// Build our "CAST(value AS type)" sql snippet
|
||||
let sql = "CAST(\(literal.sql) AS \(type.rawValue))"
|
||||
|
||||
// And return a new literal expression, preserving input arguments
|
||||
return SQLExpressionLiteral(sql, arguments: literal.arguments)
|
||||
}
|
||||
```
|
||||
|
||||
We haven't yet described the SQLExpressible type of the `value` argument:
|
||||
|
||||
SQLExpressible is the protocol for all types that can be turned into a SQL expression. This includes all [value types](../../../#values) (Bool, Int, String, Date, Swift enums, etc.):
|
||||
|
||||
```swift
|
||||
cast("foo", as: .blob) // SQLExpression: CAST('foo' AS BLOB)
|
||||
cast(Column("name"), as: .blob) // SQLExpression: CAST(name AS BLOB)
|
||||
```
|
||||
|
||||
You may want to compare it to another protocol, SQLSpecificExpressible, which has been described [above](#strftime), when we were adding support for the STRFTIME SQL function.
|
||||
|
||||
> :point_up: **Note**: whenever you extend GRDB with a Swift function, method, or operator, you should generally make sure that its signature contains at least one GRDB-specific type. In the `cast` function, it is Database.ColumnType.
|
||||
|
||||
**If SQLExpressionLiteral reveals too limited for your purpose**, you may have to implement a new type that adopts the [SQLExpression](http://groue.github.io/GRDB.swift/docs/2.0/Protocols/SQLExpression.html) protocol.
|
||||
@@ -0,0 +1,389 @@
|
||||
FTS5 Tokenizers
|
||||
===============
|
||||
|
||||
**[FTS5](https://www.sqlite.org/fts5.html) is an extensible full-text search engine.**
|
||||
|
||||
GRDB lets you define your own custom FST5 tokenizers, and extend SQLite built-in tokenizers. Possible use cases are:
|
||||
|
||||
- Have "fi" match the ligature "fi" (U+FB01)
|
||||
- Have "first" match "1st"
|
||||
- Have "Encyclopaedia" match "Encyclopædia"
|
||||
- Have "Mueller" match "Müller", and "Grossmann" match "Großmann"
|
||||
- Have "romaji" match "ローマ字", and "pinyin" match "拼音"
|
||||
- Prevent "the" and other stop words from matching any document
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
- [Tokenizers and Full-Text Search](#tokenizers-and-full-text-search)
|
||||
- [The Tokenizer Protocols](#the-tokenizer-protocols)
|
||||
- [Using a Custom Tokenizer](#using-a-custom-tokenizer)
|
||||
- [FTS5Tokenizer](#fts5tokenizer)
|
||||
- [FTS5CustomTokenizer](#fts5customtokenizer)
|
||||
- [FTS5WrapperTokenizer](#fts5wrappertokenizer)
|
||||
- [Choosing the Wrapped Tokenizer](#choosing-the-wrapped-tokenizer)
|
||||
- [Example: Synonyms](#example-synonyms)
|
||||
- [Example: Latin Script](#example-latin-script)
|
||||
|
||||
|
||||
## Tokenizers and Full-Text Search
|
||||
|
||||
**A Tokenizer splits text into tokens**. For example, a tokenizer can split "SQLite is a database engine" into the five tokens "SQLite", "is", "a", "database", and "engine".
|
||||
|
||||
FTS5 use tokenizers to tokenize both indexed documents and search patterns. **A match between a document and a search pattern happens when both produce *identical* tokens.**
|
||||
|
||||
All SQLite [built-in tokenizers](https://www.sqlite.org/fts5.html#tokenizers) tokenize both "SQLite" and "sqlite" into the common lowercase token "sqlite". This is why they are case-insensitive. Generally speaking, different tokenizers achieve different matching by applying different transformations to the input text.
|
||||
|
||||
- The [ascii](https://www.sqlite.org/fts5.html#ascii_tokenizer) tokenizer turns all ASCII characters to lowercase. "SQLite is a database engine" gives "sqlite", "is", "a", "database", and "engine". The query "SQLITE DATABASE" will match, because its tokens "sqlite" and "database" are found in the document.
|
||||
|
||||
- The [unicode61](https://www.sqlite.org/fts5.html#unicode61_tokenizer) tokenizer remove diacritics from latin characters. Unlike the ascii tokenizer, it will match "Jérôme" with "Jerome", as both produce the same "jerome" token.
|
||||
|
||||
- The [porter](https://www.sqlite.org/fts5.html#porter_tokenizer) tokenizer turns English words into their root: "database engine" gives the "databas" and "engin" tokens. The query "database engines" will match, because it produces the same tokens.
|
||||
|
||||
However, built-in tokenizers don't match "first" with "1st", because they produce the different "first" and "1st" tokens.
|
||||
|
||||
Nor do they match "Grossmann" with "Großmann", because they produce the different "grossmann" and "großmann" tokens.
|
||||
|
||||
Custom tokenizers help dealing with these situations. We'll see how to match "Grossmann" and "Großmann" by tokenizing them into "grossmann" (see [latin script](#example-latin-script)). We'll also see how to have "first" and "1st" emit *synonym tokens*, so that they can match too (see [synonyms](#example-synonyms)).
|
||||
|
||||
|
||||
## The Tokenizer Protocols
|
||||
|
||||
GRDB lets you use and define FTS5 tokenizers through three protocols:
|
||||
|
||||
- [FTS5Tokenizer](#fts5tokenizer): the protocol for all FTS5 tokenizers, including the [built-in tokenizers](https://www.sqlite.org/fts5.html#tokenizers) ascii, unicode61, and porter.
|
||||
|
||||
- [FTS5CustomTokenizer](#fts5customtokenizer): the low-level protocol that lets custom tokenizers use the raw [FTS5 C API](https://www.sqlite.org/fts5.html#custom_tokenizers).
|
||||
|
||||
- [FTS5WrapperTokenizer](#fts5wrappertokenizer): the high-level protocol for custom tokenizers that post-processes the tokens produced by another FTS5Tokenizer.
|
||||
|
||||
|
||||
## Using a Custom Tokenizer
|
||||
|
||||
Once you have a custom tokenizer type that adopts [FTS5CustomTokenizer](#fts5customtokenizer) or [FTS5WrapperTokenizer](#fts5wrappertokenizer), it can fuel the FTS5 engine.
|
||||
|
||||
**Register the custom tokenizer into the database:**
|
||||
|
||||
```swift
|
||||
class MyTokenizer : FTS5CustomTokenizer { ... }
|
||||
|
||||
dbQueue.add(tokenizer: MyTokenizer.self) // or dbPool.add
|
||||
```
|
||||
|
||||
**Create [full-text tables](../../../#create-fts5-virtual-tables) that use the custom tokenizer:**
|
||||
|
||||
```swift
|
||||
try db.create(virtualTable: "documents", using: FTS5()) { t in
|
||||
t.tokenizer = MyTokenizer.tokenizerDescriptor()
|
||||
t.column("content")
|
||||
}
|
||||
```
|
||||
|
||||
The full-text table can be fed and queried in [a regular way](../../../#full-text-search):
|
||||
|
||||
```swift
|
||||
try db.execute("INSERT INTO documents VALUES (?)", arguments: ["..."])
|
||||
try Document(content: "...").insert(db)
|
||||
|
||||
let pattern = FTS5Pattern(matchingAnyTokenIn:"...")
|
||||
let documents = try Document.matching(pattern).fetchAll(db)
|
||||
```
|
||||
|
||||
|
||||
## FTS5Tokenizer
|
||||
|
||||
**FST5Tokenizer** is the protocol for all FTS5 tokenizers.
|
||||
|
||||
It only requires a tokenization method that matches the low-level `xTokenize` C function documented at https://www.sqlite.org/fts5.html#custom_tokenizers. We'll discuss it more when describing custom tokenizers.
|
||||
|
||||
```swift
|
||||
typealias FTS5TokenCallback = @convention(c) (
|
||||
_ context: UnsafeMutableRawPointer?,
|
||||
_ flags: Int32,
|
||||
_ pToken: UnsafePointer<Int8>?,
|
||||
_ nToken: Int32,
|
||||
_ iStart: Int32,
|
||||
_ iEnd: Int32) -> Int32
|
||||
|
||||
protocol FTS5Tokenizer : class {
|
||||
func tokenize(
|
||||
context: UnsafeMutableRawPointer?,
|
||||
tokenization: FTS5Tokenization,
|
||||
pText: UnsafePointer<Int8>?,
|
||||
nText: Int32,
|
||||
tokenCallback: FTS5TokenCallback?) -> Int32
|
||||
}
|
||||
```
|
||||
|
||||
You can instantiate tokenizers, including [built-in tokenizers](https://www.sqlite.org/fts5.html#tokenizers), with the `Database.makeTokenizer()` method:
|
||||
|
||||
```swift
|
||||
let unicode61 = try db.makeTokenizer(.unicode61()) // FTS5Tokenizer
|
||||
```
|
||||
|
||||
|
||||
## FTS5CustomTokenizer
|
||||
|
||||
**FTS5CustomTokenizer** is the low-level protocol for your custom tokenizers.
|
||||
|
||||
```swift
|
||||
protocol FTS5CustomTokenizer : FTS5Tokenizer {
|
||||
static var name: String { get }
|
||||
init(db: Database, arguments: [String]) throws
|
||||
}
|
||||
```
|
||||
|
||||
Custom tokenizers have a name, like built-in tokenizers have a name. Don't use "ascii", "porter", or "unicode61" since they are already taken!
|
||||
|
||||
```swift
|
||||
final class MyTokenizer : FTS5CustomTokenizer {
|
||||
static let name = "custom"
|
||||
}
|
||||
```
|
||||
|
||||
SQLite instantiates tokenizers when it needs tokens. The arguments parameter of the `init(db:arguments:)` initializer is an array of strings, which your custom tokenizer can use for its own purposes. In the example below, the arguments will be `["arg1", "arg2"]`.
|
||||
|
||||
```swift
|
||||
// CREATE VIRTUAL TABLE documents USING fts5(
|
||||
// tokenize='custom arg1 arg2',
|
||||
// authors, title, body
|
||||
// )
|
||||
try db.create(virtualTable: "documents", using: FTS5()) { t in
|
||||
t.tokenizer = MyTokenizer.tokenizerDescriptor(arguments: ["arg1", "arg2"])
|
||||
t.column("authors")
|
||||
t.column("title")
|
||||
t.column("body")
|
||||
}
|
||||
```
|
||||
|
||||
FTS5CustomTokenizer inherits from [FTS5Tokenizer](#fts5tokenizer), and performs tokenization with its `tokenize(context:tokenization:pText:nText:tokenCallback:)` method. This low-level method matches the `xTokenize` C function documented at https://www.sqlite.org/fts5.html#custom_tokenizers.
|
||||
|
||||
This method arguments are:
|
||||
|
||||
- `context`: An opaque pointer that is the first argument to the `tokenCallback` function
|
||||
- `tokenization`: The reason why FTS5 is requesting tokenization.
|
||||
- `pText`: The tokenized text bytes. May or may not be nul-terminated.
|
||||
- `nText`: The number of bytes in the tokenized text.
|
||||
- `tokenCallback`: The function to call for each found token. It matches the `xToken` callback at https://www.sqlite.org/fts5.html#custom_tokenizers:
|
||||
- `context`: An opaque pointer
|
||||
- `flags`: Flags that tell FTS5 how to register the token
|
||||
- `pToken`: The token bytes. May or may not be nul-terminated.
|
||||
- `nToken`: The number of bytes in the token
|
||||
- `iStart`: Byte offset of token within input text
|
||||
- `iEnd`: Byte offset of end of token within input text
|
||||
|
||||
Since tokenization is hard, and pointers to byte buffers uneasy to deal with, you may enjoy the [FTS5WrapperTokenizer](#fts5wrappertokenizer) protocol.
|
||||
|
||||
|
||||
## FTS5WrapperTokenizer
|
||||
|
||||
**FTS5WrapperTokenizer** is the high-level protocol for your custom tokenizers. It provides a default implementation for the low-level `tokenize(context:tokenization:pText:nText:tokenCallback:)` method, so that the adopting type does not have to deal with raw byte buffers of the raw [FTS5 C API](https://www.sqlite.org/fts5.html#custom_tokenizers).
|
||||
|
||||
A FTS5WrapperTokenizer lets the hard tokenization job to another tokenizer, the "wrapped tokenizer", and post-processes the tokens produced by this wrapped tokenizer.
|
||||
|
||||
```swift
|
||||
protocol FTS5WrapperTokenizer : FTS5CustomTokenizer {
|
||||
var wrappedTokenizer: FTS5Tokenizer { get }
|
||||
func accept(
|
||||
token: String,
|
||||
flags: FTS5TokenFlags,
|
||||
for tokenization: FTS5Tokenization,
|
||||
tokenCallback: FTS5WrapperTokenCallback) throws
|
||||
}
|
||||
```
|
||||
|
||||
As all custom tokenizers, wrapper tokenizers must have a name:
|
||||
|
||||
```swift
|
||||
final class MyTokenizer : FTS5WrapperTokenizer {
|
||||
static let name = "custom"
|
||||
}
|
||||
```
|
||||
|
||||
The `wrappedTokenizer` property is the mandatory wrapped tokenizer. You instantiate it once, in the initializer:
|
||||
|
||||
```swift
|
||||
final class MyTokenizer : FTS5WrapperTokenizer {
|
||||
let wrappedTokenizer: FTS5Tokenizer
|
||||
|
||||
init(db: Database, arguments: [String]) throws {
|
||||
// Wrap the unicode61 tokenizer
|
||||
wrappedTokenizer = try db.makeTokenizer(.unicode61())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Wrapper tokenizers have to implement the `accept(token:flags:for:tokenCallback:)` method.
|
||||
|
||||
For example, a tokenizer that simply passes tokens through gives:
|
||||
|
||||
```swift
|
||||
final class MyTokenizer : FTS5WrapperTokenizer {
|
||||
func accept(
|
||||
token: String,
|
||||
flags: FTS5TokenFlags,
|
||||
for tokenization: FTS5Tokenization,
|
||||
tokenCallback: FTS5WrapperTokenCallback) throws
|
||||
{
|
||||
// pass through
|
||||
try tokenCallback(token, flags)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The token argument is a token produced by the wrapped tokenizer, ready to be ignored, modified, or multiplied into several [synonyms](#example-synonyms).
|
||||
|
||||
The tokenization parameter tells the reason why tokens are produced, if FTS5 is tokenizing a document, or a search pattern. Some tokenizers may produce different tokens depending on this parameter.
|
||||
|
||||
Finally, the tokenCallback is a function you call to output a custom token.
|
||||
|
||||
There are a two rules to observe when implementing the accept method:
|
||||
|
||||
1. Errors thrown by the tokenCallback function must not be caught (they notify that FTS5 requires the tokenization process to stop immediately).
|
||||
2. The flags parameter should be given unmodified to the tokenCallback function along with the custom token, unless you union it with the `.colocated` flag when the tokenizer produces [synonyms](#example-synonyms).
|
||||
|
||||
|
||||
### Choosing the Wrapped Tokenizer
|
||||
|
||||
The wrapped tokenizer can be hard-coded, or chosen at runtime.
|
||||
|
||||
For example, your custom tokenizer can wrap [unicode61](https://www.sqlite.org/fts5.html#unicode61_tokenizer), unless arguments say otherwise (in a fashion similar to the [porter](https://www.sqlite.org/fts5.html#porter_tokenizer) tokenizer):
|
||||
|
||||
```swift
|
||||
final class MyTokenizer : FTS5WrapperTokenizer {
|
||||
static let name = "custom"
|
||||
let wrappedTokenizer: FTS5Tokenizer
|
||||
|
||||
init(db: Database, arguments: [String]) throws {
|
||||
if arguments.isEmpty {
|
||||
wrappedTokenizer = try db.makeTokenizer(.unicode61())
|
||||
} else {
|
||||
let descriptor = FTS5TokenizerDescriptor(components: arguments)
|
||||
wrappedTokenizer = try db.makeTokenizer(descriptor)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Arguments are provided when the virtual table is created:
|
||||
|
||||
```swift
|
||||
// CREATE VIRTUAL TABLE documents USING fts5(
|
||||
// tokenize='custom',
|
||||
// content
|
||||
// )
|
||||
try db.create(virtualTable: "documents", using: FTS5()) { t in
|
||||
// Wraps the default unicode61
|
||||
t.tokenizer = MyTokenizer.tokenizerDescriptor()
|
||||
t.column("content")
|
||||
}
|
||||
|
||||
// CREATE VIRTUAL TABLE documents USING fts5(
|
||||
// tokenize='custom ascii'
|
||||
// content
|
||||
// )
|
||||
try db.create(virtualTable: "documents", using: FTS5()) { t in
|
||||
// Wraps ascii
|
||||
let ascii = FTS5TokenizerDescriptor.ascii()
|
||||
t.tokenizer = MyTokenizer.tokenizerDescriptor(arguments: ascii.components)
|
||||
t.column("content")
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Example: Synonyms
|
||||
|
||||
**FTS5 lets tokenizers produce synonyms**, so that, for example, "first" can match "1st".
|
||||
|
||||
The topic of synonyms is documented at https://www.sqlite.org/fts5.html#synonym_support, which describes several methods. You should carefully read this documentation, and pick the method you prefer.
|
||||
|
||||
In the example below, we'll pick method (3), and implement a tokenizer that adds multiple synonyms for a single term to the FTS index. Using this method, when tokenizing document text, the tokenizer provides multiple synonyms for each token. So that when a document such as "I won first place" is tokenized, entries are added to the FTS index for "i", "won", "first", "1st" and "place".
|
||||
|
||||
We'll also take care of the SQLite advice:
|
||||
|
||||
> When using methods (2) or (3), it is important that the tokenizer only provide synonyms when tokenizing document text or query text, not both. Doing so will not cause any errors, but is inefficient.
|
||||
|
||||
```swift
|
||||
final class SynonymsTokenizer : FTS5WrapperTokenizer {
|
||||
static let name = "synonyms"
|
||||
let wrappedTokenizer: FTS5Tokenizer
|
||||
let synonyms: [Set<String>] = [["first", "1st"]]
|
||||
|
||||
init(db: Database, arguments: [String]) throws {
|
||||
wrappedTokenizer = try db.makeTokenizer(.unicode61())
|
||||
}
|
||||
|
||||
func synonyms(for token: String) -> Set<String>? {
|
||||
return synonyms.first { $0.contains(token) }
|
||||
}
|
||||
|
||||
func accept(token: String, flags: FTS5TokenFlags, for tokenization: FTS5Tokenization, tokenCallback: FTS5WrapperTokenCallback) throws {
|
||||
if tokenization.contains(.query) {
|
||||
// Don't look for synonyms when tokenizing queries
|
||||
try tokenCallback(token, flags)
|
||||
return
|
||||
}
|
||||
|
||||
guard let synonyms = synonyms(for: token) else {
|
||||
// Token has no synonym
|
||||
try tokenCallback(token, flags)
|
||||
return
|
||||
}
|
||||
|
||||
for (index, synonym) in synonyms.enumerated() {
|
||||
// Notify each synonym, and set the colocated flag for all but the first
|
||||
let synonymFlags = (index == 0) ? flags : flags.union(.colocated)
|
||||
try tokenCallback(synonym, synonymFlags)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Example: Latin Script
|
||||
|
||||
Languages that use the [latin script](https://en.wikipedia.org/wiki/Latin_script) offer a rich set of typographical, historical, and local features such as diacritics, ligatures, and dotless I: Großmann, fidélité (with the ligature "fi" U+FB01), Diyarbakır.
|
||||
|
||||
Full-text search in such a corpus often needs input tolerance, so that "encyclopaedia" can match "Encyclopædia", "Grossmann", "Großmann", and "Jerome", "Jérôme".
|
||||
|
||||
German has something specific in that both "Mueller" and "Muller" should match "Müller", when "Bauer" should not match "Baur" (only "ü" accepts both "u" and "ue"). A pull request that adds a chapter about German will be welcome.
|
||||
|
||||
A custom FTS5 tokenizer lets you provide fuzzy latin matching: after "Grossmann", "Großmann", and "GROSSMANN" have all been turned into "grossmann", they will all match together.
|
||||
|
||||
We'll wrap the built-in [unicode61](https://www.sqlite.org/fts5.html#unicode61_tokenizer) tokenizer (the one that knows how to split text on spaces and punctuations), and transform its tokens into their bare lowercase ascii form.
|
||||
|
||||
The tokenizer wrapping is provided by the [FTS5WrapperTokenizer](#fts5wrappertokenizer) protocol. The string transformation is provided by the [String.applyingTransform](https://developer.apple.com/reference/swift/string/1643133-applyingtransform) method:
|
||||
|
||||
```swift
|
||||
final class LatinAsciiTokenizer : FTS5WrapperTokenizer {
|
||||
static let name = "latinascii"
|
||||
let wrappedTokenizer: FTS5Tokenizer
|
||||
|
||||
init(db: Database, arguments: [String]) throws {
|
||||
wrappedTokenizer = try db.makeTokenizer(.unicode61())
|
||||
}
|
||||
|
||||
func accept(token: String, flags: FTS5TokenFlags, for tokenization: FTS5Tokenization, tokenCallback: FTS5WrapperTokenCallback) throws {
|
||||
if let token = token.applyingTransform(StringTransform("Latin-ASCII; Lower"), reverse: false) {
|
||||
try tokenCallback(token, flags)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> :point_up: **Note**: String.applyingTransform is not available before iOS 9.0 and macOS 10.11. Use the Core Foundation function [CFStringTransform](https://developer.apple.com/reference/corefoundation/1542411-cfstringtransform) instead.
|
||||
|
||||
Remember to register LatinAsciiTokenizer before using it:
|
||||
|
||||
```swift
|
||||
dbQueue.add(tokenizer: LatinAsciiTokenizer.self) // or dbPool.add
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
try db.create(virtualTable: "documents", using: FTS5()) { t in
|
||||
t.tokenizer = LatinAsciiTokenizer.tokenizerDescriptor()
|
||||
t.column("authors")
|
||||
t.column("title")
|
||||
t.column("body")
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
The main documentation is available in [README.md](../../../#documentation).
|
||||
@@ -0,0 +1,32 @@
|
||||
Release Process
|
||||
===============
|
||||
|
||||
**This is internal documentation.**
|
||||
|
||||
To release a new GRDB version:
|
||||
|
||||
- Tests
|
||||
- `make test`
|
||||
- Build and run GRDBDemoiOS in Release configuration on a device
|
||||
- Archive GRDBDemoiOS
|
||||
- Check for performance regression with GRDBOSXPerformanceTests
|
||||
- On https://github.com/groue/sqlcipher.git upgrade, update SQLCipher version in README.md
|
||||
- On https://github.com/swiftlyfalling/SQLiteLib upgrade, update SQLite version in README.md and Documentation/CustomSQLiteBuilds.md
|
||||
- Update GRDB version number and release date in:
|
||||
- Makefile
|
||||
- CHANGELOG.md
|
||||
- Documentation/CustomSQLiteBuilds.md
|
||||
- Documentation/ExtendingGRDB.md
|
||||
- GRDB.swift.podspec
|
||||
- GRDBCipher.podspec
|
||||
- README.md
|
||||
- Support/Info.plist
|
||||
- Commit and tag
|
||||
- Check tag authors: `git for-each-ref --format '%(refname) %(authorname)' refs/tags`
|
||||
- Push to the master branch
|
||||
- Push to the Swift3 branch
|
||||
- `pod trunk push --allow-warnings GRDB.swift.podspec`
|
||||
- `pod trunk push --allow-warnings GRDBCipher.podspec`
|
||||
- `make doc`, and update index.html in the `gh-pages` branch
|
||||
- Update http://github.com/groue/GRDBDemo
|
||||
- Update http://github.com/groue/WWDCCompanion
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
github "groue/GRDB.swift" "master"
|
||||
@@ -1,542 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
5673743C1B4D46600089DE44 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5673743B1B4D46600089DE44 /* AppDelegate.swift */; };
|
||||
5673743E1B4D46600089DE44 /* MasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5673743D1B4D46600089DE44 /* MasterViewController.swift */; };
|
||||
567374401B4D46600089DE44 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5673743F1B4D46600089DE44 /* DetailViewController.swift */; };
|
||||
567374431B4D46600089DE44 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 567374411B4D46600089DE44 /* Main.storyboard */; };
|
||||
567374451B4D46600089DE44 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 567374441B4D46600089DE44 /* Assets.xcassets */; };
|
||||
567374481B4D46600089DE44 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 567374461B4D46600089DE44 /* LaunchScreen.storyboard */; };
|
||||
567374531B4D46600089DE44 /* iOSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567374521B4D46600089DE44 /* iOSTests.swift */; };
|
||||
5673745E1B4D46600089DE44 /* iOSUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5673745D1B4D46600089DE44 /* iOSUITests.swift */; };
|
||||
567374701B4D48AB0089DE44 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5673746F1B4D48AB0089DE44 /* Person.swift */; };
|
||||
567374731B4D7A2E0089DE44 /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 567374721B4D7A2E0089DE44 /* GRDB.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
5673744F1B4D46600089DE44 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 567374301B4D46600089DE44 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 567374371B4D46600089DE44;
|
||||
remoteInfo = iOS;
|
||||
};
|
||||
5673745A1B4D46600089DE44 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 567374301B4D46600089DE44 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 567374371B4D46600089DE44;
|
||||
remoteInfo = iOS;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
567374381B4D46600089DE44 /* iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
5673743B1B4D46600089DE44 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
5673743D1B4D46600089DE44 /* MasterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterViewController.swift; sourceTree = "<group>"; };
|
||||
5673743F1B4D46600089DE44 /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; };
|
||||
567374421B4D46600089DE44 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
567374441B4D46600089DE44 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
567374471B4D46600089DE44 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
567374491B4D46600089DE44 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
5673744E1B4D46600089DE44 /* iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iOSTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
567374521B4D46600089DE44 /* iOSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSTests.swift; sourceTree = "<group>"; };
|
||||
567374541B4D46600089DE44 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
567374591B4D46600089DE44 /* iOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iOSUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
5673745D1B4D46600089DE44 /* iOSUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSUITests.swift; sourceTree = "<group>"; };
|
||||
5673745F1B4D46600089DE44 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
5673746F1B4D48AB0089DE44 /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = "<group>"; };
|
||||
567374721B4D7A2E0089DE44 /* GRDB.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GRDB.framework; path = ../Carthage/Build/iOS/GRDB.framework; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
567374351B4D46600089DE44 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
567374731B4D7A2E0089DE44 /* GRDB.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
5673744B1B4D46600089DE44 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
567374561B4D46600089DE44 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
5673742F1B4D46600089DE44 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
567374721B4D7A2E0089DE44 /* GRDB.framework */,
|
||||
5673743A1B4D46600089DE44 /* iOS */,
|
||||
567374511B4D46600089DE44 /* iOSTests */,
|
||||
5673745C1B4D46600089DE44 /* iOSUITests */,
|
||||
567374391B4D46600089DE44 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
567374391B4D46600089DE44 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
567374381B4D46600089DE44 /* iOS.app */,
|
||||
5673744E1B4D46600089DE44 /* iOSTests.xctest */,
|
||||
567374591B4D46600089DE44 /* iOSUITests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5673743A1B4D46600089DE44 /* iOS */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5673743B1B4D46600089DE44 /* AppDelegate.swift */,
|
||||
5673743D1B4D46600089DE44 /* MasterViewController.swift */,
|
||||
5673743F1B4D46600089DE44 /* DetailViewController.swift */,
|
||||
5673746F1B4D48AB0089DE44 /* Person.swift */,
|
||||
567374411B4D46600089DE44 /* Main.storyboard */,
|
||||
567374441B4D46600089DE44 /* Assets.xcassets */,
|
||||
567374461B4D46600089DE44 /* LaunchScreen.storyboard */,
|
||||
567374491B4D46600089DE44 /* Info.plist */,
|
||||
);
|
||||
path = iOS;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
567374511B4D46600089DE44 /* iOSTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
567374521B4D46600089DE44 /* iOSTests.swift */,
|
||||
567374541B4D46600089DE44 /* Info.plist */,
|
||||
);
|
||||
path = iOSTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5673745C1B4D46600089DE44 /* iOSUITests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5673745D1B4D46600089DE44 /* iOSUITests.swift */,
|
||||
5673745F1B4D46600089DE44 /* Info.plist */,
|
||||
);
|
||||
path = iOSUITests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
567374371B4D46600089DE44 /* iOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 567374621B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOS" */;
|
||||
buildPhases = (
|
||||
567374341B4D46600089DE44 /* Sources */,
|
||||
567374351B4D46600089DE44 /* Frameworks */,
|
||||
567374361B4D46600089DE44 /* Resources */,
|
||||
567374741B4D7A3B0089DE44 /* ShellScript */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = iOS;
|
||||
productName = iOS;
|
||||
productReference = 567374381B4D46600089DE44 /* iOS.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
5673744D1B4D46600089DE44 /* iOSTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 567374651B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOSTests" */;
|
||||
buildPhases = (
|
||||
5673744A1B4D46600089DE44 /* Sources */,
|
||||
5673744B1B4D46600089DE44 /* Frameworks */,
|
||||
5673744C1B4D46600089DE44 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
567374501B4D46600089DE44 /* PBXTargetDependency */,
|
||||
);
|
||||
name = iOSTests;
|
||||
productName = iOSTests;
|
||||
productReference = 5673744E1B4D46600089DE44 /* iOSTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
567374581B4D46600089DE44 /* iOSUITests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 567374681B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOSUITests" */;
|
||||
buildPhases = (
|
||||
567374551B4D46600089DE44 /* Sources */,
|
||||
567374561B4D46600089DE44 /* Frameworks */,
|
||||
567374571B4D46600089DE44 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
5673745B1B4D46600089DE44 /* PBXTargetDependency */,
|
||||
);
|
||||
name = iOSUITests;
|
||||
productName = iOSUITests;
|
||||
productReference = 567374591B4D46600089DE44 /* iOSUITests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.ui-testing";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
567374301B4D46600089DE44 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0700;
|
||||
ORGANIZATIONNAME = "Gwendal Roué";
|
||||
TargetAttributes = {
|
||||
567374371B4D46600089DE44 = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
};
|
||||
5673744D1B4D46600089DE44 = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
TestTargetID = 567374371B4D46600089DE44;
|
||||
};
|
||||
567374581B4D46600089DE44 = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
TestTargetID = 567374371B4D46600089DE44;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 567374331B4D46600089DE44 /* Build configuration list for PBXProject "iOS" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 5673742F1B4D46600089DE44;
|
||||
productRefGroup = 567374391B4D46600089DE44 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
567374371B4D46600089DE44 /* iOS */,
|
||||
5673744D1B4D46600089DE44 /* iOSTests */,
|
||||
567374581B4D46600089DE44 /* iOSUITests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
567374361B4D46600089DE44 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
567374481B4D46600089DE44 /* LaunchScreen.storyboard in Resources */,
|
||||
567374451B4D46600089DE44 /* Assets.xcassets in Resources */,
|
||||
567374431B4D46600089DE44 /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
5673744C1B4D46600089DE44 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
567374571B4D46600089DE44 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
567374741B4D7A3B0089DE44 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"$(SRCROOT)/../Carthage/Build/iOS/GRDB.framework",
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/usr/local/bin/carthage copy-frameworks";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
567374341B4D46600089DE44 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
567374401B4D46600089DE44 /* DetailViewController.swift in Sources */,
|
||||
5673743E1B4D46600089DE44 /* MasterViewController.swift in Sources */,
|
||||
567374701B4D48AB0089DE44 /* Person.swift in Sources */,
|
||||
5673743C1B4D46600089DE44 /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
5673744A1B4D46600089DE44 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
567374531B4D46600089DE44 /* iOSTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
567374551B4D46600089DE44 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5673745E1B4D46600089DE44 /* iOSUITests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
567374501B4D46600089DE44 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 567374371B4D46600089DE44 /* iOS */;
|
||||
targetProxy = 5673744F1B4D46600089DE44 /* PBXContainerItemProxy */;
|
||||
};
|
||||
5673745B1B4D46600089DE44 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 567374371B4D46600089DE44 /* iOS */;
|
||||
targetProxy = 5673745A1B4D46600089DE44 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
567374411B4D46600089DE44 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
567374421B4D46600089DE44 /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
567374461B4D46600089DE44 /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
567374471B4D46600089DE44 /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
567374601B4D46600089DE44 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
567374611B4D46600089DE44 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
567374631B4D46600089DE44 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../Carthage/Build/iOS",
|
||||
);
|
||||
INFOPLIST_FILE = iOS/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.iOS;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
567374641B4D46600089DE44 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../Carthage/Build/iOS",
|
||||
);
|
||||
INFOPLIST_FILE = iOS/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.iOS;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
567374661B4D46600089DE44 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
INFOPLIST_FILE = iOSTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.iOSTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOS.app/iOS";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
567374671B4D46600089DE44 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
INFOPLIST_FILE = iOSTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.iOSTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOS.app/iOS";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
567374691B4D46600089DE44 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
INFOPLIST_FILE = iOSUITests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.iOSUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_TARGET_NAME = iOS;
|
||||
USES_XCTRUNNER = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
5673746A1B4D46600089DE44 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
INFOPLIST_FILE = iOSUITests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.iOSUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_TARGET_NAME = iOS;
|
||||
USES_XCTRUNNER = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
567374331B4D46600089DE44 /* Build configuration list for PBXProject "iOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
567374601B4D46600089DE44 /* Debug */,
|
||||
567374611B4D46600089DE44 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
567374621B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
567374631B4D46600089DE44 /* Debug */,
|
||||
567374641B4D46600089DE44 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
567374651B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOSTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
567374661B4D46600089DE44 /* Debug */,
|
||||
567374671B4D46600089DE44 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
567374681B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOSUITests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
567374691B4D46600089DE44 /* Debug */,
|
||||
5673746A1B4D46600089DE44 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 567374301B4D46600089DE44 /* Project object */;
|
||||
}
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
//
|
||||
// AppDelegate.swift
|
||||
// iOS
|
||||
//
|
||||
// Created by Gwendal Roué on 08/07/2015.
|
||||
// Copyright © 2015 Gwendal Roué. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import GRDB
|
||||
|
||||
var dbQueue: DatabaseQueue!
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
let splitViewController = self.window!.rootViewController as! UISplitViewController
|
||||
let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
|
||||
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
|
||||
splitViewController.delegate = self
|
||||
|
||||
// Database
|
||||
dbQueue = DatabaseQueue()
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.registerMigration("createPersons") { db in
|
||||
try db.execute("CREATE TABLE persons (id INTEGER PRIMARY KEY, firstName TEXT, lastName TEXT)")
|
||||
}
|
||||
migrator.registerMigration("addPersons") { db in
|
||||
try Person(firstName: "Arthur", lastName: "Miller").insert(db)
|
||||
try Person(firstName: "Barbara", lastName: "Streisand").insert(db)
|
||||
try Person(firstName: "Cinderella").insert(db)
|
||||
}
|
||||
try! migrator.migrate(dbQueue)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// MARK: - Split view
|
||||
|
||||
func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController:UIViewController, ontoPrimaryViewController primaryViewController:UIViewController) -> Bool {
|
||||
guard let secondaryAsNavController = secondaryViewController as? UINavigationController else { return false }
|
||||
guard let topAsDetailController = secondaryAsNavController.topViewController as? DetailViewController else { return false }
|
||||
if topAsDetailController.person == nil {
|
||||
// Return true to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded.
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8076" systemVersion="14D121" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8063"/>
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright © 2015 Gwendal Roué. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
|
||||
<rect key="frame" x="20" y="559" width="560" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="iOS" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
|
||||
<rect key="frame" x="20" y="180" width="560" height="43"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
|
||||
<constraint firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
|
||||
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="SfN-ll-jLj"/>
|
||||
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
|
||||
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
|
||||
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="x7j-FC-K8j"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
@@ -1,135 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8121.20" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="H1p-Uh-vWS">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8101.16"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Master-->
|
||||
<scene sceneID="pY4-Hu-kfo">
|
||||
<objects>
|
||||
<navigationController title="Master" id="RMx-3f-FxP" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="Pmd-2v-anx">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="7bK-jq-Zjz" kind="relationship" relationship="rootViewController" id="tsl-Nk-0bq"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="8fS-aE-onr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-38" y="-630"/>
|
||||
</scene>
|
||||
<!--Detail-->
|
||||
<scene sceneID="yUG-lL-AsK">
|
||||
<objects>
|
||||
<viewController title="Detail" id="JEX-9P-axG" customClass="DetailViewController" customModule="iOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="SYR-Wa-9uf"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="GAO-Cl-Wes"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="svH-Pt-448">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Detail view content goes here" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="0XM-y9-sOw">
|
||||
<rect key="frame" x="20" y="292" width="560" height="17"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<fontDescription key="fontDescription" type="system" size="system"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="0XM-y9-sOw" firstAttribute="leading" secondItem="svH-Pt-448" secondAttribute="leading" constant="20" symbolic="YES" id="Tsc-yG-G1q"/>
|
||||
<constraint firstItem="0XM-y9-sOw" firstAttribute="centerY" secondItem="svH-Pt-448" secondAttribute="centerY" id="jWN-iV-94e"/>
|
||||
<constraint firstAttribute="trailing" secondItem="0XM-y9-sOw" secondAttribute="trailing" constant="20" symbolic="YES" id="tHV-ZD-HQj"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<toolbarItems/>
|
||||
<navigationItem key="navigationItem" title="Detail" id="mOI-FS-AaM"/>
|
||||
<connections>
|
||||
<outlet property="detailDescriptionLabel" destination="0XM-y9-sOw" id="deQ-Na-JPF"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="FJe-Yq-33r" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="709" y="129"/>
|
||||
</scene>
|
||||
<!--Split View Controller-->
|
||||
<scene sceneID="Nki-YV-4Qg">
|
||||
<objects>
|
||||
<splitViewController id="H1p-Uh-vWS" sceneMemberID="viewController">
|
||||
<toolbarItems/>
|
||||
<connections>
|
||||
<segue destination="RMx-3f-FxP" kind="relationship" relationship="masterViewController" id="BlO-5A-QYV"/>
|
||||
<segue destination="vC3-pB-5Vb" kind="relationship" relationship="detailViewController" id="Tll-UG-LXB"/>
|
||||
</connections>
|
||||
</splitViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="cZU-Oi-B1e" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-856" y="-330"/>
|
||||
</scene>
|
||||
<!--Master-->
|
||||
<scene sceneID="smW-Zh-WAh">
|
||||
<objects>
|
||||
<tableViewController title="Master" clearsSelectionOnViewWillAppear="NO" id="7bK-jq-Zjz" customClass="MasterViewController" customModule="iOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="r7i-6Z-zg0">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<prototypes>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="Arm-wq-HPj" style="IBUITableViewCellStyleDefault" id="WCw-Qf-5nD">
|
||||
<rect key="frame" x="0.0" y="86" width="600" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WCw-Qf-5nD" id="37f-cq-3Eg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Arm-wq-HPj">
|
||||
<rect key="frame" x="15" y="0.0" width="570" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<connections>
|
||||
<segue destination="vC3-pB-5Vb" kind="showDetail" identifier="showDetail" id="6S0-TO-JiA"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<sections/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="7bK-jq-Zjz" id="Gho-Na-rnu"/>
|
||||
<outlet property="delegate" destination="7bK-jq-Zjz" id="RA6-mI-bju"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Master" id="Zdf-7t-Un8"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Rux-fX-hf1" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="709" y="-630"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="r7l-gg-dq7">
|
||||
<objects>
|
||||
<navigationController id="vC3-pB-5Vb" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="DjV-YW-jjY">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="JEX-9P-axG" kind="relationship" relationship="rootViewController" id="GKi-kA-LjT"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="SLD-UC-DBI" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-45" y="129"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="6S0-TO-JiA"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
</document>
|
||||
@@ -1,34 +0,0 @@
|
||||
//
|
||||
// DetailViewController.swift
|
||||
// iOS
|
||||
//
|
||||
// Created by Gwendal Roué on 08/07/2015.
|
||||
// Copyright © 2015 Gwendal Roué. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class DetailViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var detailDescriptionLabel: UILabel!
|
||||
|
||||
var person: Person? {
|
||||
didSet {
|
||||
self.configureView()
|
||||
}
|
||||
}
|
||||
|
||||
func configureView() {
|
||||
if let person = self.person {
|
||||
if let label = self.detailDescriptionLabel {
|
||||
label.text = person.fullName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.configureView()
|
||||
}
|
||||
}
|
||||
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UIStatusBarTintParameters</key>
|
||||
<dict>
|
||||
<key>UINavigationBar</key>
|
||||
<dict>
|
||||
<key>Style</key>
|
||||
<string>UIBarStyleDefault</string>
|
||||
<key>Translucent</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,80 +0,0 @@
|
||||
//
|
||||
// MasterViewController.swift
|
||||
// iOS
|
||||
//
|
||||
// Created by Gwendal Roué on 08/07/2015.
|
||||
// Copyright © 2015 Gwendal Roué. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class MasterViewController: UITableViewController {
|
||||
|
||||
var detailViewController: DetailViewController? = nil
|
||||
var persons = [Person]()
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
self.navigationItem.leftBarButtonItem = self.editButtonItem()
|
||||
|
||||
if let split = self.splitViewController {
|
||||
let controllers = split.viewControllers
|
||||
self.detailViewController = (controllers[controllers.count-1] as! UINavigationController).topViewController as? DetailViewController
|
||||
}
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
persons = dbQueue.inDatabase { db in
|
||||
db.fetchAll(Person.self, "SELECT * FROM persons ORDER BY firstName, lastName")
|
||||
}
|
||||
self.clearsSelectionOnViewWillAppear = self.splitViewController!.collapsed
|
||||
super.viewWillAppear(animated)
|
||||
}
|
||||
|
||||
// MARK: - Segues
|
||||
|
||||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
|
||||
if segue.identifier == "showDetail" {
|
||||
if let indexPath = self.tableView.indexPathForSelectedRow {
|
||||
let person = persons[indexPath.row]
|
||||
let controller = (segue.destinationViewController as! UINavigationController).topViewController as! DetailViewController
|
||||
controller.person = person
|
||||
controller.navigationItem.leftBarButtonItem = self.splitViewController?.displayModeButtonItem()
|
||||
controller.navigationItem.leftItemsSupplementBackButton = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Table View
|
||||
|
||||
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return persons.count
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
|
||||
|
||||
let person = persons[indexPath.row]
|
||||
cell.textLabel!.text = person.fullName
|
||||
return cell
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
|
||||
let person = persons[indexPath.row]
|
||||
try! dbQueue.inTransaction { db in
|
||||
try person.delete(db)
|
||||
return .Commit
|
||||
}
|
||||
persons.removeAtIndex(indexPath.row)
|
||||
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
//
|
||||
// Person.swift
|
||||
// iOS
|
||||
//
|
||||
// Created by Gwendal Roué on 08/07/2015.
|
||||
// Copyright © 2015 Gwendal Roué. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import GRDB
|
||||
|
||||
class Person : Record {
|
||||
var id: Int64!
|
||||
var firstName: String?
|
||||
var lastName: String?
|
||||
var fullName: String {
|
||||
return " ".join([firstName, lastName].filter { $0 != nil }.map { $0! })
|
||||
}
|
||||
|
||||
init(firstName: String? = nil, lastName: String? = nil) {
|
||||
self.firstName = firstName
|
||||
self.lastName = lastName
|
||||
super.init()
|
||||
}
|
||||
|
||||
// MARK: - Record
|
||||
|
||||
override class var databaseTable: Table? {
|
||||
return Table(named: "persons", primaryKey: .RowID("id"))
|
||||
}
|
||||
|
||||
override func setDatabaseValue(dbv: DatabaseValue, forColumn column: String) {
|
||||
switch column {
|
||||
case "id": id = dbv.value()
|
||||
case "firstName": firstName = dbv.value()
|
||||
case "lastName": lastName = dbv.value()
|
||||
default: super.setDatabaseValue(dbv, forColumn: column)
|
||||
}
|
||||
}
|
||||
|
||||
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
|
||||
return [
|
||||
"id": id,
|
||||
"firstName": firstName,
|
||||
"lastName": lastName]
|
||||
}
|
||||
|
||||
required init(row: Row) {
|
||||
super.init(row: row)
|
||||
}
|
||||
}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
//
|
||||
// iOSTests.swift
|
||||
// iOSTests
|
||||
//
|
||||
// Created by Gwendal Roué on 08/07/2015.
|
||||
// Copyright © 2015 Gwendal Roué. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
class iOSTests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
// This is an example of a functional test case.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
func testPerformanceExample() {
|
||||
// This is an example of a performance test case.
|
||||
self.measureBlock() {
|
||||
// Put the code you want to measure the time of here.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
//
|
||||
// iOSUITests.swift
|
||||
// iOSUITests
|
||||
//
|
||||
// Created by Gwendal Roué on 08/07/2015.
|
||||
// Copyright © 2015 Gwendal Roué. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
|
||||
class iOSUITests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
|
||||
// In UI tests it is usually best to stop immediately when a failure occurs.
|
||||
continueAfterFailure = false
|
||||
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
|
||||
XCUIApplication().launch()
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
// Use recording to get started writing UI tests.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,385 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
// See if TransactionObserverType can provide robust NSData external storage.
|
||||
//
|
||||
// The answer is yes, we can.
|
||||
//
|
||||
// However this requires records to be *managed*. All instances of our
|
||||
// RecordWithManagedData must be given their manager after instanciation.
|
||||
|
||||
class ManagedDataController : TransactionObserverType {
|
||||
// Base directory
|
||||
let path: String
|
||||
|
||||
// A magic testing data: ManagedDataController.databaseWillCommit() throws
|
||||
// an error if this data wants to save.
|
||||
let forbiddenData: NSData?
|
||||
|
||||
// ManagedData management
|
||||
private var managedData: ManagedData? = nil
|
||||
private var pendingManagedDatas: [Int64: ManagedData] = [:]
|
||||
var movedManagedDatas: [ManagedData] = []
|
||||
var storedManagedDatas: [ManagedData] = []
|
||||
var restoreFileSystemAfterRollback: Bool = false
|
||||
|
||||
init(path: String, forbiddenData: NSData?) {
|
||||
self.path = path
|
||||
self.forbiddenData = forbiddenData
|
||||
setupDirectories()
|
||||
}
|
||||
|
||||
func willSaveManagedData(managedData: ManagedData?) {
|
||||
// Next step: databaseDidChangeWithEvent() or databaseDidRollback()
|
||||
self.managedData = managedData
|
||||
}
|
||||
|
||||
func databaseDidChangeWithEvent(event: DatabaseEvent) {
|
||||
guard let managedData = managedData else {
|
||||
return
|
||||
}
|
||||
|
||||
self.managedData = nil
|
||||
|
||||
switch event.kind {
|
||||
case .Insert, .Update:
|
||||
managedData.rowID = event.rowID
|
||||
// Replace any existing managedData for this rowID.
|
||||
pendingManagedDatas[event.rowID] = managedData
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func databaseWillCommit() throws {
|
||||
do {
|
||||
let fm = NSFileManager.defaultManager()
|
||||
for (_, managedData) in pendingManagedDatas.sort({ $0.0 < $1.0 }) {
|
||||
if let forbiddenData = forbiddenData, let data = managedData.data where forbiddenData == data {
|
||||
throw NSError(domain: "ManagedDataController", code: 0, userInfo: nil)
|
||||
}
|
||||
|
||||
let storagePath = storageDataPath(managedData)
|
||||
let storageDir = (storagePath as NSString).stringByDeletingLastPathComponent
|
||||
let tempPath = temporaryDataPath(managedData)
|
||||
let tempDir = (tempPath as NSString).stringByDeletingLastPathComponent
|
||||
|
||||
|
||||
// Move
|
||||
|
||||
if fm.fileExistsAtPath(storagePath) {
|
||||
if fm.fileExistsAtPath(tempPath) {
|
||||
try! fm.removeItemAtPath(tempPath)
|
||||
}
|
||||
if !fm.fileExistsAtPath(tempDir) {
|
||||
try fm.createDirectoryAtPath(tempDir, withIntermediateDirectories: true, attributes: nil)
|
||||
}
|
||||
try fm.moveItemAtPath(storagePath, toPath: tempPath)
|
||||
}
|
||||
movedManagedDatas.append(managedData)
|
||||
|
||||
|
||||
// Store
|
||||
|
||||
if let data = managedData.data {
|
||||
if !fm.fileExistsAtPath(storageDir) {
|
||||
try fm.createDirectoryAtPath(storageDir, withIntermediateDirectories: true, attributes: nil)
|
||||
}
|
||||
try data.writeToFile(storagePath, options: [])
|
||||
}
|
||||
storedManagedDatas.append(managedData)
|
||||
}
|
||||
} catch {
|
||||
// Could not save the managed data.
|
||||
//
|
||||
// Let the database perform a rollback, and restore the
|
||||
// file system later, in databaseDidRollback():
|
||||
restoreFileSystemAfterRollback = true
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
func databaseDidCommit(db: Database) {
|
||||
// TODO: clean up tmp directory
|
||||
cleanup()
|
||||
}
|
||||
|
||||
func databaseDidRollback(db: Database) {
|
||||
if restoreFileSystemAfterRollback {
|
||||
let fm = NSFileManager.defaultManager()
|
||||
|
||||
for managedData in storedManagedDatas {
|
||||
if fm.fileExistsAtPath(storageDataPath(managedData)) {
|
||||
try! fm.removeItemAtPath(storageDataPath(managedData))
|
||||
}
|
||||
}
|
||||
|
||||
for managedData in movedManagedDatas {
|
||||
let storagePath = storageDataPath(managedData)
|
||||
let storageDir = (storagePath as NSString).stringByDeletingLastPathComponent
|
||||
let tempPath = temporaryDataPath(managedData)
|
||||
if fm.fileExistsAtPath(tempPath) {
|
||||
if !fm.fileExistsAtPath(storageDir) {
|
||||
try! fm.createDirectoryAtPath(storageDir, withIntermediateDirectories: true, attributes: nil)
|
||||
}
|
||||
try! fm.moveItemAtPath(tempPath, toPath: storagePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
cleanup()
|
||||
}
|
||||
|
||||
func cleanup() {
|
||||
managedData = nil
|
||||
restoreFileSystemAfterRollback = false
|
||||
movedManagedDatas = []
|
||||
storedManagedDatas = []
|
||||
pendingManagedDatas = [:]
|
||||
}
|
||||
|
||||
func loadData(managedData: ManagedData) -> NSData? {
|
||||
guard managedData.rowID != nil else {
|
||||
return nil
|
||||
}
|
||||
let fm = NSFileManager.defaultManager()
|
||||
if fm.fileExistsAtPath(storageDataPath(managedData)) {
|
||||
return NSData(contentsOfFile: storageDataPath(managedData))!
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
private var temporaryDirectoryPath: String {
|
||||
return (path as NSString).stringByAppendingPathComponent("tmp")
|
||||
}
|
||||
|
||||
private func storageDataPath(managedData: ManagedData) -> String {
|
||||
var path = self.path as NSString
|
||||
path = path.stringByAppendingPathComponent(String(managedData.rowID!))
|
||||
path = path.stringByAppendingPathComponent(managedData.name)
|
||||
return path as String
|
||||
}
|
||||
|
||||
private func temporaryDataPath(managedData: ManagedData) -> String {
|
||||
var path = self.temporaryDirectoryPath as NSString
|
||||
path = path.stringByAppendingPathComponent(String(managedData.rowID!))
|
||||
path = path.stringByAppendingPathComponent(managedData.name)
|
||||
return path as String
|
||||
}
|
||||
|
||||
private func setupDirectories() {
|
||||
let fm = NSFileManager.defaultManager()
|
||||
try! fm.createDirectoryAtPath(path, withIntermediateDirectories: true, attributes: nil)
|
||||
try! fm.createDirectoryAtPath(temporaryDirectoryPath, withIntermediateDirectories: true, attributes: nil)
|
||||
}
|
||||
}
|
||||
|
||||
final class ManagedData {
|
||||
var controller: ManagedDataController?
|
||||
var name: String
|
||||
var rowID: Int64?
|
||||
var data: NSData? {
|
||||
if let _data = _data {
|
||||
return _data
|
||||
} else {
|
||||
_data = controller!.loadData(self)
|
||||
return _data!
|
||||
}
|
||||
}
|
||||
var _data: NSData??
|
||||
|
||||
init(name: String) {
|
||||
self.name = name
|
||||
}
|
||||
|
||||
func copyWithData(data: NSData?) -> ManagedData {
|
||||
let copy = ManagedData(name: name)
|
||||
copy.controller = controller
|
||||
copy._data = data
|
||||
copy.rowID = rowID
|
||||
return copy
|
||||
}
|
||||
|
||||
func willSave() {
|
||||
controller!.willSaveManagedData(self)
|
||||
}
|
||||
}
|
||||
|
||||
// OK
|
||||
class RecordWithManagedData : Record {
|
||||
// OK
|
||||
var id: Int64?
|
||||
|
||||
// OK. Odd, but OK: data is accessed through managedData.
|
||||
private var managedData = ManagedData(name: "data")
|
||||
var data: NSData? {
|
||||
get { return managedData.data }
|
||||
set { managedData = managedData.copyWithData(newValue) } // Odd
|
||||
}
|
||||
|
||||
// OK
|
||||
override static func databaseTableName() -> String {
|
||||
return "datas"
|
||||
}
|
||||
|
||||
// Not OK: what is this useless "data" columns?
|
||||
// Answer: this is an artificial column that makes our tests run despite
|
||||
// the fact that Record.update() does nothing when there is nothing to
|
||||
// update.
|
||||
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
|
||||
return ["id": id, "data": nil]
|
||||
}
|
||||
|
||||
override func updateFromRow(row: Row) {
|
||||
if let dbv = row["id"] {
|
||||
id = dbv.value()
|
||||
// Hmm. Sure this rowID must be linked to managedData at some point.
|
||||
managedData.rowID = dbv.value()
|
||||
}
|
||||
super.updateFromRow(row)
|
||||
}
|
||||
|
||||
override func insert(db: Database) throws {
|
||||
// Hmm.
|
||||
managedData.willSave()
|
||||
try super.insert(db)
|
||||
}
|
||||
|
||||
override func update(db: Database) throws {
|
||||
// Hmm.
|
||||
managedData.willSave()
|
||||
try super.update(db)
|
||||
}
|
||||
|
||||
// OK
|
||||
static func setupInDatabase(db: Database) throws {
|
||||
// TODO: make tests run with a single "id INTEGER PRIMARY KEY" column.
|
||||
// The "update" method is doing nothing in this case, so we can expect troubles with managed data.
|
||||
try db.execute(
|
||||
"CREATE TABLE datas (id INTEGER PRIMARY KEY, data BLOB)")
|
||||
}
|
||||
}
|
||||
|
||||
class ManagedDataControllerTests : GRDBTestCase {
|
||||
var managedDataController: ManagedDataController!
|
||||
|
||||
override var dbConfiguration: Configuration {
|
||||
managedDataController = ManagedDataController(path: "/tmp/ManagedDataController", forbiddenData: "Bunny".dataUsingEncoding(NSUTF8StringEncoding))
|
||||
var c = super.dbConfiguration
|
||||
c.transactionObserver = managedDataController
|
||||
return c
|
||||
}
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try RecordWithManagedData.setupInDatabase(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testImplicitTransaction() {
|
||||
assertNoError {
|
||||
// Test that we can store data in the file system...
|
||||
let record = RecordWithManagedData()
|
||||
try dbQueue.inDatabase { db in
|
||||
// TODO: this explicit line is a problem
|
||||
record.managedData.controller = self.managedDataController
|
||||
record.data = "foo".dataUsingEncoding(NSUTF8StringEncoding)
|
||||
try record.save(db)
|
||||
}
|
||||
|
||||
// ... and get it back after a fetch:
|
||||
dbQueue.inDatabase { db in
|
||||
let reloadedRecord = RecordWithManagedData.fetchOne(db, key: record.id)!
|
||||
reloadedRecord.managedData.controller = self.managedDataController
|
||||
XCTAssertEqual(reloadedRecord.data, "foo".dataUsingEncoding(NSUTF8StringEncoding))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testExplicitTransaction() {
|
||||
assertNoError {
|
||||
// Test that we can stored data in the file system...
|
||||
let record = RecordWithManagedData()
|
||||
record.managedData.controller = self.managedDataController
|
||||
try dbQueue.inDatabase { db in
|
||||
record.data = "foo".dataUsingEncoding(NSUTF8StringEncoding)
|
||||
try record.save(db)
|
||||
}
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
// ... and that changes...
|
||||
record.data = "bar".dataUsingEncoding(NSUTF8StringEncoding)
|
||||
try record.save(db)
|
||||
|
||||
// ... after changes...
|
||||
record.data = "baz".dataUsingEncoding(NSUTF8StringEncoding)
|
||||
try record.save(db)
|
||||
|
||||
// ... are not applied in the file system...
|
||||
let reloadedRecord = RecordWithManagedData.fetchOne(db, key: record.id)!
|
||||
reloadedRecord.managedData.controller = self.managedDataController
|
||||
XCTAssertEqual(reloadedRecord.data, "foo".dataUsingEncoding(NSUTF8StringEncoding))
|
||||
|
||||
// ... until database commit:
|
||||
return .Commit
|
||||
}
|
||||
|
||||
// We find our modified data after commit:
|
||||
dbQueue.inDatabase { db in
|
||||
let reloadedRecord = RecordWithManagedData.fetchOne(db, key: record.id)!
|
||||
reloadedRecord.managedData.controller = self.managedDataController
|
||||
XCTAssertEqual(reloadedRecord.data, "baz".dataUsingEncoding(NSUTF8StringEncoding))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testCommitError() {
|
||||
assertNoError {
|
||||
// Test that we can stored data in the file system...
|
||||
let record = RecordWithManagedData()
|
||||
record.managedData.controller = self.managedDataController
|
||||
try dbQueue.inDatabase { db in
|
||||
record.data = "foo".dataUsingEncoding(NSUTF8StringEncoding)
|
||||
try record.save(db)
|
||||
}
|
||||
|
||||
do {
|
||||
try dbQueue.inTransaction { db in
|
||||
// ... and that changes...
|
||||
record.data = "bar".dataUsingEncoding(NSUTF8StringEncoding)
|
||||
try record.save(db)
|
||||
|
||||
// ... after changes...
|
||||
record.data = "baz".dataUsingEncoding(NSUTF8StringEncoding)
|
||||
try record.save(db)
|
||||
|
||||
// ... are not applied in the file system...
|
||||
let reloadedRecord = RecordWithManagedData.fetchOne(db, key: record.id)!
|
||||
reloadedRecord.managedData.controller = self.managedDataController
|
||||
XCTAssertEqual(reloadedRecord.data, "foo".dataUsingEncoding(NSUTF8StringEncoding))
|
||||
|
||||
// ... until database commit, which may fail:
|
||||
let forbiddenRecord = RecordWithManagedData()
|
||||
forbiddenRecord.managedData.controller = self.managedDataController
|
||||
forbiddenRecord.data = "Bunny".dataUsingEncoding(NSUTF8StringEncoding)
|
||||
try forbiddenRecord.save(db)
|
||||
return .Commit
|
||||
}
|
||||
XCTFail("Expected error")
|
||||
} catch let error as NSError {
|
||||
XCTAssertEqual(error.domain, "ManagedDataController")
|
||||
}
|
||||
|
||||
// We find our original data back after failure:
|
||||
dbQueue.inDatabase { db in
|
||||
let reloadedRecord = RecordWithManagedData.fetchOne(db, key: record.id)!
|
||||
reloadedRecord.managedData.controller = self.managedDataController
|
||||
XCTAssertEqual(reloadedRecord.data, "foo".dataUsingEncoding(NSUTF8StringEncoding))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
// Taking inspiration from https://github.com/LoganWright/Genome
|
||||
|
||||
class Mapping {
|
||||
enum Direction {
|
||||
case Fetch(Row)
|
||||
case Save
|
||||
}
|
||||
let direction: Direction
|
||||
var dictionary: [String: DatabaseValueConvertible?] = [:]
|
||||
init() {
|
||||
direction = .Save
|
||||
}
|
||||
init(row: Row) {
|
||||
direction = .Fetch(row)
|
||||
}
|
||||
subscript(name: String) -> Binding {
|
||||
switch direction {
|
||||
case .Save:
|
||||
return Binding(
|
||||
name: name,
|
||||
direction: .Save({ (value: DatabaseValueConvertible?) in
|
||||
self.dictionary[name] = value
|
||||
}))
|
||||
case .Fetch(let row):
|
||||
return Binding(name: name, direction: .Fetch(row[name]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Binding {
|
||||
enum Direction {
|
||||
case Fetch(DatabaseValue?)
|
||||
case Save((DatabaseValueConvertible?) -> ())
|
||||
}
|
||||
let name: String
|
||||
let direction: Direction
|
||||
|
||||
init(name: String, direction: Direction) {
|
||||
self.name = name
|
||||
self.direction = direction
|
||||
}
|
||||
|
||||
func bind<Value: DatabaseValueConvertible>(inout value: Value) {
|
||||
switch direction {
|
||||
case .Fetch(let databaseValue):
|
||||
if let databaseValue = databaseValue {
|
||||
value = Value.fromDatabaseValue(databaseValue)!
|
||||
}
|
||||
case .Save(let f):
|
||||
f(value)
|
||||
}
|
||||
}
|
||||
|
||||
func bind<Value: DatabaseValueConvertible>(inout value: Value?) {
|
||||
switch direction {
|
||||
case .Fetch(let databaseValue):
|
||||
if let databaseValue = databaseValue {
|
||||
value = Value.fromDatabaseValue(databaseValue)
|
||||
}
|
||||
case .Save(let f):
|
||||
f(value)
|
||||
}
|
||||
}
|
||||
|
||||
func bind<Value: DatabaseValueConvertible>(inout value: Value!) {
|
||||
switch direction {
|
||||
case .Fetch(let databaseValue):
|
||||
if let databaseValue = databaseValue {
|
||||
value = Value.fromDatabaseValue(databaseValue)
|
||||
}
|
||||
case .Save(let f):
|
||||
f(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
infix operator <-> { associativity left precedence 160 }
|
||||
func <-><Value: DatabaseValueConvertible>(inout value: Value, binding: Binding) {
|
||||
binding.bind(&value)
|
||||
}
|
||||
func <-><Value: DatabaseValueConvertible>(inout value: Value?, binding: Binding) {
|
||||
binding.bind(&value)
|
||||
}
|
||||
func <-><Value: DatabaseValueConvertible>(inout value: Value!, binding: Binding) {
|
||||
binding.bind(&value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
class MappedRecord : Record {
|
||||
var id: Int64!
|
||||
var firstName: String?
|
||||
var lastName: String?
|
||||
var fullName: String {
|
||||
return [firstName, lastName].flatMap { $0 }.joinWithSeparator(" ")
|
||||
}
|
||||
|
||||
init(firstName: String? = nil, lastName: String? = nil) {
|
||||
self.firstName = firstName
|
||||
self.lastName = lastName
|
||||
super.init()
|
||||
}
|
||||
|
||||
// The experiment:
|
||||
|
||||
func map(mapping: Mapping) {
|
||||
id <-> mapping["id"]
|
||||
firstName <-> mapping["firstName"]
|
||||
lastName <-> mapping["lastName"]
|
||||
}
|
||||
|
||||
// Record overrides
|
||||
|
||||
override class func databaseTableName() -> String? {
|
||||
return "persons"
|
||||
}
|
||||
|
||||
override func updateFromRow(row: Row) {
|
||||
map(Mapping(row: row))
|
||||
super.updateFromRow(row) // Subclasses are required to call super.
|
||||
}
|
||||
|
||||
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
|
||||
let mapping = Mapping()
|
||||
map(mapping)
|
||||
return mapping.dictionary
|
||||
}
|
||||
|
||||
required init(row: Row) {
|
||||
super.init(row: row)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MappingTests: GRDBTestCase {
|
||||
|
||||
func testExample() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (" +
|
||||
"id INTEGER PRIMARY KEY, " +
|
||||
"firstName TEXT, " +
|
||||
"lastName TEXT" +
|
||||
")")
|
||||
|
||||
try MappedRecord(firstName: "Arthur", lastName: "Miller").insert(db)
|
||||
try MappedRecord(firstName: "Barbara", lastName: "Streisand").insert(db)
|
||||
try MappedRecord(firstName: "Cinderella").insert(db)
|
||||
|
||||
let records = MappedRecord.fetchAll(db, "SELECT * FROM persons ORDER BY firstName, lastName")
|
||||
|
||||
print(records)
|
||||
print(records.map { $0.fullName })
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
//
|
||||
// AppDelegate.swift
|
||||
// GRDBProfiling
|
||||
//
|
||||
// Created by Gwendal Roué on 15/09/2015.
|
||||
// Copyright © 2015 Gwendal Roué. All rights reserved.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import GRDB
|
||||
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
var dbQueue: DatabaseQueue!
|
||||
|
||||
func applicationDidFinishLaunching(aNotification: NSNotification) {
|
||||
let databasePath = NSBundle.mainBundle().pathForResource("ProfilingDatabase", ofType: "sqlite")!
|
||||
dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
readFromDatabase()
|
||||
}
|
||||
|
||||
func readFromDatabase() {
|
||||
for _ in 0..<100 {
|
||||
dbQueue.inDatabase { db in
|
||||
for row in Row.fetch(db, "SELECT * FROM items") {
|
||||
let _: Int64 = row.value(atIndex: 0)
|
||||
let _: Int64 = row.value(atIndex: 1)
|
||||
let _: Int64 = row.value(atIndex: 2)
|
||||
let _: Int64 = row.value(atIndex: 3)
|
||||
let _: Int64 = row.value(atIndex: 4)
|
||||
let _: Int64 = row.value(atIndex: 5)
|
||||
let _: Int64 = row.value(atIndex: 6)
|
||||
let _: Int64 = row.value(atIndex: 7)
|
||||
let _: Int64 = row.value(atIndex: 8)
|
||||
let _: Int64 = row.value(atIndex: 9)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// ViewController.swift
|
||||
// GRDBProfiling
|
||||
//
|
||||
// Created by Gwendal Roué on 15/09/2015.
|
||||
// Copyright © 2015 Gwendal Roué. All rights reserved.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
class ViewController: NSViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
override var representedObject: AnyObject? {
|
||||
didSet {
|
||||
// Update the view, if already loaded.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class GRDBTestCase: XCTestCase {
|
||||
var databasePath: String!
|
||||
var dbQueue: DatabaseQueue!
|
||||
var sqlQueries: [String]!
|
||||
var dbConfiguration: Configuration {
|
||||
var dbConfiguration = Configuration()
|
||||
dbConfiguration.trace = { (sql) in
|
||||
self.sqlQueries.append(sql)
|
||||
// LogSQL(sql) // Uncomment for verbose tests
|
||||
}
|
||||
return dbConfiguration
|
||||
}
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
sqlQueries = []
|
||||
databasePath = "/tmp/GRDB.sqlite"
|
||||
do { try NSFileManager.defaultManager().removeItemAtPath(databasePath) } catch { }
|
||||
dbQueue = try! DatabaseQueue(path: databasePath, configuration: dbConfiguration)
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
|
||||
dbQueue = nil
|
||||
try! NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
}
|
||||
|
||||
func assertNoError(@noescape test: (Void) throws -> Void) {
|
||||
do {
|
||||
try test()
|
||||
} catch let error as DatabaseError {
|
||||
XCTFail(error.description)
|
||||
} catch let error as RecordError {
|
||||
XCTFail(error.description)
|
||||
} catch {
|
||||
XCTFail("error: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class FMDBPerformanceTests: XCTestCase {
|
||||
|
||||
func testValueAtIndexPerformance() {
|
||||
// Here we test the extraction of values by column index.
|
||||
|
||||
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
|
||||
let dbQueue = FMDatabaseQueue(path: databasePath)
|
||||
|
||||
self.measureBlock {
|
||||
dbQueue.inDatabase { db in
|
||||
if let rs = db.executeQuery("SELECT * FROM items", withArgumentsInArray: nil) {
|
||||
while rs.next() {
|
||||
let _ = rs.longForColumnIndex(0)
|
||||
let _ = rs.longForColumnIndex(1)
|
||||
let _ = rs.longForColumnIndex(2)
|
||||
let _ = rs.longForColumnIndex(3)
|
||||
let _ = rs.longForColumnIndex(4)
|
||||
let _ = rs.longForColumnIndex(5)
|
||||
let _ = rs.longForColumnIndex(6)
|
||||
let _ = rs.longForColumnIndex(7)
|
||||
let _ = rs.longForColumnIndex(8)
|
||||
let _ = rs.longForColumnIndex(9)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testValueNamedPerformance() {
|
||||
// Here we test the extraction of values by column name.
|
||||
|
||||
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
|
||||
let dbQueue = FMDatabaseQueue(path: databasePath)
|
||||
|
||||
self.measureBlock {
|
||||
dbQueue.inDatabase { db in
|
||||
if let rs = db.executeQuery("SELECT * FROM items", withArgumentsInArray: nil) {
|
||||
while rs.next() {
|
||||
let _ = rs.longForColumn("i0")
|
||||
let _ = rs.longForColumn("i1")
|
||||
let _ = rs.longForColumn("i2")
|
||||
let _ = rs.longForColumn("i3")
|
||||
let _ = rs.longForColumn("i4")
|
||||
let _ = rs.longForColumn("i5")
|
||||
let _ = rs.longForColumn("i6")
|
||||
let _ = rs.longForColumn("i7")
|
||||
let _ = rs.longForColumn("i8")
|
||||
let _ = rs.longForColumn("i9")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordPerformance() {
|
||||
// Here we test that we can load "records".
|
||||
//
|
||||
// Two constraints:
|
||||
//
|
||||
// 1. Records MUST be initialized from a row, or a row-like object like
|
||||
// a dictionary: rows MUST be introspectable by column name, so that
|
||||
// the record can pick the columns it wants.
|
||||
//
|
||||
// 2. Fetched records MUST be flagged as having no change.
|
||||
|
||||
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
|
||||
let dbQueue = FMDatabaseQueue(path: databasePath)
|
||||
|
||||
self.measureBlock {
|
||||
var records = [PerformanceRecord]()
|
||||
dbQueue.inDatabase { db in
|
||||
if let rs = db.executeQuery("SELECT * FROM items", withArgumentsInArray: nil) {
|
||||
while rs.next() {
|
||||
// FMDB already provides a row-like object:
|
||||
let dictionary = rs.resultDictionary()
|
||||
let record = PerformanceRecord(dictionary: dictionary)
|
||||
record.databaseEdited = false // Needs to be explicit: GRDB does it implicitly.
|
||||
records.append(record)
|
||||
}
|
||||
}
|
||||
}
|
||||
XCTAssertEqual(records[4].i2, 1)
|
||||
XCTAssertEqual(records[4].i3, 0)
|
||||
XCTAssertEqual(records[5].i2, 2)
|
||||
XCTAssertEqual(records[5].i3, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,93 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class GRDBPerformanceTests: XCTestCase {
|
||||
|
||||
// This is not a test, but a function which generates the FetchPerformanceTests.sqlite resource.
|
||||
func populateDatabase() {
|
||||
let databasePath = "/tmp/FetchPerformanceTests.sqlite"
|
||||
do {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inTransaction { db in
|
||||
try db.execute("CREATE TABLE items (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)")
|
||||
for i in 0..<100_000 {
|
||||
try db.execute("INSERT INTO items (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) VALUES (?,?,?,?,?,?,?,?,?,?)", arguments: [i%1, i%2, i%3, i%4, i%5, i%6, i%7, i%8, i%9, i%10])
|
||||
}
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testValueAtIndexPerformance() {
|
||||
// Here we test the extraction of values by column index.
|
||||
|
||||
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
|
||||
self.measureBlock {
|
||||
dbQueue.inDatabase { db in
|
||||
for row in Row.fetch(db, "SELECT * FROM items") {
|
||||
let _: Int = row.value(atIndex: 0)
|
||||
let _: Int = row.value(atIndex: 1)
|
||||
let _: Int = row.value(atIndex: 2)
|
||||
let _: Int = row.value(atIndex: 3)
|
||||
let _: Int = row.value(atIndex: 4)
|
||||
let _: Int = row.value(atIndex: 5)
|
||||
let _: Int = row.value(atIndex: 6)
|
||||
let _: Int = row.value(atIndex: 7)
|
||||
let _: Int = row.value(atIndex: 8)
|
||||
let _: Int = row.value(atIndex: 9)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testValueNamedPerformance() {
|
||||
// Here we test the extraction of values by column name.
|
||||
|
||||
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
|
||||
self.measureBlock {
|
||||
dbQueue.inDatabase { db in
|
||||
for row in Row.fetch(db, "SELECT * FROM items") {
|
||||
let _: Int = row.value(named: "i0")
|
||||
let _: Int = row.value(named: "i1")
|
||||
let _: Int = row.value(named: "i2")
|
||||
let _: Int = row.value(named: "i3")
|
||||
let _: Int = row.value(named: "i4")
|
||||
let _: Int = row.value(named: "i5")
|
||||
let _: Int = row.value(named: "i6")
|
||||
let _: Int = row.value(named: "i7")
|
||||
let _: Int = row.value(named: "i8")
|
||||
let _: Int = row.value(named: "i9")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordPerformance() {
|
||||
// Here we test that we can load "records".
|
||||
//
|
||||
// Two constraints:
|
||||
//
|
||||
// 1. Records MUST be initialized from a row, or a row-like object like
|
||||
// a dictionary: rows MUST be introspectable by column name, so that
|
||||
// the record can pick the columns it wants.
|
||||
//
|
||||
// 2. Fetched records MUST be flagged as having no change.
|
||||
|
||||
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
|
||||
self.measureBlock {
|
||||
let records = dbQueue.inDatabase { db in
|
||||
PerformanceRecord.fetchAll(db, "SELECT * FROM items")
|
||||
}
|
||||
XCTAssertEqual(records[4].i2, 1)
|
||||
XCTAssertEqual(records[4].i3, 0)
|
||||
XCTAssertEqual(records[5].i2, 2)
|
||||
XCTAssertEqual(records[5].i3, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import GRDB
|
||||
|
||||
class PerformanceRecord : Record {
|
||||
var i0: Int?
|
||||
var i1: Int?
|
||||
var i2: Int?
|
||||
var i3: Int?
|
||||
var i4: Int?
|
||||
var i5: Int?
|
||||
var i6: Int?
|
||||
var i7: Int?
|
||||
var i8: Int?
|
||||
var i9: Int?
|
||||
|
||||
required init(row: Row) {
|
||||
super.init(row: row)
|
||||
}
|
||||
|
||||
// Targets FMDB
|
||||
init(dictionary: [NSObject: AnyObject]) {
|
||||
super.init()
|
||||
if let n = dictionary["i0"] as? NSNumber { i0 = n.longValue }
|
||||
if let n = dictionary["i1"] as? NSNumber { i1 = n.longValue }
|
||||
if let n = dictionary["i2"] as? NSNumber { i2 = n.longValue }
|
||||
if let n = dictionary["i3"] as? NSNumber { i3 = n.longValue }
|
||||
if let n = dictionary["i4"] as? NSNumber { i4 = n.longValue }
|
||||
if let n = dictionary["i5"] as? NSNumber { i5 = n.longValue }
|
||||
if let n = dictionary["i6"] as? NSNumber { i6 = n.longValue }
|
||||
if let n = dictionary["i7"] as? NSNumber { i7 = n.longValue }
|
||||
if let n = dictionary["i8"] as? NSNumber { i8 = n.longValue }
|
||||
if let n = dictionary["i9"] as? NSNumber { i9 = n.longValue }
|
||||
}
|
||||
|
||||
override func updateFromRow(row: Row) {
|
||||
if let dbv = row["i0"] { i0 = dbv.value() }
|
||||
if let dbv = row["i1"] { i1 = dbv.value() }
|
||||
if let dbv = row["i2"] { i2 = dbv.value() }
|
||||
if let dbv = row["i3"] { i3 = dbv.value() }
|
||||
if let dbv = row["i4"] { i4 = dbv.value() }
|
||||
if let dbv = row["i5"] { i5 = dbv.value() }
|
||||
if let dbv = row["i6"] { i6 = dbv.value() }
|
||||
if let dbv = row["i7"] { i7 = dbv.value() }
|
||||
if let dbv = row["i8"] { i8 = dbv.value() }
|
||||
if let dbv = row["i9"] { i9 = dbv.value() }
|
||||
super.updateFromRow(row)
|
||||
}
|
||||
}
|
||||
Submodule GRDB Tests/Performance/SQLite.swift deleted from 8bd27bcd5d.
@@ -1,123 +0,0 @@
|
||||
import XCTest
|
||||
import SQLite
|
||||
import GRDB
|
||||
|
||||
class StephenCelisSQLitePerformanceTests: XCTestCase {
|
||||
|
||||
func testValueAtIndexPerformance() {
|
||||
// Here we test the extraction of values by column index.
|
||||
|
||||
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
|
||||
let db = try! Connection(databasePath)
|
||||
|
||||
self.measureBlock {
|
||||
// Column access by index requires raw SQL (unlike extraction of values by column name).
|
||||
for row in db.prepare("SELECT * FROM items") {
|
||||
// Direct Int extraction is not supported.
|
||||
let _ = Int(row[0] as! Int64)
|
||||
let _ = Int(row[1] as! Int64)
|
||||
let _ = Int(row[2] as! Int64)
|
||||
let _ = Int(row[3] as! Int64)
|
||||
let _ = Int(row[4] as! Int64)
|
||||
let _ = Int(row[5] as! Int64)
|
||||
let _ = Int(row[6] as! Int64)
|
||||
let _ = Int(row[7] as! Int64)
|
||||
let _ = Int(row[8] as! Int64)
|
||||
let _ = Int(row[9] as! Int64)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testValueNamedPerformance() {
|
||||
// Here we test the extraction of values by column name.
|
||||
|
||||
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
|
||||
let db = try! Connection(databasePath)
|
||||
|
||||
// Column access by name requires query builder (unlike extraction of values by column index).
|
||||
let items = Table("items")
|
||||
let i0 = Expression<Int>("i0")
|
||||
let i1 = Expression<Int>("i1")
|
||||
let i2 = Expression<Int>("i2")
|
||||
let i3 = Expression<Int>("i3")
|
||||
let i4 = Expression<Int>("i4")
|
||||
let i5 = Expression<Int>("i5")
|
||||
let i6 = Expression<Int>("i6")
|
||||
let i7 = Expression<Int>("i7")
|
||||
let i8 = Expression<Int>("i8")
|
||||
let i9 = Expression<Int>("i9")
|
||||
|
||||
self.measureBlock {
|
||||
for item in db.prepare(items) {
|
||||
let _ = item[i0]
|
||||
let _ = item[i1]
|
||||
let _ = item[i2]
|
||||
let _ = item[i3]
|
||||
let _ = item[i4]
|
||||
let _ = item[i5]
|
||||
let _ = item[i6]
|
||||
let _ = item[i7]
|
||||
let _ = item[i8]
|
||||
let _ = item[i9]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordPerformance() {
|
||||
// Here we test that we can load "records".
|
||||
//
|
||||
// Two constraints:
|
||||
//
|
||||
// 1. Records MUST be initialized from a row, or a row-like object like
|
||||
// a dictionary: rows MUST be introspectable by column name, so that
|
||||
// the record can pick the columns it wants.
|
||||
//
|
||||
// 2. Fetched records MUST be flagged as having no change.
|
||||
|
||||
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
|
||||
let db = try! Connection(databasePath)
|
||||
|
||||
// Column access by name requires query builder.
|
||||
let items = Table("items")
|
||||
let i0 = Expression<Int>("i0")
|
||||
let i1 = Expression<Int>("i1")
|
||||
let i2 = Expression<Int>("i2")
|
||||
let i3 = Expression<Int>("i3")
|
||||
let i4 = Expression<Int>("i4")
|
||||
let i5 = Expression<Int>("i5")
|
||||
let i6 = Expression<Int>("i6")
|
||||
let i7 = Expression<Int>("i7")
|
||||
let i8 = Expression<Int>("i8")
|
||||
let i9 = Expression<Int>("i9")
|
||||
|
||||
func dictionaryFromRow(row: SQLite.Row) -> [NSObject: AnyObject] {
|
||||
return [
|
||||
"i0": row[i0],
|
||||
"i1": row[i1],
|
||||
"i2": row[i2],
|
||||
"i3": row[i3],
|
||||
"i4": row[i4],
|
||||
"i5": row[i5],
|
||||
"i6": row[i6],
|
||||
"i7": row[i7],
|
||||
"i8": row[i8],
|
||||
"i9": row[i9]] as [NSObject: AnyObject]
|
||||
}
|
||||
|
||||
self.measureBlock {
|
||||
var records = [PerformanceRecord]()
|
||||
for row in db.prepare(items) {
|
||||
// SQLite.swift does not provide rows that are introspectable:
|
||||
// build our own Row.
|
||||
let dictionary = dictionaryFromRow(row)
|
||||
let record = PerformanceRecord(dictionary: dictionary)
|
||||
record.databaseEdited = false // Needs to be explicit: GRDB does it implicitly.
|
||||
records.append(record)
|
||||
}
|
||||
XCTAssertEqual(records[4].i2, 1)
|
||||
XCTAssertEqual(records[4].i3, 0)
|
||||
XCTAssertEqual(records[5].i2, 2)
|
||||
XCTAssertEqual(records[5].i3, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
Submodule GRDB Tests/Performance/fmdb deleted from ed8362d846.
@@ -1,37 +0,0 @@
|
||||
//import XCTest
|
||||
//@testable import GRDB
|
||||
//
|
||||
//class DatabaseErrorFromStatementCreationTests: GRDBTestCase {
|
||||
//
|
||||
// func testDatabaseErrorThrownBySelectStatementContainSQL() {
|
||||
// dbQueue.inDatabase { db in
|
||||
// do {
|
||||
// let _ = try SelectStatement(database: db, sql: "SELECT * FROM blah")
|
||||
// XCTFail()
|
||||
// } catch let error as DatabaseError {
|
||||
// XCTAssertEqual(error.code, 1)
|
||||
// XCTAssertEqual(error.message!, "no such table: blah")
|
||||
// XCTAssertEqual(error.sql!, "SELECT * FROM blah")
|
||||
// XCTAssertEqual(error.description, "SQLite error 1 with statement `SELECT * FROM blah`: no such table: blah")
|
||||
// } catch {
|
||||
// XCTFail("\(error)")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// func testDatabaseErrorThrownByUpdateStatementContainSQL() {
|
||||
// dbQueue.inDatabase { db in
|
||||
// do {
|
||||
// let _ = try UpdateStatement(database: db, sql: "UPDATE blah SET id = 12")
|
||||
// XCTFail()
|
||||
// } catch let error as DatabaseError {
|
||||
// XCTAssertEqual(error.code, 1)
|
||||
// XCTAssertEqual(error.message!, "no such table: blah")
|
||||
// XCTAssertEqual(error.sql!, "UPDATE blah SET id = 12")
|
||||
// XCTAssertEqual(error.description, "SQLite error 1 with statement `UPDATE blah SET id = 12`: no such table: blah")
|
||||
// } catch {
|
||||
// XCTFail("\(error)")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,56 +0,0 @@
|
||||
import XCTest
|
||||
@testable import GRDB
|
||||
|
||||
class NSDataMemoryTests: GRDBTestCase {
|
||||
|
||||
func testMemoryBehavior() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE datas (data BLOB)")
|
||||
|
||||
let data = "foo".dataUsingEncoding(NSUTF8StringEncoding)
|
||||
try db.execute("INSERT INTO datas (data) VALUES (?)", arguments: [data])
|
||||
|
||||
for row in Row.fetch(db, "SELECT * FROM datas") {
|
||||
let sqliteStatement = row.sqliteStatement
|
||||
let sqliteBytes = sqlite3_column_blob(sqliteStatement, 0)
|
||||
|
||||
do {
|
||||
// This data should be copied:
|
||||
let copiedData: NSData = row.value(atIndex: 0)
|
||||
XCTAssertNotEqual(copiedData.bytes, sqliteBytes)
|
||||
XCTAssertEqual(copiedData, data)
|
||||
}
|
||||
|
||||
do {
|
||||
// This data should not be copied
|
||||
let nonCopiedData = row.dataNoCopy(atIndex: 0)!
|
||||
XCTAssertEqual(nonCopiedData.bytes, sqliteBytes)
|
||||
XCTAssertEqual(nonCopiedData, data)
|
||||
}
|
||||
}
|
||||
|
||||
let row = Row.fetchOne(db, "SELECT * FROM datas")!
|
||||
let databaseValue = row.first!.1
|
||||
switch databaseValue.storage {
|
||||
case .Blob(let data):
|
||||
do {
|
||||
// This data should not be copied:
|
||||
let nonCopiedData: NSData = row.value(atIndex: 0)
|
||||
XCTAssertEqual(nonCopiedData.bytes, data.bytes)
|
||||
XCTAssertEqual(nonCopiedData, data)
|
||||
}
|
||||
|
||||
do {
|
||||
// This data should not be copied:
|
||||
let nonCopiedData = row.dataNoCopy(atIndex: 0)!
|
||||
XCTAssertEqual(nonCopiedData.bytes, data.bytes)
|
||||
XCTAssertEqual(nonCopiedData, data)
|
||||
}
|
||||
default:
|
||||
XCTFail("Not a blob")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,408 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class ConcurrencyTests: XCTestCase {
|
||||
var databasePath: String!
|
||||
var busyCallback: BusyCallback?
|
||||
|
||||
var dbQueue1: DatabaseQueue!
|
||||
var dbLog1: [String]!
|
||||
|
||||
var dbQueue2: DatabaseQueue!
|
||||
var dbLog2: [String]!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
databasePath = "/tmp/GRDBConcurrencyTests.sqlite"
|
||||
do { try NSFileManager.defaultManager().removeItemAtPath(databasePath) } catch { }
|
||||
self.busyCallback = nil
|
||||
let busyCallback: BusyCallback = {
|
||||
if let busyCallback = self.busyCallback {
|
||||
return busyCallback(numberOfTries: $0)
|
||||
} else {
|
||||
// Default give up
|
||||
return false
|
||||
}
|
||||
}
|
||||
var baseConfiguration = Configuration()
|
||||
baseConfiguration.trace = LogSQL
|
||||
baseConfiguration.busyMode = .Callback(busyCallback)
|
||||
|
||||
dbLog1 = []
|
||||
var configuration1 = baseConfiguration
|
||||
configuration1.trace = { (sql) in
|
||||
// NSLog("Queue 1: %@", sql)
|
||||
self.dbLog1.append(sql)
|
||||
}
|
||||
dbQueue1 = try! DatabaseQueue(path: databasePath, configuration: configuration1)
|
||||
|
||||
dbLog2 = []
|
||||
var configuration2 = baseConfiguration
|
||||
configuration2.trace = { (sql) in
|
||||
// NSLog("Queue 2: %@", sql)
|
||||
self.dbLog2.append(sql)
|
||||
}
|
||||
dbQueue2 = try! DatabaseQueue(path: databasePath, configuration: configuration2)
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
dbQueue1 = nil
|
||||
dbQueue2 = nil
|
||||
try! NSFileManager.defaultManager().removeItemAtPath(databasePath)
|
||||
}
|
||||
|
||||
func testDeferredTransactionConcurrency() {
|
||||
// Queue 1 Queue 2
|
||||
// BEGIN DEFERRED TRANSACTION
|
||||
let s1 = dispatch_semaphore_create(0)
|
||||
// BEGIN DEFERRED TRANSACTION
|
||||
let s2 = dispatch_semaphore_create(0)
|
||||
// INSERT INTO stuffs (id) VALUES (NULL)
|
||||
let s3 = dispatch_semaphore_create(0)
|
||||
// INSERT INTO stuffs (id) VALUES (NULL) <--- Error
|
||||
// ROLLBACK
|
||||
let s4 = dispatch_semaphore_create(0)
|
||||
// COMMIT
|
||||
|
||||
try! dbQueue1.inDatabase { db in
|
||||
try db.execute("CREATE TABLE stuffs (id INTEGER PRIMARY KEY)")
|
||||
}
|
||||
|
||||
let queue = dispatch_queue_create("com.github.groue.GRDB", DISPATCH_QUEUE_CONCURRENT)
|
||||
let group = dispatch_group_create()
|
||||
|
||||
// Queue 1
|
||||
dispatch_group_async(group, queue) {
|
||||
do {
|
||||
try self.dbQueue1.inTransaction(.Deferred) { db in
|
||||
dispatch_semaphore_signal(s1)
|
||||
dispatch_semaphore_wait(s2, DISPATCH_TIME_FOREVER)
|
||||
try db.execute("INSERT INTO stuffs (id) VALUES (NULL)")
|
||||
dispatch_semaphore_signal(s3)
|
||||
dispatch_semaphore_wait(s4, DISPATCH_TIME_FOREVER)
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
// Queue 2
|
||||
var concurrencyError: DatabaseError? = nil
|
||||
dispatch_group_async(group, queue) {
|
||||
do {
|
||||
dispatch_semaphore_wait(s1, DISPATCH_TIME_FOREVER)
|
||||
try self.dbQueue2.inTransaction(.Deferred) { db in
|
||||
dispatch_semaphore_signal(s2)
|
||||
dispatch_semaphore_wait(s3, DISPATCH_TIME_FOREVER)
|
||||
try db.execute("INSERT INTO stuffs (id) VALUES (NULL)")
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
catch let error as DatabaseError {
|
||||
dispatch_semaphore_signal(s4)
|
||||
concurrencyError = error
|
||||
}
|
||||
catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
|
||||
|
||||
if let concurrencyError = concurrencyError {
|
||||
XCTAssertEqual(concurrencyError.code, 5) // SQLITE_BUSY
|
||||
XCTAssertEqual(concurrencyError.sql, "INSERT INTO stuffs (id) VALUES (NULL)")
|
||||
} else {
|
||||
XCTFail("Expected concurrency error")
|
||||
}
|
||||
}
|
||||
|
||||
func testExclusiveTransactionConcurrency() {
|
||||
// Queue 1 Queue 2
|
||||
// BEGIN EXCLUSIVE TRANSACTION
|
||||
let s1 = dispatch_semaphore_create(0)
|
||||
// BEGIN EXCLUSIVE TRANSACTION <--- Error
|
||||
let s2 = dispatch_semaphore_create(0)
|
||||
// COMMIT
|
||||
|
||||
let queue = dispatch_queue_create("com.github.groue.GRDB", DISPATCH_QUEUE_CONCURRENT)
|
||||
let group = dispatch_group_create()
|
||||
|
||||
// Queue 1
|
||||
dispatch_group_async(group, queue) {
|
||||
do {
|
||||
try self.dbQueue1.inTransaction(.Exclusive) { db in
|
||||
dispatch_semaphore_signal(s1)
|
||||
dispatch_semaphore_wait(s2, DISPATCH_TIME_FOREVER)
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
// Queue 2
|
||||
var concurrencyError: DatabaseError? = nil
|
||||
dispatch_group_async(group, queue) {
|
||||
do {
|
||||
dispatch_semaphore_wait(s1, DISPATCH_TIME_FOREVER)
|
||||
try self.dbQueue2.inTransaction(.Exclusive) { db in
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
catch let error as DatabaseError {
|
||||
dispatch_semaphore_signal(s2)
|
||||
concurrencyError = error
|
||||
}
|
||||
catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
|
||||
|
||||
if let concurrencyError = concurrencyError {
|
||||
XCTAssertEqual(concurrencyError.code, 5) // SQLITE_BUSY
|
||||
XCTAssertEqual(concurrencyError.sql, "BEGIN EXCLUSIVE TRANSACTION")
|
||||
} else {
|
||||
XCTFail("Expected concurrency error")
|
||||
}
|
||||
}
|
||||
|
||||
func testImmediateTransactionConcurrency() {
|
||||
// Queue 1 Queue 2
|
||||
// BEGIN IMMEDIATE TRANSACTION
|
||||
let s1 = dispatch_semaphore_create(0)
|
||||
// BEGIN IMMEDIATE TRANSACTION <--- Error
|
||||
let s2 = dispatch_semaphore_create(0)
|
||||
// COMMIT
|
||||
|
||||
let queue = dispatch_queue_create("com.github.groue.GRDB", DISPATCH_QUEUE_CONCURRENT)
|
||||
let group = dispatch_group_create()
|
||||
|
||||
// Queue 1
|
||||
dispatch_group_async(group, queue) {
|
||||
do {
|
||||
try self.dbQueue1.inTransaction(.Immediate) { db in
|
||||
dispatch_semaphore_signal(s1)
|
||||
dispatch_semaphore_wait(s2, DISPATCH_TIME_FOREVER)
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
// Queue 2
|
||||
var concurrencyError: DatabaseError? = nil
|
||||
dispatch_group_async(group, queue) {
|
||||
do {
|
||||
dispatch_semaphore_wait(s1, DISPATCH_TIME_FOREVER)
|
||||
try self.dbQueue2.inTransaction(.Immediate) { db in
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
catch let error as DatabaseError {
|
||||
dispatch_semaphore_signal(s2)
|
||||
concurrencyError = error
|
||||
}
|
||||
catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
|
||||
|
||||
if let concurrencyError = concurrencyError {
|
||||
XCTAssertEqual(concurrencyError.code, 5) // SQLITE_BUSY
|
||||
XCTAssertEqual(concurrencyError.sql, "BEGIN IMMEDIATE TRANSACTION")
|
||||
} else {
|
||||
XCTFail("Expected concurrency error")
|
||||
}
|
||||
}
|
||||
|
||||
func testBusyCallback() {
|
||||
// Queue 1 Queue 2
|
||||
// BEGIN EXCLUSIVE TRANSACTION
|
||||
let s1 = dispatch_semaphore_create(0)
|
||||
// (Waiting) BEGIN EXCLUSIVE TRANSACTION <--- Busy
|
||||
// (Waiting) BEGIN EXCLUSIVE TRANSACTION <--- Busy
|
||||
// (Waiting) BEGIN EXCLUSIVE TRANSACTION <--- Busy
|
||||
// COMMIT
|
||||
// BEGIN EXCLUSIVE TRANSACTION
|
||||
// COMMIT
|
||||
|
||||
var numberOfTries = 0
|
||||
self.busyCallback = { n in
|
||||
numberOfTries = n
|
||||
usleep(10_000) // 0.01s
|
||||
return true
|
||||
}
|
||||
|
||||
let queue = dispatch_queue_create("com.github.groue.GRDB", DISPATCH_QUEUE_CONCURRENT)
|
||||
let group = dispatch_group_create()
|
||||
|
||||
// Queue 1
|
||||
dispatch_group_async(group, queue) {
|
||||
do {
|
||||
try self.dbQueue1.inTransaction(.Exclusive) { db in
|
||||
dispatch_semaphore_signal(s1)
|
||||
usleep(100_000) // 0.1s
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
// Queue 2
|
||||
dispatch_group_async(group, queue) {
|
||||
do {
|
||||
dispatch_semaphore_wait(s1, DISPATCH_TIME_FOREVER)
|
||||
try self.dbQueue2.inTransaction(.Exclusive) { db in
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
|
||||
|
||||
XCTAssertTrue(numberOfTries > 0) // Busy handler has been used.
|
||||
}
|
||||
|
||||
func testReaderDuringDefaultTransaction() {
|
||||
// Here we test that a reader can read while a writer is writing.
|
||||
|
||||
// Queue 1 Queue 2
|
||||
// BEGIN IMMEDIATE TRANSACTION
|
||||
// INSERT INTO stuffs (id) VALUES (NULL)
|
||||
let s1 = dispatch_semaphore_create(0)
|
||||
// SELECT * FROM stuffs <--- 0 result
|
||||
let s2 = dispatch_semaphore_create(0)
|
||||
// COMMIT
|
||||
let s3 = dispatch_semaphore_create(0)
|
||||
// SELECT * FROM stuffs <--- 1 result
|
||||
|
||||
try! dbQueue1.inDatabase { db in
|
||||
try db.execute("CREATE TABLE stuffs (id INTEGER PRIMARY KEY)")
|
||||
}
|
||||
|
||||
let queue = dispatch_queue_create("com.github.groue.GRDB", DISPATCH_QUEUE_CONCURRENT)
|
||||
let group = dispatch_group_create()
|
||||
|
||||
// Queue 1
|
||||
dispatch_group_async(group, queue) {
|
||||
do {
|
||||
try self.dbQueue1.inTransaction { db in
|
||||
try db.execute("INSERT INTO stuffs (id) VALUES (NULL)")
|
||||
dispatch_semaphore_signal(s1)
|
||||
dispatch_semaphore_wait(s2, DISPATCH_TIME_FOREVER)
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
dispatch_semaphore_signal(s3)
|
||||
}
|
||||
|
||||
// Queue 2
|
||||
var rows1: [Row]?
|
||||
var rows2: [Row]?
|
||||
dispatch_group_async(group, queue) {
|
||||
self.dbQueue2.inDatabase { db in
|
||||
dispatch_semaphore_wait(s1, DISPATCH_TIME_FOREVER)
|
||||
rows1 = Row.fetchAll(db, "SELECT * FROM stuffs")
|
||||
dispatch_semaphore_signal(s2)
|
||||
dispatch_semaphore_wait(s3, DISPATCH_TIME_FOREVER)
|
||||
rows2 = Row.fetchAll(db, "SELECT * FROM stuffs")
|
||||
}
|
||||
}
|
||||
|
||||
dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
|
||||
|
||||
XCTAssertEqual(rows1!.count, 0) // uncommitted changes are not visible
|
||||
XCTAssertEqual(rows2!.count, 1) // committed changes are visible
|
||||
}
|
||||
|
||||
func testReaderInDeferredTransactionDuringDefaultTransaction() {
|
||||
// The `SELECT * FROM stuffs` statement of Queue 2 prevents Queue 1
|
||||
// from committing with SQLITE_BUSY.
|
||||
//
|
||||
// Without this select, the Queue 2 COMMIT succeeds right away.
|
||||
//
|
||||
// Both facts are unexpected.
|
||||
//
|
||||
//
|
||||
// Queue 1 Queue 2
|
||||
// BEGIN IMMEDIATE TRANSACTION
|
||||
// INSERT INTO stuffs (id) VALUES (NULL)
|
||||
let s1 = dispatch_semaphore_create(0)
|
||||
// BEGIN DEFERRED TRANSACTION
|
||||
// SELECT * FROM stuffs
|
||||
let s2 = dispatch_semaphore_create(0)
|
||||
// COMMIT <--- Busy (Waiting)
|
||||
// COMMIT <--- Busy (Waiting)
|
||||
// COMMIT
|
||||
// COMMIT
|
||||
|
||||
var numberOfTries = 0
|
||||
self.busyCallback = { n in
|
||||
numberOfTries = n
|
||||
usleep(10_000) // 0.01s
|
||||
return true
|
||||
}
|
||||
|
||||
try! dbQueue1.inDatabase { db in
|
||||
try db.execute("CREATE TABLE stuffs (id INTEGER PRIMARY KEY)")
|
||||
}
|
||||
|
||||
let queue = dispatch_queue_create("com.github.groue.GRDB", DISPATCH_QUEUE_CONCURRENT)
|
||||
let group = dispatch_group_create()
|
||||
|
||||
// Queue 1
|
||||
dispatch_group_async(group, queue) {
|
||||
do {
|
||||
try self.dbQueue1.inTransaction { db in
|
||||
try db.execute("INSERT INTO stuffs (id) VALUES (NULL)")
|
||||
dispatch_semaphore_signal(s1)
|
||||
dispatch_semaphore_wait(s2, DISPATCH_TIME_FOREVER)
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
// Queue 2
|
||||
dispatch_group_async(group, queue) {
|
||||
do {
|
||||
dispatch_semaphore_wait(s1, DISPATCH_TIME_FOREVER)
|
||||
try self.dbQueue2.inTransaction(.Deferred) { db in
|
||||
Row.fetchAll(db, "SELECT * FROM stuffs")
|
||||
dispatch_semaphore_signal(s2)
|
||||
usleep(100_000) // 0.1s
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
|
||||
|
||||
XCTAssertTrue(numberOfTries > 0) // Busy handler has been used.
|
||||
}
|
||||
}
|
||||
@@ -1,291 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class DatabaseTests : GRDBTestCase {
|
||||
|
||||
func testCreateTable() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
XCTAssertFalse(db.tableExists("persons"))
|
||||
try db.execute(
|
||||
"CREATE TABLE persons (" +
|
||||
"id INTEGER PRIMARY KEY, " +
|
||||
"name TEXT, " +
|
||||
"age INT)")
|
||||
XCTAssertTrue(db.tableExists("persons"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testMultipleStatementsWithoutArguments() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
XCTAssertFalse(db.tableExists("persons"))
|
||||
XCTAssertFalse(db.tableExists("pets"))
|
||||
try db.executeMultiStatement(
|
||||
"CREATE TABLE persons (id INTEGER PRIMARY KEY, name TEXT, age INT);" +
|
||||
"CREATE TABLE pets (id INTEGER PRIMARY KEY, name TEXT, age INT);")
|
||||
XCTAssertTrue(db.tableExists("persons"))
|
||||
XCTAssertTrue(db.tableExists("pets"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testUpdateStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
|
||||
|
||||
// The tested function:
|
||||
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES ('Arthur', 41)")
|
||||
try statement.execute()
|
||||
|
||||
let row = Row.fetchOne(db, "SELECT * FROM persons")!
|
||||
XCTAssertEqual(row.value(atIndex: 0) as String, "Arthur")
|
||||
XCTAssertEqual(row.value(atIndex: 1) as Int, 41)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testUpdateStatementWithArrayBinding() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
|
||||
|
||||
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES (?, ?)")
|
||||
try statement.execute(arguments: ["Arthur", 41])
|
||||
|
||||
let row = Row.fetchOne(db, "SELECT * FROM persons")!
|
||||
XCTAssertEqual(row.value(atIndex: 0) as String, "Arthur")
|
||||
XCTAssertEqual(row.value(atIndex: 1) as Int, 41)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testUpdateStatementWithDictionaryBinding() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
|
||||
|
||||
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES (:name, :age)")
|
||||
try statement.execute(arguments: ["name": "Arthur", "age": 41])
|
||||
|
||||
let row = Row.fetchOne(db, "SELECT * FROM persons")!
|
||||
XCTAssertEqual(row.value(atIndex: 0) as String, "Arthur")
|
||||
XCTAssertEqual(row.value(atIndex: 1) as Int, 41)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testDatabaseExecute() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
|
||||
|
||||
// The tested function:
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES ('Arthur', 41)")
|
||||
|
||||
let row = Row.fetchOne(db, "SELECT * FROM persons")!
|
||||
XCTAssertEqual(row.value(atIndex: 0) as String, "Arthur")
|
||||
XCTAssertEqual(row.value(atIndex: 1) as Int, 41)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testChangesReturnedByDatabaseExecute() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (id INTEGER PRIMARY KEY, name TEXT)")
|
||||
|
||||
let changes1 = try db.execute("INSERT INTO persons (name) VALUES ('Arthur')")
|
||||
XCTAssertEqual(changes1.changedRowCount, 1)
|
||||
XCTAssertEqual(changes1.insertedRowID, 1)
|
||||
|
||||
let changes2 = try db.execute("INSERT INTO persons (name) VALUES (?)", arguments: ["Barbara"])
|
||||
XCTAssertEqual(changes2.changedRowCount, 1)
|
||||
XCTAssertEqual(changes2.insertedRowID, 2)
|
||||
|
||||
let changes3 = try db.execute("DELETE FROM persons")
|
||||
XCTAssertEqual(changes3.changedRowCount, 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testDatabaseExecuteWithArrayBinding() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
|
||||
|
||||
// The tested function:
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (?, ?)", arguments: ["Arthur", 41])
|
||||
|
||||
let row = Row.fetchOne(db, "SELECT * FROM persons")!
|
||||
XCTAssertEqual(row.value(atIndex: 0) as String, "Arthur")
|
||||
XCTAssertEqual(row.value(atIndex: 1) as Int, 41)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testDatabaseExecuteWithDictionaryBinding() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
|
||||
|
||||
// The tested function:
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Arthur", "age": 41])
|
||||
|
||||
let row = Row.fetchOne(db, "SELECT * FROM persons")!
|
||||
XCTAssertEqual(row.value(atIndex: 0) as String, "Arthur")
|
||||
XCTAssertEqual(row.value(atIndex: 1) as Int, 41)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testSelectStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Arthur", "age": 41])
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Barbara", "age": nil])
|
||||
|
||||
let statement = db.selectStatement("SELECT * FROM persons")
|
||||
let rows = Row.fetchAll(statement)
|
||||
XCTAssertEqual(rows.count, 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testSelectStatementWithArrayBinding() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Arthur", "age": 41])
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Barbara", "age": nil])
|
||||
|
||||
let statement = db.selectStatement("SELECT * FROM persons WHERE name = ?")
|
||||
let rows = Row.fetchAll(statement, arguments: ["Arthur"])
|
||||
XCTAssertEqual(rows.count, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testSelectStatementWithDictionaryBinding() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Arthur", "age": 41])
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Barbara", "age": nil])
|
||||
|
||||
let statement = db.selectStatement("SELECT * FROM persons WHERE name = :name")
|
||||
let rows = Row.fetchAll(statement, arguments: ["name": "Arthur"])
|
||||
XCTAssertEqual(rows.count, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowValueAtIndex() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Arthur", "age": 41])
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Barbara", "age": nil])
|
||||
|
||||
var names: [String?] = []
|
||||
var ages: [Int?] = []
|
||||
let rows = Row.fetch(db, "SELECT * FROM persons ORDER BY name")
|
||||
for row in rows {
|
||||
// The tested function:
|
||||
let name: String? = row.value(atIndex: 0)
|
||||
let age: Int? = row.value(atIndex: 1)
|
||||
names.append(name)
|
||||
ages.append(age)
|
||||
}
|
||||
|
||||
XCTAssertEqual(names[0]!, "Arthur")
|
||||
XCTAssertEqual(names[1]!, "Barbara")
|
||||
XCTAssertEqual(ages[0]!, 41)
|
||||
XCTAssertNil(ages[1])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowValueNamed() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Arthur", "age": 41])
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Barbara", "age": nil])
|
||||
|
||||
var names: [String?] = []
|
||||
var ages: [Int?] = []
|
||||
let rows = Row.fetch(db, "SELECT * FROM persons ORDER BY name")
|
||||
for row in rows {
|
||||
// The tested function:
|
||||
let name: String? = row.value(named: "name")
|
||||
let age: Int? = row.value(named: "age")
|
||||
names.append(name)
|
||||
ages.append(age)
|
||||
}
|
||||
|
||||
XCTAssertEqual(names[0]!, "Arthur")
|
||||
XCTAssertEqual(names[1]!, "Barbara")
|
||||
XCTAssertEqual(ages[0]!, 41)
|
||||
XCTAssertNil(ages[1])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowSequenceCanBeIteratedTwice() {
|
||||
assertNoError {
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT)")
|
||||
try db.execute("INSERT INTO persons (name) VALUES (:name)", arguments: ["name": "Arthur"])
|
||||
try db.execute("INSERT INTO persons (name) VALUES (:name)", arguments: ["name": "Barbara"])
|
||||
|
||||
let rows = Row.fetch(db, "SELECT * FROM persons ORDER BY name")
|
||||
var names1: [String?] = rows.map { $0.value(named: "name") as String? }
|
||||
var names2: [String?] = rows.map { $0.value(named: "name") as String? }
|
||||
|
||||
XCTAssertEqual(names1[0]!, "Arthur")
|
||||
XCTAssertEqual(names1[1]!, "Barbara")
|
||||
XCTAssertEqual(names2[0]!, "Arthur")
|
||||
XCTAssertEqual(names2[1]!, "Barbara")
|
||||
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testValueSequenceCanBeIteratedTwice() {
|
||||
assertNoError {
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT)")
|
||||
try db.execute("INSERT INTO persons (name) VALUES (:name)", arguments: ["name": "Arthur"])
|
||||
try db.execute("INSERT INTO persons (name) VALUES (:name)", arguments: ["name": "Barbara"])
|
||||
|
||||
let nameSequence = String.fetch(db, "SELECT name FROM persons ORDER BY name")
|
||||
var names1 = Array(nameSequence)
|
||||
var names2 = Array(nameSequence)
|
||||
|
||||
XCTAssertEqual(names1[0], "Arthur")
|
||||
XCTAssertEqual(names1[1], "Barbara")
|
||||
XCTAssertEqual(names2[0], "Arthur")
|
||||
XCTAssertEqual(names2[1], "Barbara")
|
||||
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testDatabaseCanBeUsedOutsideOfDatabaseQueueBlockAsLongAsTheQueueIsCorrect() {
|
||||
assertNoError {
|
||||
var database: Database? = nil
|
||||
dbQueue.inDatabase { db in
|
||||
database = db
|
||||
}
|
||||
try dbQueue.inDatabase { _ in
|
||||
try database!.execute("CREATE TABLE persons (name TEXT)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class InMemoryDatabaseTests : GRDBTestCase
|
||||
{
|
||||
func testInMemoryDatabase() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("CREATE TABLE foo (bar TEXT)")
|
||||
try db.execute("INSERT INTO foo (bar) VALUES ('baz')")
|
||||
let baz = String.fetchOne(db, "SELECT bar FROM foo")!
|
||||
XCTAssertEqual(baz, "baz")
|
||||
return .Rollback
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class DatabaseErrorTests: GRDBTestCase {
|
||||
|
||||
func testDatabaseErrorInTransaction() {
|
||||
do {
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("CREATE TABLE persons (id INTEGER PRIMARY KEY)")
|
||||
try db.execute("CREATE TABLE pets (masterId INTEGER NOT NULL REFERENCES persons(id), name TEXT)")
|
||||
self.sqlQueries.removeAll()
|
||||
try db.execute("INSERT INTO pets (masterId, name) VALUES (?, ?)", arguments: [1, "Bobby"])
|
||||
return .Commit
|
||||
}
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.code, 19) // SQLITE_CONSTRAINT
|
||||
XCTAssertEqual(error.message!, "FOREIGN KEY constraint failed")
|
||||
XCTAssertEqual(error.sql!, "INSERT INTO pets (masterId, name) VALUES (?, ?)")
|
||||
XCTAssertEqual(error.description, "SQLite error 19 with statement `INSERT INTO pets (masterId, name) VALUES (?, ?)` arguments [1, \"Bobby\"]: FOREIGN KEY constraint failed")
|
||||
|
||||
XCTAssertEqual(sqlQueries.count, 2)
|
||||
XCTAssertEqual(sqlQueries[0], "INSERT INTO pets (masterId, name) VALUES (1, 'Bobby')")
|
||||
XCTAssertEqual(sqlQueries[1], "ROLLBACK TRANSACTION")
|
||||
} catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
func testDatabaseErrorThrownByUpdateStatementContainSQLAndArguments() {
|
||||
dbQueue.inDatabase { db in
|
||||
do {
|
||||
try db.execute("CREATE TABLE persons (id INTEGER PRIMARY KEY)")
|
||||
try db.execute("CREATE TABLE pets (masterId INTEGER NOT NULL REFERENCES persons(id), name TEXT)")
|
||||
try db.execute("INSERT INTO pets (masterId, name) VALUES (?, ?)", arguments: [1, "Bobby"])
|
||||
XCTFail()
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.code, 19) // SQLITE_CONSTRAINT
|
||||
XCTAssertEqual(error.message!, "FOREIGN KEY constraint failed")
|
||||
XCTAssertEqual(error.sql!, "INSERT INTO pets (masterId, name) VALUES (?, ?)")
|
||||
XCTAssertEqual(error.description, "SQLite error 19 with statement `INSERT INTO pets (masterId, name) VALUES (?, ?)` arguments [1, \"Bobby\"]: FOREIGN KEY constraint failed")
|
||||
} catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testDatabaseErrorThrownByExecuteMultiStatementContainSQL() {
|
||||
dbQueue.inDatabase { db in
|
||||
do {
|
||||
try db.executeMultiStatement(
|
||||
"CREATE TABLE persons (id INTEGER PRIMARY KEY, name TEXT, age INT);" +
|
||||
"CREATE TABLE pets (masterId INTEGER NOT NULL REFERENCES persons(id), name TEXT);" +
|
||||
"INSERT INTO pets (masterId, name) VALUES (1, 'Bobby')")
|
||||
XCTFail()
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.code, 19) // SQLITE_CONSTRAINT
|
||||
XCTAssertEqual(error.message!, "FOREIGN KEY constraint failed")
|
||||
XCTAssertEqual(error.sql!, "CREATE TABLE persons (id INTEGER PRIMARY KEY, name TEXT, age INT);CREATE TABLE pets (masterId INTEGER NOT NULL REFERENCES persons(id), name TEXT);INSERT INTO pets (masterId, name) VALUES (1, \'Bobby\')")
|
||||
XCTAssertEqual(error.description, "SQLite error 19 with statement `CREATE TABLE persons (id INTEGER PRIMARY KEY, name TEXT, age INT);CREATE TABLE pets (masterId INTEGER NOT NULL REFERENCES persons(id), name TEXT);INSERT INTO pets (masterId, name) VALUES (1, \'Bobby\')`: FOREIGN KEY constraint failed")
|
||||
} catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class DatabaseValueTests: GRDBTestCase {
|
||||
|
||||
func testDatabaseValueAdoptsDatabaseValueConvertible() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE integers (integer INTEGER)")
|
||||
try db.execute("INSERT INTO integers (integer) VALUES (1)")
|
||||
let databaseValue: DatabaseValue = Row.fetchOne(db, "SELECT * FROM integers")!.value(named: "integer")! // Triggers DatabaseValue.init?(databaseValue: DatabaseValue)
|
||||
let count = Int.fetchOne(db, "SELECT COUNT(*) FROM integers WHERE integer = ?", arguments: [databaseValue])! // Triggers DatabaseValue.databaseValue
|
||||
XCTAssertEqual(count, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testDatabaseValueEquatable() {
|
||||
let fooData = "foo".dataUsingEncoding(NSUTF8StringEncoding)!
|
||||
let barData = "bar".dataUsingEncoding(NSUTF8StringEncoding)!
|
||||
|
||||
XCTAssertEqual(DatabaseValue.Null, DatabaseValue.Null)
|
||||
XCTAssertNotEqual(DatabaseValue.Null, DatabaseValue(int64: 1))
|
||||
XCTAssertNotEqual(DatabaseValue.Null, DatabaseValue(double: 1.0))
|
||||
XCTAssertNotEqual(DatabaseValue.Null, DatabaseValue(string: "foo"))
|
||||
XCTAssertNotEqual(DatabaseValue.Null, DatabaseValue(data: fooData))
|
||||
|
||||
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue.Null)
|
||||
XCTAssertEqual(DatabaseValue(int64: 1), DatabaseValue(int64: 1))
|
||||
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(int64: 2))
|
||||
XCTAssertEqual(DatabaseValue(int64: 1), DatabaseValue(double: 1.0))
|
||||
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(double: 1.1))
|
||||
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(double: 2.0))
|
||||
XCTAssertEqual(DatabaseValue(int64: 1 << 53), DatabaseValue(double: Double(1 << 53))) // Any integer up to 2^53 has an exact representation as a IEEE-754 double...
|
||||
XCTAssertNotEqual(DatabaseValue(int64: 1 << 53 + 1), DatabaseValue(double: Double(1 << 53 + 1))) // ... 2^53 + 1 does not....
|
||||
XCTAssertEqual(DatabaseValue(int64: 1 << 54), DatabaseValue(double: Double(1 << 54))) // ... but 2^54 does.
|
||||
XCTAssertNotEqual(DatabaseValue(int64: Int64.max), DatabaseValue(double: Double(Int64.max))) // ... and Int64.max does not.
|
||||
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(string: "foo"))
|
||||
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(string: "1"))
|
||||
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(string: "1.0"))
|
||||
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(data: fooData))
|
||||
|
||||
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue.Null)
|
||||
XCTAssertEqual(DatabaseValue(double: 1.0), DatabaseValue(int64: 1))
|
||||
XCTAssertNotEqual(DatabaseValue(double: 1.1), DatabaseValue(int64: 1))
|
||||
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue(int64: 2))
|
||||
XCTAssertEqual(DatabaseValue(double: 1.0), DatabaseValue(double: 1.0))
|
||||
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue(double: 2.0))
|
||||
XCTAssertEqual(DatabaseValue(double: Double(1 << 53)), DatabaseValue(int64: 1 << 53)) // Any integer up to 2^53 has an exact representation as a IEEE-754 double...
|
||||
XCTAssertNotEqual(DatabaseValue(double: Double(1 << 53 + 1)), DatabaseValue(int64: 1 << 53 + 1)) // ... 2^53 + 1 does not....
|
||||
XCTAssertEqual(DatabaseValue(double: Double(1 << 54)), DatabaseValue(int64: 1 << 54)) // ... but 2^54 does.
|
||||
XCTAssertNotEqual(DatabaseValue(double: Double(Int64.max)), DatabaseValue(int64: Int64.max)) // ... and Int64.max does not.
|
||||
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue(string: "foo"))
|
||||
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue(string: "1"))
|
||||
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue(string: "1.0"))
|
||||
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue(data: fooData))
|
||||
|
||||
XCTAssertNotEqual(DatabaseValue(string: "foo"), DatabaseValue.Null)
|
||||
XCTAssertNotEqual(DatabaseValue(string: "foo"), DatabaseValue(int64: 1))
|
||||
XCTAssertNotEqual(DatabaseValue(string: "foo"), DatabaseValue(double: 1.0))
|
||||
XCTAssertEqual(DatabaseValue(string: "foo"), DatabaseValue(string: "foo"))
|
||||
XCTAssertNotEqual(DatabaseValue(string: "foo"), DatabaseValue(string: "bar"))
|
||||
XCTAssertNotEqual(DatabaseValue(string: "foo"), DatabaseValue(data: fooData))
|
||||
|
||||
XCTAssertNotEqual(DatabaseValue(data: fooData), DatabaseValue.Null)
|
||||
XCTAssertNotEqual(DatabaseValue(data: fooData), DatabaseValue(int64: 1))
|
||||
XCTAssertNotEqual(DatabaseValue(data: fooData), DatabaseValue(double: 1.0))
|
||||
XCTAssertNotEqual(DatabaseValue(data: fooData), DatabaseValue(string: "foo"))
|
||||
XCTAssertEqual(DatabaseValue(data: fooData), DatabaseValue(data: fooData))
|
||||
XCTAssertNotEqual(DatabaseValue(data: fooData), DatabaseValue(data: barData))
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
struct DatabaseTimestamp: DatabaseValueConvertible {
|
||||
|
||||
// NSDate conversion
|
||||
//
|
||||
// We consistently use the Swift nil to represent the database NULL: the
|
||||
// date property is a non-optional NSDate, and the NSDate initializer is
|
||||
// failable:
|
||||
|
||||
/// The represented date
|
||||
let date: NSDate
|
||||
|
||||
/// Creates a DatabaseTimestamp from an NSDate.
|
||||
/// The result is nil if and only if *date* is nil.
|
||||
init?(_ date: NSDate?) {
|
||||
guard let date = date else {
|
||||
return nil
|
||||
}
|
||||
self.date = date
|
||||
}
|
||||
|
||||
|
||||
// DatabaseValueConvertible adoption
|
||||
|
||||
/// Returns a value that can be stored in the database.
|
||||
var databaseValue: DatabaseValue {
|
||||
return DatabaseValue(double: date.timeIntervalSince1970)
|
||||
}
|
||||
|
||||
/// Returns an instance initialized from *databaseValue*, if possible.
|
||||
static func fromDatabaseValue(databaseValue: DatabaseValue) -> DatabaseTimestamp? {
|
||||
// Double itself adopts DatabaseValueConvertible. So let's avoid
|
||||
// handling the raw DatabaseValue, and use built-in Double conversion:
|
||||
guard let timeInterval = Double.fromDatabaseValue(databaseValue) else {
|
||||
// No Double, no NSDate!
|
||||
return nil
|
||||
}
|
||||
return DatabaseTimestamp(NSDate(timeIntervalSince1970: timeInterval))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DatabaseTimestampTests: GRDBTestCase {
|
||||
|
||||
func testDatabaseTimestamp() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE dates (date DATETIME)")
|
||||
let storedDate = NSDate()
|
||||
try db.execute("INSERT INTO dates (date) VALUES (?)", arguments: [DatabaseTimestamp(storedDate)])
|
||||
let fetchedDate = DatabaseTimestamp.fetchOne(db, "SELECT date FROM dates")!.date
|
||||
let delta = storedDate.timeIntervalSinceDate(fetchedDate)
|
||||
XCTAssertTrue(abs(delta) < 0.1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,817 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
enum SQLiteStorageClass {
|
||||
case Null
|
||||
case Integer
|
||||
case Real
|
||||
case Text
|
||||
case Blob
|
||||
}
|
||||
|
||||
extension DatabaseValue {
|
||||
var storageClass: SQLiteStorageClass {
|
||||
switch value() {
|
||||
case nil:
|
||||
return .Null
|
||||
case is Int64:
|
||||
return .Integer
|
||||
case is Double:
|
||||
return .Real
|
||||
case is String:
|
||||
return .Text
|
||||
case is NSData:
|
||||
return .Blob
|
||||
default:
|
||||
fatalError("Unexpected type")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DatabaseValueConversionTests : GRDBTestCase {
|
||||
|
||||
// Datatypes In SQLite Version 3: https://www.sqlite.org/datatype3.html
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.registerMigration("createPersons") { db in
|
||||
try db.execute(
|
||||
"CREATE TABLE `values` (" +
|
||||
"integerAffinity INTEGER, " +
|
||||
"textAffinity TEXT, " +
|
||||
"noneAffinity BLOB, " +
|
||||
"realAffinity DOUBLE, " +
|
||||
"numericAffinity NUMERIC" +
|
||||
")")
|
||||
}
|
||||
|
||||
assertNoError {
|
||||
try migrator.migrate(dbQueue)
|
||||
}
|
||||
}
|
||||
|
||||
func testTextAffinity() {
|
||||
// https://www.sqlite.org/datatype3.html
|
||||
//
|
||||
// > A column with TEXT affinity stores all data using storage classes
|
||||
// > NULL, TEXT or BLOB. If numerical data is inserted into a column
|
||||
// > with TEXT affinity it is converted into text form before being
|
||||
// > stored.
|
||||
|
||||
assertNoError {
|
||||
|
||||
// Int is turned to Text
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: [0 as Int])
|
||||
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
|
||||
|
||||
// Check GRDB conversions from Text storage:
|
||||
XCTAssertTrue((dbv.value() as Bool?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int32?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int64?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Double?) == nil)
|
||||
XCTAssertEqual((dbv.value() as String?)!, "0")
|
||||
XCTAssertEqual((dbv.value() as String), "0")
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Int64 is turned to Text
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: [0 as Int64])
|
||||
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
|
||||
|
||||
// Check GRDB conversions from Text storage:
|
||||
XCTAssertTrue((dbv.value() as Bool?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int32?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int64?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Double?) == nil)
|
||||
XCTAssertEqual((dbv.value() as String?)!, "0")
|
||||
XCTAssertEqual((dbv.value() as String), "0")
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Int32 is turned to Text
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: [0 as Int32])
|
||||
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
|
||||
|
||||
// Check GRDB conversions from Text storage:
|
||||
XCTAssertTrue((dbv.value() as Bool?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int32?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int64?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Double?) == nil)
|
||||
XCTAssertEqual((dbv.value() as String?)!, "0")
|
||||
XCTAssertEqual((dbv.value() as String), "0")
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Double is turned to Real
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: [0.0])
|
||||
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
|
||||
|
||||
// Check GRDB conversions from Text storage:
|
||||
XCTAssertTrue((dbv.value() as Bool?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int32?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int64?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Double?) == nil)
|
||||
XCTAssertEqual((dbv.value() as String?)!, "0.0")
|
||||
XCTAssertEqual((dbv.value() as String), "0.0")
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// "3.0e+5" is turned to Text
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: ["3.0e+5"])
|
||||
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
|
||||
|
||||
// Check GRDB conversions from Text storage:
|
||||
XCTAssertTrue((dbv.value() as Bool?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int32?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int64?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Double?) == nil)
|
||||
XCTAssertEqual((dbv.value() as String?)!, "3.0e+5")
|
||||
XCTAssertEqual((dbv.value() as String), "3.0e+5")
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// "foo" is turned to Text
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: ["foo"])
|
||||
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
|
||||
|
||||
// Check GRDB conversions from Text storage:
|
||||
XCTAssertTrue((dbv.value() as Bool?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int32?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int64?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Double?) == nil)
|
||||
XCTAssertEqual((dbv.value() as String?)!, "foo")
|
||||
XCTAssertEqual((dbv.value() as String), "foo")
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Blob is turned to Blob
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: ["foo".dataUsingEncoding(NSUTF8StringEncoding)])
|
||||
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Blob)
|
||||
|
||||
// Check GRDB conversions from Blob storage:
|
||||
XCTAssertTrue((dbv.value() as Bool?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int32?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int64?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Double?) == nil)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertEqual((dbv.value() as NSData?), "foo".dataUsingEncoding(NSUTF8StringEncoding))
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testNumericAffinity() {
|
||||
// https://www.sqlite.org/datatype3.html
|
||||
//
|
||||
// > A column with NUMERIC affinity may contain values using all five
|
||||
// > storage classes. When text data is inserted into a NUMERIC column,
|
||||
// > the storage class of the text is converted to INTEGER or REAL (in
|
||||
// > order of preference) if such conversion is lossless and reversible.
|
||||
// > For conversions between TEXT and REAL storage classes, SQLite
|
||||
// > considers the conversion to be lossless and reversible if the first
|
||||
// > 15 significant decimal digits of the number are preserved. If the
|
||||
// > lossless conversion of TEXT to INTEGER or REAL is not possible then
|
||||
// > the value is stored using the TEXT storage class. No attempt is
|
||||
// > made to convert NULL or BLOB values.
|
||||
// >
|
||||
// > A string might look like a floating-point literal with a decimal
|
||||
// > point and/or exponent notation but as long as the value can be
|
||||
// > expressed as an integer, the NUMERIC affinity will convert it into
|
||||
// > an integer. Hence, the string '3.0e+5' is stored in a column with
|
||||
// > NUMERIC affinity as the integer 300000, not as the floating point
|
||||
// > value 300000.0.
|
||||
|
||||
testNumericAffinity("numericAffinity")
|
||||
}
|
||||
|
||||
func testIntegerAffinity() {
|
||||
// https://www.sqlite.org/datatype3.html
|
||||
//
|
||||
// > A column that uses INTEGER affinity behaves the same as a column
|
||||
// > with NUMERIC affinity. The difference between INTEGER and NUMERIC
|
||||
// > affinity is only evident in a CAST expression.
|
||||
|
||||
testNumericAffinity("integerAffinity")
|
||||
}
|
||||
|
||||
func testRealAffinity() {
|
||||
// https://www.sqlite.org/datatype3.html
|
||||
//
|
||||
// > A column with REAL affinity behaves like a column with NUMERIC
|
||||
// > affinity except that it forces integer values into floating point
|
||||
// > representation. (As an internal optimization, small floating point
|
||||
// > values with no fractional component and stored in columns with REAL
|
||||
// > affinity are written to disk as integers in order to take up less
|
||||
// > space and are automatically converted back into floating point as
|
||||
// > the value is read out. This optimization is completely invisible at
|
||||
// > the SQL level and can only be detected by examining the raw bits of
|
||||
// > the database file.)
|
||||
|
||||
assertNoError {
|
||||
|
||||
// Int is turned to Real
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: [0 as Int])
|
||||
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
|
||||
|
||||
// Check GRDB conversions from Real storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, false)
|
||||
XCTAssertEqual((dbv.value() as Bool), false)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 0)
|
||||
XCTAssertEqual((dbv.value() as Int), 0)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
|
||||
XCTAssertEqual((dbv.value() as Double), 0.0)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Int64 is turned to Real
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: [0 as Int64])
|
||||
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
|
||||
|
||||
// Check GRDB conversions from Real storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, false)
|
||||
XCTAssertEqual((dbv.value() as Bool), false)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 0)
|
||||
XCTAssertEqual((dbv.value() as Int), 0)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
|
||||
XCTAssertEqual((dbv.value() as Double), 0.0)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Int32 is turned to Real
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: [0 as Int32])
|
||||
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
|
||||
|
||||
// Check GRDB conversions from Real storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, false)
|
||||
XCTAssertEqual((dbv.value() as Bool), false)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 0)
|
||||
XCTAssertEqual((dbv.value() as Int), 0)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
|
||||
XCTAssertEqual((dbv.value() as Double), 0.0)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// 3.0e5 Double is turned to Real
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: [3.0e5])
|
||||
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
|
||||
|
||||
// Check GRDB conversions from Real storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, true)
|
||||
XCTAssertEqual((dbv.value() as Bool), true)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 300000)
|
||||
XCTAssertEqual((dbv.value() as Int), 300000)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(300000))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(300000))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(300000))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(300000))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, Double(300000))
|
||||
XCTAssertEqual((dbv.value() as Double), Double(300000))
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// 1.0e20 Double is turned to Real
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: [1.0e20])
|
||||
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
|
||||
|
||||
// Check GRDB conversions from Real storage (avoid Int, Int32 and Int64 since 1.0e20 does not fit)
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, true)
|
||||
XCTAssertEqual((dbv.value() as Bool), true)
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 1e20)
|
||||
XCTAssertEqual((dbv.value() as Double), 1e20)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// "3.0e+5" is turned to Real
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: ["3.0e+5"])
|
||||
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
|
||||
|
||||
// Check GRDB conversions from Real storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, true)
|
||||
XCTAssertEqual((dbv.value() as Bool), true)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 300000)
|
||||
XCTAssertEqual((dbv.value() as Int), 300000)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(300000))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(300000))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(300000))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(300000))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, Double(300000))
|
||||
XCTAssertEqual((dbv.value() as Double), Double(300000))
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// "1.0e+20" is turned to Real
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: ["1.0e+20"])
|
||||
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
|
||||
|
||||
// Check GRDB conversions from Real storage: (avoid Int, Int32 and Int64 since 1.0e20 does not fit)
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, true)
|
||||
XCTAssertEqual((dbv.value() as Bool), true)
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 1e20)
|
||||
XCTAssertEqual((dbv.value() as Double), 1e20)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// "foo" is turned to Text
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: ["foo"])
|
||||
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
|
||||
|
||||
// Check GRDB conversions from Text storage:
|
||||
XCTAssertTrue((dbv.value() as Bool?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int32?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int64?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Double?) == nil)
|
||||
XCTAssertEqual((dbv.value() as String?)!, "foo")
|
||||
XCTAssertEqual((dbv.value() as String), "foo")
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Blob is turned to Blob
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: ["foo".dataUsingEncoding(NSUTF8StringEncoding)])
|
||||
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Blob)
|
||||
|
||||
// Check GRDB conversions from Blob storage:
|
||||
XCTAssertTrue((dbv.value() as Bool?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int32?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int64?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Double?) == nil)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertEqual((dbv.value() as NSData?), "foo".dataUsingEncoding(NSUTF8StringEncoding))
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testNoneAffinity() {
|
||||
// https://www.sqlite.org/datatype3.html
|
||||
//
|
||||
// > A column with affinity NONE does not prefer one storage class over
|
||||
// > another and no attempt is made to coerce data from one storage
|
||||
// > class into another.
|
||||
|
||||
assertNoError {
|
||||
|
||||
// Int is turned to Integer
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (noneAffinity) VALUES (?)", arguments: [0 as Int])
|
||||
let dbv = Row.fetchOne(db, "SELECT noneAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
|
||||
|
||||
// Check GRDB conversions from Integer storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, false)
|
||||
XCTAssertEqual((dbv.value() as Bool), false)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 0)
|
||||
XCTAssertEqual((dbv.value() as Int), 0)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
|
||||
XCTAssertEqual((dbv.value() as Double), 0.0)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Int64 is turned to Integer
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (noneAffinity) VALUES (?)", arguments: [0 as Int64])
|
||||
let dbv = Row.fetchOne(db, "SELECT noneAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
|
||||
|
||||
// Check GRDB conversions from Integer storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, false)
|
||||
XCTAssertEqual((dbv.value() as Bool), false)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 0)
|
||||
XCTAssertEqual((dbv.value() as Int), 0)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
|
||||
XCTAssertEqual((dbv.value() as Double), 0.0)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Int32 is turned to Integer
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (noneAffinity) VALUES (?)", arguments: [0 as Int32])
|
||||
let dbv = Row.fetchOne(db, "SELECT noneAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
|
||||
|
||||
// Check GRDB conversions from Integer storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, false)
|
||||
XCTAssertEqual((dbv.value() as Bool), false)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 0)
|
||||
XCTAssertEqual((dbv.value() as Int), 0)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
|
||||
XCTAssertEqual((dbv.value() as Double), 0.0)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Double is turned to Real
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (noneAffinity) VALUES (?)", arguments: [0.0])
|
||||
let dbv = Row.fetchOne(db, "SELECT noneAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
|
||||
|
||||
// Check GRDB conversions from Real storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, false)
|
||||
XCTAssertEqual((dbv.value() as Bool), false)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 0)
|
||||
XCTAssertEqual((dbv.value() as Int), 0)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
|
||||
XCTAssertEqual((dbv.value() as Double), 0.0)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// "3.0e+5" is turned to Text
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (noneAffinity) VALUES (?)", arguments: ["3.0e+5"])
|
||||
let dbv = Row.fetchOne(db, "SELECT noneAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
|
||||
|
||||
// Check GRDB conversions from Text storage
|
||||
XCTAssertTrue((dbv.value() as Bool?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int32?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int64?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Double?) == nil)
|
||||
XCTAssertEqual((dbv.value() as String?)!, "3.0e+5")
|
||||
XCTAssertEqual((dbv.value() as String), "3.0e+5")
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Blob is turned to Blob
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (noneAffinity) VALUES (?)", arguments: ["foo".dataUsingEncoding(NSUTF8StringEncoding)])
|
||||
let dbv = Row.fetchOne(db, "SELECT noneAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Blob)
|
||||
|
||||
// Check GRDB conversions from Blob storage
|
||||
XCTAssertTrue((dbv.value() as Bool?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int32?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int64?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Double?) == nil)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertEqual((dbv.value() as NSData?), "foo".dataUsingEncoding(NSUTF8StringEncoding))
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testNumericAffinity(columnName: String) {
|
||||
// https://www.sqlite.org/datatype3.html
|
||||
//
|
||||
// > A column with NUMERIC affinity may contain values using all five
|
||||
// > storage classes. When text data is inserted into a NUMERIC column,
|
||||
// > the storage class of the text is converted to INTEGER or REAL (in
|
||||
// > order of preference) if such conversion is lossless and reversible.
|
||||
// > For conversions between TEXT and REAL storage classes, SQLite
|
||||
// > considers the conversion to be lossless and reversible if the first
|
||||
// > 15 significant decimal digits of the number are preserved. If the
|
||||
// > lossless conversion of TEXT to INTEGER or REAL is not possible then
|
||||
// > the value is stored using the TEXT storage class. No attempt is
|
||||
// > made to convert NULL or BLOB values.
|
||||
// >
|
||||
// > A string might look like a floating-point literal with a decimal
|
||||
// > point and/or exponent notation but as long as the value can be
|
||||
// > expressed as an integer, the NUMERIC affinity will convert it into
|
||||
// > an integer. Hence, the string '3.0e+5' is stored in a column with
|
||||
// > NUMERIC affinity as the integer 300000, not as the floating point
|
||||
// > value 300000.0.
|
||||
|
||||
assertNoError {
|
||||
|
||||
// Int is turned to Integer
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: [0 as Int])
|
||||
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
|
||||
|
||||
// Check GRDB conversions from Integer storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, false)
|
||||
XCTAssertEqual((dbv.value() as Bool), false)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 0)
|
||||
XCTAssertEqual((dbv.value() as Int), 0)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
|
||||
XCTAssertEqual((dbv.value() as Double), 0.0)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Int64 is turned to Integer
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: [0 as Int64])
|
||||
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
|
||||
|
||||
// Check GRDB conversions from Integer storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, false)
|
||||
XCTAssertEqual((dbv.value() as Bool), false)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 0)
|
||||
XCTAssertEqual((dbv.value() as Int), 0)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
|
||||
XCTAssertEqual((dbv.value() as Double), 0.0)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Int32 is turned to Integer
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: [0 as Int32])
|
||||
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
|
||||
|
||||
// Check GRDB conversions from Integer storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, false)
|
||||
XCTAssertEqual((dbv.value() as Bool), false)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 0)
|
||||
XCTAssertEqual((dbv.value() as Int), 0)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(0))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(0))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
|
||||
XCTAssertEqual((dbv.value() as Double), 0.0)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// 3.0e5 Double is turned to Integer
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: [3.0e5])
|
||||
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
|
||||
|
||||
// Check GRDB conversions from Integer storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, true)
|
||||
XCTAssertEqual((dbv.value() as Bool), true)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 300000)
|
||||
XCTAssertEqual((dbv.value() as Int), 300000)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(300000))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(300000))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(300000))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(300000))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, Double(300000))
|
||||
XCTAssertEqual((dbv.value() as Double), Double(300000))
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// 1.0e20 Double is turned to Real
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: [1.0e20])
|
||||
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
|
||||
|
||||
// Check GRDB conversions from Real storage (avoid Int, Int32 and Int64 since 1.0e20 does not fit)
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, true)
|
||||
XCTAssertEqual((dbv.value() as Bool), true)
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 1e20)
|
||||
XCTAssertEqual((dbv.value() as Double), 1e20)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// "3.0e+5" is turned to Integer
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: ["3.0e+5"])
|
||||
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
|
||||
|
||||
// Check GRDB conversions from Integer storage
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, true)
|
||||
XCTAssertEqual((dbv.value() as Bool), true)
|
||||
XCTAssertEqual((dbv.value() as Int?)!, 300000)
|
||||
XCTAssertEqual((dbv.value() as Int), 300000)
|
||||
XCTAssertEqual((dbv.value() as Int32?)!, Int32(300000))
|
||||
XCTAssertEqual((dbv.value() as Int32), Int32(300000))
|
||||
XCTAssertEqual((dbv.value() as Int64?)!, Int64(300000))
|
||||
XCTAssertEqual((dbv.value() as Int64), Int64(300000))
|
||||
XCTAssertEqual((dbv.value() as Double?)!, Double(300000))
|
||||
XCTAssertEqual((dbv.value() as Double), Double(300000))
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// "1.0e+20" is turned to Real
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: ["1.0e+20"])
|
||||
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
|
||||
|
||||
// Check GRDB conversions from Real storage: (avoid Int, Int32 and Int64 since 1.0e20 does not fit)
|
||||
XCTAssertEqual((dbv.value() as Bool?)!, true)
|
||||
XCTAssertEqual((dbv.value() as Bool), true)
|
||||
XCTAssertEqual((dbv.value() as Double?)!, 1e20)
|
||||
XCTAssertEqual((dbv.value() as Double), 1e20)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// "foo" is turned to Text
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: ["foo"])
|
||||
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
|
||||
|
||||
// Check GRDB conversions from Text storage:
|
||||
XCTAssertTrue((dbv.value() as Bool?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int32?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int64?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Double?) == nil)
|
||||
XCTAssertEqual((dbv.value() as String?)!, "foo")
|
||||
XCTAssertEqual((dbv.value() as String), "foo")
|
||||
XCTAssertTrue((dbv.value() as NSData?) == nil)
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
|
||||
// Blob is turned to Blob
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: ["foo".dataUsingEncoding(NSUTF8StringEncoding)])
|
||||
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
|
||||
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Blob)
|
||||
|
||||
// Check GRDB conversions from Blob storage:
|
||||
XCTAssertTrue((dbv.value() as Bool?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int32?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Int64?) == nil)
|
||||
XCTAssertTrue((dbv.value() as Double?) == nil)
|
||||
XCTAssertTrue((dbv.value() as String?) == nil)
|
||||
XCTAssertEqual((dbv.value() as NSData?), "foo".dataUsingEncoding(NSUTF8StringEncoding))
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-191
@@ -1,191 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
// A type that adopts DatabaseValueConvertible but does not adopt SQLiteStatementConvertible
|
||||
struct WrappedInt: DatabaseValueConvertible {
|
||||
let int: Int
|
||||
init(int: Int) {
|
||||
self.int = int
|
||||
}
|
||||
var databaseValue: DatabaseValue {
|
||||
return DatabaseValue(int64: Int64(int))
|
||||
}
|
||||
static func fromDatabaseValue(databaseValue: DatabaseValue) -> WrappedInt? {
|
||||
guard let int = Int.fromDatabaseValue(databaseValue) else {
|
||||
return nil
|
||||
}
|
||||
return WrappedInt(int: int)
|
||||
}
|
||||
}
|
||||
|
||||
class DatabaseValueConvertibleFetchTests: GRDBTestCase {
|
||||
|
||||
func testFetchFromStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (2)")
|
||||
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
let sequence = WrappedInt.fetch(statement)
|
||||
|
||||
XCTAssertEqual(sequence.map { $0.int }, [1,2])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchAllFromStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (2)")
|
||||
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
let array = WrappedInt.fetchAll(statement)
|
||||
|
||||
XCTAssertEqual(array.map { $0.int }, [1,2])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchOneFromStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
|
||||
let nilBecauseMissingRow = WrappedInt.fetchOne(statement)
|
||||
XCTAssertTrue(nilBecauseMissingRow == nil)
|
||||
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
let nilBecauseMissingNULL = WrappedInt.fetchOne(statement)
|
||||
XCTAssertTrue(nilBecauseMissingNULL == nil)
|
||||
|
||||
try db.execute("DELETE FROM ints")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
let one = WrappedInt.fetchOne(statement)!
|
||||
XCTAssertEqual(one.int, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchFromDatabaes() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (2)")
|
||||
|
||||
let sequence = WrappedInt.fetch(db, "SELECT int FROM ints ORDER BY int")
|
||||
|
||||
XCTAssertEqual(sequence.map { $0.int }, [1,2])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchAllFromDatabase() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (2)")
|
||||
|
||||
let array = WrappedInt.fetchAll(db, "SELECT int FROM ints ORDER BY int")
|
||||
|
||||
XCTAssertEqual(array.map { $0.int }, [1,2])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchOneFromDatabase() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
|
||||
let nilBecauseMissingRow = WrappedInt.fetchOne(db, "SELECT int FROM ints ORDER BY int")
|
||||
XCTAssertTrue(nilBecauseMissingRow == nil)
|
||||
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
let nilBecauseMissingNULL = WrappedInt.fetchOne(db, "SELECT int FROM ints ORDER BY int")
|
||||
XCTAssertTrue(nilBecauseMissingNULL == nil)
|
||||
|
||||
try db.execute("DELETE FROM ints")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
let one = WrappedInt.fetchOne(db, "SELECT int FROM ints ORDER BY int")!
|
||||
XCTAssertEqual(one.int, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testOptionalFetchFromStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
let sequence = Optional<WrappedInt>.fetch(statement)
|
||||
|
||||
let ints = sequence.map { $0?.int }
|
||||
XCTAssertEqual(ints.count, 2)
|
||||
XCTAssertTrue(ints[0] == nil)
|
||||
XCTAssertEqual(ints[1]!, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testOptionalFetchAllFromStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
let array = Optional<WrappedInt>.fetchAll(statement)
|
||||
|
||||
let ints = array.map { $0?.int }
|
||||
XCTAssertEqual(ints.count, 2)
|
||||
XCTAssertTrue(ints[0] == nil)
|
||||
XCTAssertEqual(ints[1]!, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testOptionalFetchFromDatabaes() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let sequence = Optional<WrappedInt>.fetch(db, "SELECT int FROM ints ORDER BY int")
|
||||
|
||||
let ints = sequence.map { $0?.int }
|
||||
XCTAssertEqual(ints.count, 2)
|
||||
XCTAssertTrue(ints[0] == nil)
|
||||
XCTAssertEqual(ints[1]!, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testOptionalFetchAllFromDatabase() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let array = Optional<WrappedInt>.fetchAll(db, "SELECT int FROM ints ORDER BY int")
|
||||
|
||||
let ints = array.map { $0?.int }
|
||||
XCTAssertEqual(ints.count, 2)
|
||||
XCTAssertTrue(ints[0] == nil)
|
||||
XCTAssertEqual(ints[1]!, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class FetchableParent : DatabaseValueConvertible, CustomStringConvertible {
|
||||
var databaseValue: DatabaseValue {
|
||||
return DatabaseValue(string: "Parent")
|
||||
}
|
||||
|
||||
class func fromDatabaseValue(databaseValue: DatabaseValue) -> Self? {
|
||||
return self.init()
|
||||
}
|
||||
|
||||
required init() {
|
||||
}
|
||||
|
||||
var description: String { return "Parent" }
|
||||
}
|
||||
|
||||
class FetchableChild : FetchableParent {
|
||||
/// Returns a value that can be stored in the database.
|
||||
override var databaseValue: DatabaseValue {
|
||||
return DatabaseValue(string: "Child")
|
||||
}
|
||||
|
||||
override var description: String { return "Child" }
|
||||
}
|
||||
|
||||
class DatabaseValueConvertibleSubclassTests: GRDBTestCase {
|
||||
|
||||
func testParent() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE parents (name TEXT)")
|
||||
try db.execute("INSERT INTO parents (name) VALUES (?)", arguments: [FetchableParent()])
|
||||
let string = String.fetchOne(db, "SELECT * FROM parents")!
|
||||
XCTAssertEqual(string, "Parent")
|
||||
let parent = FetchableParent.fetchOne(db, "SELECT * FROM parents")!
|
||||
XCTAssertEqual(parent.description, "Parent")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testChild() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE children (name TEXT)")
|
||||
try db.execute("INSERT INTO children (name) VALUES (?)", arguments: [FetchableChild()])
|
||||
let string = String.fetchOne(db, "SELECT * FROM children")!
|
||||
XCTAssertEqual(string, "Child")
|
||||
let child = FetchableChild.fetchOne(db, "SELECT * FROM children")!
|
||||
XCTAssertEqual(child.description, "Child")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class NSDataTests: GRDBTestCase {
|
||||
|
||||
func testDatabaseValueCanNotStoreEmptyData() {
|
||||
// SQLite can't store zero-length blob.
|
||||
let databaseValue = DatabaseValue(data: NSData())
|
||||
XCTAssertEqual(databaseValue, DatabaseValue.Null)
|
||||
}
|
||||
}
|
||||
@@ -1,190 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
enum Color32 : Int32 {
|
||||
case Red
|
||||
case White
|
||||
case Rose
|
||||
}
|
||||
|
||||
enum Color64 : Int64 {
|
||||
case Red
|
||||
case White
|
||||
case Rose
|
||||
}
|
||||
|
||||
enum Color : Int {
|
||||
case Red
|
||||
case White
|
||||
case Rose
|
||||
}
|
||||
|
||||
enum Grape : String {
|
||||
case Chardonnay
|
||||
case Merlot
|
||||
case Riesling
|
||||
}
|
||||
|
||||
extension Color32 : DatabaseInt32Representable { }
|
||||
extension Color64 : DatabaseInt64Representable { }
|
||||
extension Color : DatabaseIntRepresentable { }
|
||||
extension Grape : DatabaseStringRepresentable { }
|
||||
|
||||
class RawRepresentableTests: GRDBTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.registerMigration("createPersons") { db in
|
||||
try db.execute("CREATE TABLE wines (grape TEXT, color INTEGER)")
|
||||
}
|
||||
assertNoError {
|
||||
try migrator.migrate(dbQueue)
|
||||
}
|
||||
}
|
||||
|
||||
func testColor32() {
|
||||
assertNoError {
|
||||
try dbQueue.inTransaction { db in
|
||||
|
||||
do {
|
||||
for color in [Color32.Red, Color32.White, Color32.Rose] {
|
||||
try db.execute("INSERT INTO wines (color) VALUES (?)", arguments: [color])
|
||||
}
|
||||
try db.execute("INSERT INTO wines (color) VALUES (?)", arguments: [4])
|
||||
try db.execute("INSERT INTO wines (color) VALUES (NULL)")
|
||||
}
|
||||
|
||||
do {
|
||||
let rows = Row.fetchAll(db, "SELECT color FROM wines ORDER BY color")
|
||||
let colors = rows.map { $0.value(atIndex: 0) as Color32? }
|
||||
XCTAssertTrue(colors[0] == nil)
|
||||
XCTAssertEqual(colors[1]!, Color32.Red)
|
||||
XCTAssertEqual(colors[2]!, Color32.White)
|
||||
XCTAssertEqual(colors[3]!, Color32.Rose)
|
||||
XCTAssertTrue(colors[4] == nil)
|
||||
}
|
||||
|
||||
do {
|
||||
let colors = Optional<Color32>.fetchAll(db, "SELECT color FROM wines ORDER BY color")
|
||||
XCTAssertTrue(colors[0] == nil)
|
||||
XCTAssertEqual(colors[1]!, Color32.Red)
|
||||
XCTAssertEqual(colors[2]!, Color32.White)
|
||||
XCTAssertEqual(colors[3]!, Color32.Rose)
|
||||
XCTAssertTrue(colors[4] == nil)
|
||||
}
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testColor64() {
|
||||
assertNoError {
|
||||
try dbQueue.inTransaction { db in
|
||||
|
||||
do {
|
||||
for color in [Color64.Red, Color64.White, Color64.Rose] {
|
||||
try db.execute("INSERT INTO wines (color) VALUES (?)", arguments: [color])
|
||||
}
|
||||
try db.execute("INSERT INTO wines (color) VALUES (?)", arguments: [4])
|
||||
try db.execute("INSERT INTO wines (color) VALUES (NULL)")
|
||||
}
|
||||
|
||||
do {
|
||||
let rows = Row.fetchAll(db, "SELECT color FROM wines ORDER BY color")
|
||||
let colors = rows.map { $0.value(atIndex: 0) as Color64? }
|
||||
XCTAssertTrue(colors[0] == nil)
|
||||
XCTAssertEqual(colors[1]!, Color64.Red)
|
||||
XCTAssertEqual(colors[2]!, Color64.White)
|
||||
XCTAssertEqual(colors[3]!, Color64.Rose)
|
||||
XCTAssertTrue(colors[4] == nil)
|
||||
}
|
||||
|
||||
do {
|
||||
let colors = Optional<Color64>.fetchAll(db, "SELECT color FROM wines ORDER BY color")
|
||||
XCTAssertTrue(colors[0] == nil)
|
||||
XCTAssertEqual(colors[1]!, Color64.Red)
|
||||
XCTAssertEqual(colors[2]!, Color64.White)
|
||||
XCTAssertEqual(colors[3]!, Color64.Rose)
|
||||
XCTAssertTrue(colors[4] == nil)
|
||||
}
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testColor() {
|
||||
assertNoError {
|
||||
try dbQueue.inTransaction { db in
|
||||
|
||||
do {
|
||||
for color in [Color.Red, Color.White, Color.Rose] {
|
||||
try db.execute("INSERT INTO wines (color) VALUES (?)", arguments: [color])
|
||||
}
|
||||
try db.execute("INSERT INTO wines (color) VALUES (?)", arguments: [4])
|
||||
try db.execute("INSERT INTO wines (color) VALUES (NULL)")
|
||||
}
|
||||
|
||||
do {
|
||||
let rows = Row.fetchAll(db, "SELECT color FROM wines ORDER BY color")
|
||||
let colors = rows.map { $0.value(atIndex: 0) as Color? }
|
||||
XCTAssertTrue(colors[0] == nil)
|
||||
XCTAssertEqual(colors[1]!, Color.Red)
|
||||
XCTAssertEqual(colors[2]!, Color.White)
|
||||
XCTAssertEqual(colors[3]!, Color.Rose)
|
||||
XCTAssertTrue(colors[4] == nil)
|
||||
}
|
||||
|
||||
do {
|
||||
let colors = Optional<Color>.fetchAll(db, "SELECT color FROM wines ORDER BY color")
|
||||
XCTAssertTrue(colors[0] == nil)
|
||||
XCTAssertEqual(colors[1]!, Color.Red)
|
||||
XCTAssertEqual(colors[2]!, Color.White)
|
||||
XCTAssertEqual(colors[3]!, Color.Rose)
|
||||
XCTAssertTrue(colors[4] == nil)
|
||||
}
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testGrape() {
|
||||
assertNoError {
|
||||
try dbQueue.inTransaction { db in
|
||||
|
||||
do {
|
||||
for grape in [Grape.Chardonnay, Grape.Merlot, Grape.Riesling] {
|
||||
try db.execute("INSERT INTO wines (grape) VALUES (?)", arguments: [grape])
|
||||
}
|
||||
try db.execute("INSERT INTO wines (grape) VALUES (?)", arguments: ["Syrah"])
|
||||
try db.execute("INSERT INTO wines (grape) VALUES (NULL)")
|
||||
}
|
||||
|
||||
do {
|
||||
let rows = Row.fetchAll(db, "SELECT grape FROM wines ORDER BY grape")
|
||||
let grapes = rows.map { $0.value(atIndex: 0) as Grape? }
|
||||
XCTAssertTrue(grapes[0] == nil)
|
||||
XCTAssertEqual(grapes[1]!, Grape.Chardonnay)
|
||||
XCTAssertEqual(grapes[2]!, Grape.Merlot)
|
||||
XCTAssertEqual(grapes[3]!, Grape.Riesling)
|
||||
XCTAssertTrue(grapes[4] == nil)
|
||||
}
|
||||
|
||||
do {
|
||||
let grapes = Optional<Grape>.fetchAll(db, "SELECT grape FROM wines ORDER BY grape")
|
||||
XCTAssertTrue(grapes[0] == nil)
|
||||
XCTAssertEqual(grapes[1]!, Grape.Chardonnay)
|
||||
XCTAssertEqual(grapes[2]!, Grape.Merlot)
|
||||
XCTAssertEqual(grapes[3]!, Grape.Riesling)
|
||||
XCTAssertTrue(grapes[4] == nil)
|
||||
}
|
||||
|
||||
return .Rollback
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,194 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class DetachedRowTests: GRDBTestCase {
|
||||
|
||||
func testRowAsSequence() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
|
||||
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
|
||||
let row = Row.fetchOne(db, "SELECT * FROM ints")!
|
||||
|
||||
var columnNames = [String]()
|
||||
var ints = [Int]()
|
||||
var bools = [Bool]()
|
||||
for (columnName, databaseValue) in row {
|
||||
columnNames.append(columnName)
|
||||
ints.append(databaseValue.value() as Int)
|
||||
bools.append(databaseValue.value() as Bool)
|
||||
}
|
||||
|
||||
XCTAssertEqual(columnNames, ["a", "b", "c"])
|
||||
XCTAssertEqual(ints, [0, 1, 2])
|
||||
XCTAssertEqual(bools, [false, true, true])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowValueAtIndex() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
|
||||
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
|
||||
let row = Row.fetchOne(db, "SELECT * FROM ints")!
|
||||
|
||||
// Int extraction, form 1
|
||||
XCTAssertEqual(row.value(atIndex: 0) as Int, 0)
|
||||
XCTAssertEqual(row.value(atIndex: 1) as Int, 1)
|
||||
XCTAssertEqual(row.value(atIndex: 2) as Int, 2)
|
||||
|
||||
// Int extraction, form 2
|
||||
XCTAssertEqual(row.value(atIndex: 0)! as Int, 0)
|
||||
XCTAssertEqual(row.value(atIndex: 1)! as Int, 1)
|
||||
XCTAssertEqual(row.value(atIndex: 2)! as Int, 2)
|
||||
|
||||
// Int? extraction
|
||||
XCTAssertEqual((row.value(atIndex: 0) as Int?), 0)
|
||||
XCTAssertEqual((row.value(atIndex: 1) as Int?), 1)
|
||||
XCTAssertEqual((row.value(atIndex: 2) as Int?), 2)
|
||||
|
||||
// Bool extraction, form 1
|
||||
XCTAssertEqual(row.value(atIndex: 0) as Bool, false)
|
||||
XCTAssertEqual(row.value(atIndex: 1) as Bool, true)
|
||||
XCTAssertEqual(row.value(atIndex: 2) as Bool, true)
|
||||
|
||||
// Bool extraction, form 2
|
||||
XCTAssertEqual(row.value(atIndex: 0)! as Bool, false)
|
||||
XCTAssertEqual(row.value(atIndex: 1)! as Bool, true)
|
||||
XCTAssertEqual(row.value(atIndex: 2)! as Bool, true)
|
||||
|
||||
// Bool? extraction
|
||||
XCTAssertEqual((row.value(atIndex: 0) as Bool?), false)
|
||||
XCTAssertEqual((row.value(atIndex: 1) as Bool?), true)
|
||||
XCTAssertEqual((row.value(atIndex: 2) as Bool?), true)
|
||||
|
||||
// Expect fatal error:
|
||||
//
|
||||
// row.value(atIndex: -1)
|
||||
// row.value(atIndex: 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowValueNamed() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
|
||||
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
|
||||
let row = Row.fetchOne(db, "SELECT * FROM ints")!
|
||||
|
||||
// Int extraction, form 1
|
||||
XCTAssertEqual(row.value(named: "a") as Int, 0)
|
||||
XCTAssertEqual(row.value(named: "b") as Int, 1)
|
||||
XCTAssertEqual(row.value(named: "c") as Int, 2)
|
||||
|
||||
// Int extraction, form 2
|
||||
XCTAssertEqual(row.value(named: "a")! as Int, 0)
|
||||
XCTAssertEqual(row.value(named: "b")! as Int, 1)
|
||||
XCTAssertEqual(row.value(named: "c")! as Int, 2)
|
||||
|
||||
// Int? extraction
|
||||
XCTAssertEqual((row.value(named: "a") as Int?)!, 0)
|
||||
XCTAssertEqual((row.value(named: "b") as Int?)!, 1)
|
||||
XCTAssertEqual((row.value(named: "c") as Int?)!, 2)
|
||||
|
||||
// Bool extraction, form 1
|
||||
XCTAssertEqual(row.value(named: "a") as Bool, false)
|
||||
XCTAssertEqual(row.value(named: "b") as Bool, true)
|
||||
XCTAssertEqual(row.value(named: "c") as Bool, true)
|
||||
|
||||
// Bool extraction, form 2
|
||||
XCTAssertEqual(row.value(named: "a")! as Bool, false)
|
||||
XCTAssertEqual(row.value(named: "b")! as Bool, true)
|
||||
XCTAssertEqual(row.value(named: "c")! as Bool, true)
|
||||
|
||||
// Bool? extraction
|
||||
XCTAssertEqual((row.value(named: "a") as Bool?)!, false)
|
||||
XCTAssertEqual((row.value(named: "b") as Bool?)!, true)
|
||||
XCTAssertEqual((row.value(named: "c") as Bool?)!, true)
|
||||
|
||||
// Expect fatal error:
|
||||
// row.value(named: "foo")
|
||||
// row.value(named: "foo") as Int?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowCount() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
|
||||
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
|
||||
let row = Row.fetchOne(db, "SELECT * FROM ints")!
|
||||
|
||||
XCTAssertEqual(row.count, 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowColumnNames() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
|
||||
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
|
||||
let row = Row.fetchOne(db, "SELECT a, b, c FROM ints")!
|
||||
|
||||
XCTAssertEqual(Array(row.columnNames), ["a", "b", "c"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowDatabaseValues() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
|
||||
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
|
||||
let row = Row.fetchOne(db, "SELECT a, b, c FROM ints")!
|
||||
|
||||
XCTAssertEqual(Array(row.databaseValues), [0.databaseValue, 1.databaseValue, 2.databaseValue])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowSubscriptIsCaseInsensitive() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE stuffs (name TEXT)")
|
||||
try db.execute("INSERT INTO stuffs (name) VALUES ('foo')")
|
||||
let row = Row.fetchOne(db, "SELECT nAmE FROM stuffs")!
|
||||
XCTAssertEqual(row["name"], "foo".databaseValue)
|
||||
XCTAssertEqual(row["NAME"], "foo".databaseValue)
|
||||
XCTAssertEqual(row["NaMe"], "foo".databaseValue)
|
||||
XCTAssertEqual(row.value(named: "name") as String, "foo")
|
||||
XCTAssertEqual(row.value(named: "NAME") as String, "foo")
|
||||
XCTAssertEqual(row.value(named: "NaMe") as String, "foo")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowHasColumnIsCaseInsensitive() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE stuffs (name TEXT)")
|
||||
try db.execute("INSERT INTO stuffs (name) VALUES ('foo')")
|
||||
let row = Row.fetchOne(db, "SELECT nAmE, 1 AS foo FROM stuffs")!
|
||||
XCTAssertTrue(row.hasColumn("name"))
|
||||
XCTAssertTrue(row.hasColumn("NAME"))
|
||||
XCTAssertTrue(row.hasColumn("Name"))
|
||||
XCTAssertTrue(row.hasColumn("NaMe"))
|
||||
XCTAssertTrue(row.hasColumn("foo"))
|
||||
XCTAssertTrue(row.hasColumn("Foo"))
|
||||
XCTAssertTrue(row.hasColumn("FOO"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class DictionaryRowTests: GRDBTestCase {
|
||||
|
||||
func testRowAsSequence() {
|
||||
let row = Row(dictionary: ["a": 0, "b": 1, "c": 2])
|
||||
|
||||
var columnNames = Set<String>()
|
||||
var ints = Set<Int>()
|
||||
var bools = Set<Bool>()
|
||||
for (columnName, databaseValue) in row {
|
||||
columnNames.insert(columnName)
|
||||
ints.insert(databaseValue.value() as Int)
|
||||
bools.insert(databaseValue.value() as Bool)
|
||||
}
|
||||
|
||||
XCTAssertEqual(columnNames, ["a", "b", "c"])
|
||||
XCTAssertEqual(ints, [0, 1, 2])
|
||||
XCTAssertEqual(bools, [false, true, true])
|
||||
}
|
||||
|
||||
func testRowValueAtIndex() {
|
||||
let dictionary: [String: DatabaseValueConvertible?] = ["a": 0, "b": 1, "c": 2]
|
||||
let row = Row(dictionary: dictionary)
|
||||
|
||||
let aIndex = dictionary.startIndex.distanceTo(dictionary.indexForKey("a")!)
|
||||
let bIndex = dictionary.startIndex.distanceTo(dictionary.indexForKey("b")!)
|
||||
let cIndex = dictionary.startIndex.distanceTo(dictionary.indexForKey("c")!)
|
||||
|
||||
// Int extraction, form 1
|
||||
XCTAssertEqual(row.value(atIndex: aIndex) as Int, 0)
|
||||
XCTAssertEqual(row.value(atIndex: bIndex) as Int, 1)
|
||||
XCTAssertEqual(row.value(atIndex: cIndex) as Int, 2)
|
||||
|
||||
// Int extraction, form 2
|
||||
XCTAssertEqual(row.value(atIndex: aIndex)! as Int, 0)
|
||||
XCTAssertEqual(row.value(atIndex: bIndex)! as Int, 1)
|
||||
XCTAssertEqual(row.value(atIndex: cIndex)! as Int, 2)
|
||||
|
||||
// Int? extraction
|
||||
XCTAssertEqual((row.value(atIndex: aIndex) as Int?), 0)
|
||||
XCTAssertEqual((row.value(atIndex: bIndex) as Int?), 1)
|
||||
XCTAssertEqual((row.value(atIndex: cIndex) as Int?), 2)
|
||||
|
||||
// Bool extraction, form 1
|
||||
XCTAssertEqual(row.value(atIndex: aIndex) as Bool, false)
|
||||
XCTAssertEqual(row.value(atIndex: bIndex) as Bool, true)
|
||||
XCTAssertEqual(row.value(atIndex: cIndex) as Bool, true)
|
||||
|
||||
// Bool extraction, form 2
|
||||
XCTAssertEqual(row.value(atIndex: aIndex)! as Bool, false)
|
||||
XCTAssertEqual(row.value(atIndex: bIndex)! as Bool, true)
|
||||
XCTAssertEqual(row.value(atIndex: cIndex)! as Bool, true)
|
||||
|
||||
// Bool? extraction
|
||||
XCTAssertEqual((row.value(atIndex: aIndex) as Bool?), false)
|
||||
XCTAssertEqual((row.value(atIndex: bIndex) as Bool?), true)
|
||||
XCTAssertEqual((row.value(atIndex: cIndex) as Bool?), true)
|
||||
|
||||
// Expect fatal error:
|
||||
//
|
||||
// row.value(atIndex: -1)
|
||||
// row.value(atIndex: 3)
|
||||
}
|
||||
|
||||
func testRowValueNamed() {
|
||||
let row = Row(dictionary: ["a": 0, "b": 1, "c": 2])
|
||||
|
||||
// Int extraction, form 1
|
||||
XCTAssertEqual(row.value(named: "a") as Int, 0)
|
||||
XCTAssertEqual(row.value(named: "b") as Int, 1)
|
||||
XCTAssertEqual(row.value(named: "c") as Int, 2)
|
||||
|
||||
// Int extraction, form 2
|
||||
XCTAssertEqual(row.value(named: "a")! as Int, 0)
|
||||
XCTAssertEqual(row.value(named: "b")! as Int, 1)
|
||||
XCTAssertEqual(row.value(named: "c")! as Int, 2)
|
||||
|
||||
// Int? extraction
|
||||
XCTAssertEqual((row.value(named: "a") as Int?)!, 0)
|
||||
XCTAssertEqual((row.value(named: "b") as Int?)!, 1)
|
||||
XCTAssertEqual((row.value(named: "c") as Int?)!, 2)
|
||||
|
||||
// Bool extraction, form 1
|
||||
XCTAssertEqual(row.value(named: "a") as Bool, false)
|
||||
XCTAssertEqual(row.value(named: "b") as Bool, true)
|
||||
XCTAssertEqual(row.value(named: "c") as Bool, true)
|
||||
|
||||
// Bool extraction, form 2
|
||||
XCTAssertEqual(row.value(named: "a")! as Bool, false)
|
||||
XCTAssertEqual(row.value(named: "b")! as Bool, true)
|
||||
XCTAssertEqual(row.value(named: "c")! as Bool, true)
|
||||
|
||||
// Bool? extraction
|
||||
XCTAssertEqual((row.value(named: "a") as Bool?)!, false)
|
||||
XCTAssertEqual((row.value(named: "b") as Bool?)!, true)
|
||||
XCTAssertEqual((row.value(named: "c") as Bool?)!, true)
|
||||
|
||||
// Expect fatal error:
|
||||
// row.value(named: "foo")
|
||||
// row.value(named: "foo") as Int?
|
||||
}
|
||||
|
||||
func testRowCount() {
|
||||
let row = Row(dictionary: ["a": 0, "b": 1, "c": 2])
|
||||
XCTAssertEqual(row.count, 3)
|
||||
}
|
||||
|
||||
func testRowColumnNames() {
|
||||
let row = Row(dictionary: ["a": 0, "b": 1, "c": 2])
|
||||
XCTAssertEqual(Array(row.columnNames).sort(), ["a", "b", "c"])
|
||||
}
|
||||
|
||||
func testRowDatabaseValues() {
|
||||
let row = Row(dictionary: ["a": 0, "b": 1, "c": 2])
|
||||
XCTAssertEqual(row.databaseValues.sort { ($0.value() as Int!) < ($1.value() as Int!) }, [0.databaseValue, 1.databaseValue, 2.databaseValue])
|
||||
}
|
||||
|
||||
func testRowSubscriptIsCaseInsensitive() {
|
||||
let row = Row(dictionary: ["name": "foo"])
|
||||
XCTAssertEqual(row["name"], "foo".databaseValue)
|
||||
XCTAssertEqual(row["NAME"], "foo".databaseValue)
|
||||
XCTAssertEqual(row["NaMe"], "foo".databaseValue)
|
||||
XCTAssertEqual(row.value(named: "name") as String, "foo")
|
||||
XCTAssertEqual(row.value(named: "NAME") as String, "foo")
|
||||
XCTAssertEqual(row.value(named: "NaMe") as String, "foo")
|
||||
}
|
||||
|
||||
func testRowHasColumnIsCaseInsensitive() {
|
||||
let row = Row(dictionary: ["nAmE": "foo", "foo": 1])
|
||||
XCTAssertTrue(row.hasColumn("name"))
|
||||
XCTAssertTrue(row.hasColumn("NAME"))
|
||||
XCTAssertTrue(row.hasColumn("Name"))
|
||||
XCTAssertTrue(row.hasColumn("NaMe"))
|
||||
XCTAssertTrue(row.hasColumn("foo"))
|
||||
XCTAssertTrue(row.hasColumn("Foo"))
|
||||
XCTAssertTrue(row.hasColumn("FOO"))
|
||||
}
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class MetalRowTests: GRDBTestCase {
|
||||
|
||||
func testRowAsSequence() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
|
||||
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
|
||||
var rowFetched = false
|
||||
for row in Row.fetch(db, "SELECT * FROM ints") {
|
||||
rowFetched = true
|
||||
var columnNames = [String]()
|
||||
var ints = [Int]()
|
||||
var bools = [Bool]()
|
||||
for (columnName, databaseValue) in row {
|
||||
columnNames.append(columnName)
|
||||
ints.append(databaseValue.value() as Int)
|
||||
bools.append(databaseValue.value() as Bool)
|
||||
}
|
||||
|
||||
XCTAssertEqual(columnNames, ["a", "b", "c"])
|
||||
XCTAssertEqual(ints, [0, 1, 2])
|
||||
XCTAssertEqual(bools, [false, true, true])
|
||||
}
|
||||
XCTAssertTrue(rowFetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowValueAtIndex() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
|
||||
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
|
||||
var rowFetched = false
|
||||
for row in Row.fetch(db, "SELECT * FROM ints") {
|
||||
rowFetched = true
|
||||
|
||||
// Int extraction, form 1
|
||||
XCTAssertEqual(row.value(atIndex: 0) as Int, 0)
|
||||
XCTAssertEqual(row.value(atIndex: 1) as Int, 1)
|
||||
XCTAssertEqual(row.value(atIndex: 2) as Int, 2)
|
||||
|
||||
// Int extraction, form 2
|
||||
XCTAssertEqual(row.value(atIndex: 0)! as Int, 0)
|
||||
XCTAssertEqual(row.value(atIndex: 1)! as Int, 1)
|
||||
XCTAssertEqual(row.value(atIndex: 2)! as Int, 2)
|
||||
|
||||
// Int? extraction
|
||||
XCTAssertEqual((row.value(atIndex: 0) as Int?), 0)
|
||||
XCTAssertEqual((row.value(atIndex: 1) as Int?), 1)
|
||||
XCTAssertEqual((row.value(atIndex: 2) as Int?), 2)
|
||||
|
||||
// Bool extraction, form 1
|
||||
XCTAssertEqual(row.value(atIndex: 0) as Bool, false)
|
||||
XCTAssertEqual(row.value(atIndex: 1) as Bool, true)
|
||||
XCTAssertEqual(row.value(atIndex: 2) as Bool, true)
|
||||
|
||||
// Bool extraction, form 2
|
||||
XCTAssertEqual(row.value(atIndex: 0)! as Bool, false)
|
||||
XCTAssertEqual(row.value(atIndex: 1)! as Bool, true)
|
||||
XCTAssertEqual(row.value(atIndex: 2)! as Bool, true)
|
||||
|
||||
// Bool? extraction
|
||||
XCTAssertEqual((row.value(atIndex: 0) as Bool?), false)
|
||||
XCTAssertEqual((row.value(atIndex: 1) as Bool?), true)
|
||||
XCTAssertEqual((row.value(atIndex: 2) as Bool?), true)
|
||||
|
||||
// Expect fatal error:
|
||||
//
|
||||
// row.value(atIndex: -1)
|
||||
// row.value(atIndex: 3)
|
||||
}
|
||||
XCTAssertTrue(rowFetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowValueNamed() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
|
||||
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
|
||||
var rowFetched = false
|
||||
for row in Row.fetch(db, "SELECT * FROM ints") {
|
||||
rowFetched = true
|
||||
|
||||
// Int extraction, form 1
|
||||
XCTAssertEqual(row.value(named: "a") as Int, 0)
|
||||
XCTAssertEqual(row.value(named: "b") as Int, 1)
|
||||
XCTAssertEqual(row.value(named: "c") as Int, 2)
|
||||
|
||||
// Int extraction, form 2
|
||||
XCTAssertEqual(row.value(named: "a")! as Int, 0)
|
||||
XCTAssertEqual(row.value(named: "b")! as Int, 1)
|
||||
XCTAssertEqual(row.value(named: "c")! as Int, 2)
|
||||
|
||||
// Int? extraction
|
||||
XCTAssertEqual((row.value(named: "a") as Int?)!, 0)
|
||||
XCTAssertEqual((row.value(named: "b") as Int?)!, 1)
|
||||
XCTAssertEqual((row.value(named: "c") as Int?)!, 2)
|
||||
|
||||
// Bool extraction, form 1
|
||||
XCTAssertEqual(row.value(named: "a") as Bool, false)
|
||||
XCTAssertEqual(row.value(named: "b") as Bool, true)
|
||||
XCTAssertEqual(row.value(named: "c") as Bool, true)
|
||||
|
||||
// Bool extraction, form 2
|
||||
XCTAssertEqual(row.value(named: "a")! as Bool, false)
|
||||
XCTAssertEqual(row.value(named: "b")! as Bool, true)
|
||||
XCTAssertEqual(row.value(named: "c")! as Bool, true)
|
||||
|
||||
// Bool? extraction
|
||||
XCTAssertEqual((row.value(named: "a") as Bool?)!, false)
|
||||
XCTAssertEqual((row.value(named: "b") as Bool?)!, true)
|
||||
XCTAssertEqual((row.value(named: "c") as Bool?)!, true)
|
||||
|
||||
// Expect fatal error:
|
||||
// row.value(named: "foo")
|
||||
// row.value(named: "foo") as Int?
|
||||
}
|
||||
XCTAssertTrue(rowFetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowCount() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
|
||||
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
|
||||
var rowFetched = false
|
||||
for row in Row.fetch(db, "SELECT * FROM ints") {
|
||||
rowFetched = true
|
||||
XCTAssertEqual(row.count, 3)
|
||||
}
|
||||
XCTAssertTrue(rowFetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowColumnNames() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
|
||||
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
|
||||
var rowFetched = false
|
||||
for row in Row.fetch(db, "SELECT a, b, c FROM ints") {
|
||||
rowFetched = true
|
||||
XCTAssertEqual(Array(row.columnNames), ["a", "b", "c"])
|
||||
}
|
||||
XCTAssertTrue(rowFetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowDatabaseValues() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
|
||||
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
|
||||
var rowFetched = false
|
||||
for row in Row.fetch(db, "SELECT a, b, c FROM ints") {
|
||||
rowFetched = true
|
||||
XCTAssertEqual(Array(row.databaseValues), [0.databaseValue, 1.databaseValue, 2.databaseValue])
|
||||
}
|
||||
XCTAssertTrue(rowFetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowSubscriptIsCaseInsensitive() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE stuffs (name TEXT)")
|
||||
try db.execute("INSERT INTO stuffs (name) VALUES ('foo')")
|
||||
var rowFetched = false
|
||||
for row in Row.fetch(db, "SELECT nAmE FROM stuffs") {
|
||||
rowFetched = true
|
||||
XCTAssertEqual(row["name"], "foo".databaseValue)
|
||||
XCTAssertEqual(row["NAME"], "foo".databaseValue)
|
||||
XCTAssertEqual(row["NaMe"], "foo".databaseValue)
|
||||
XCTAssertEqual(row.value(named: "name") as String, "foo")
|
||||
XCTAssertEqual(row.value(named: "NAME") as String, "foo")
|
||||
XCTAssertEqual(row.value(named: "NaMe") as String, "foo")
|
||||
}
|
||||
XCTAssertTrue(rowFetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowHasColumnIsCaseInsensitive() {
|
||||
assertNoError {
|
||||
let dbQueue = DatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE stuffs (name TEXT)")
|
||||
try db.execute("INSERT INTO stuffs (name) VALUES ('foo')")
|
||||
var rowFetched = false
|
||||
for row in Row.fetch(db, "SELECT nAmE, 1 AS foo FROM stuffs") {
|
||||
rowFetched = true
|
||||
XCTAssertTrue(row.hasColumn("name"))
|
||||
XCTAssertTrue(row.hasColumn("NAME"))
|
||||
XCTAssertTrue(row.hasColumn("Name"))
|
||||
XCTAssertTrue(row.hasColumn("NaMe"))
|
||||
XCTAssertTrue(row.hasColumn("foo"))
|
||||
XCTAssertTrue(row.hasColumn("Foo"))
|
||||
XCTAssertTrue(row.hasColumn("FOO"))
|
||||
}
|
||||
XCTAssertTrue(rowFetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
struct SimpleRowConvertible : RowConvertible {
|
||||
var firstName: String
|
||||
var lastName: String
|
||||
var fetched: Bool = false
|
||||
|
||||
init(row: Row) {
|
||||
firstName = row.value(named: "firstName")
|
||||
lastName = row.value(named: "lastName")
|
||||
}
|
||||
|
||||
mutating func awakeFromFetch(row: Row) {
|
||||
fetched = true
|
||||
}
|
||||
}
|
||||
|
||||
class RowConvertibleTests: GRDBTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE structs (firstName TEXT, lastName TEXT)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowInitializer() {
|
||||
let row = Row(dictionary: ["firstName": "Arthur", "lastName": "Martin"])
|
||||
let s = SimpleRowConvertible(row: row)
|
||||
XCTAssertEqual(s.firstName, "Arthur")
|
||||
XCTAssertEqual(s.lastName, "Martin")
|
||||
XCTAssertFalse(s.fetched)
|
||||
}
|
||||
|
||||
func testDictionaryInitializer() {
|
||||
let s = SimpleRowConvertible(dictionary: ["firstName": "Arthur", "lastName": "Martin"])
|
||||
XCTAssertEqual(s.firstName, "Arthur")
|
||||
XCTAssertEqual(s.lastName, "Martin")
|
||||
XCTAssertFalse(s.fetched)
|
||||
}
|
||||
|
||||
func testFetchFromDatabase() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("INSERT INTO structs (firstName, lastName) VALUES (?, ?)", arguments: ["Arthur", "Martin"])
|
||||
let ss = SimpleRowConvertible.fetch(db, "SELECT * FROM structs")
|
||||
let s = Array(ss).first!
|
||||
XCTAssertEqual(s.firstName, "Arthur")
|
||||
XCTAssertEqual(s.lastName, "Martin")
|
||||
XCTAssertTrue(s.fetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchAllFromDatabase() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("INSERT INTO structs (firstName, lastName) VALUES (?, ?)", arguments: ["Arthur", "Martin"])
|
||||
let ss = SimpleRowConvertible.fetchAll(db, "SELECT * FROM structs")
|
||||
let s = ss.first!
|
||||
XCTAssertEqual(s.firstName, "Arthur")
|
||||
XCTAssertEqual(s.lastName, "Martin")
|
||||
XCTAssertTrue(s.fetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchOneFromDatabase() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
let missingS = SimpleRowConvertible.fetchOne(db, "SELECT * FROM structs")
|
||||
XCTAssertTrue(missingS == nil)
|
||||
|
||||
try db.execute("INSERT INTO structs (firstName, lastName) VALUES (?, ?)", arguments: ["Arthur", "Martin"])
|
||||
let s = SimpleRowConvertible.fetchOne(db, "SELECT * FROM structs")!
|
||||
XCTAssertEqual(s.firstName, "Arthur")
|
||||
XCTAssertEqual(s.lastName, "Martin")
|
||||
XCTAssertTrue(s.fetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchFromStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("INSERT INTO structs (firstName, lastName) VALUES (?, ?)", arguments: ["Arthur", "Martin"])
|
||||
let statement = db.selectStatement("SELECT * FROM structs")
|
||||
let ss = SimpleRowConvertible.fetch(statement)
|
||||
let s = Array(ss).first!
|
||||
XCTAssertEqual(s.firstName, "Arthur")
|
||||
XCTAssertEqual(s.lastName, "Martin")
|
||||
XCTAssertTrue(s.fetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchAllFromStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("INSERT INTO structs (firstName, lastName) VALUES (?, ?)", arguments: ["Arthur", "Martin"])
|
||||
let statement = db.selectStatement("SELECT * FROM structs")
|
||||
let ss = SimpleRowConvertible.fetchAll(statement)
|
||||
let s = ss.first!
|
||||
XCTAssertEqual(s.firstName, "Arthur")
|
||||
XCTAssertEqual(s.lastName, "Martin")
|
||||
XCTAssertTrue(s.fetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchOneFromStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
let statement = db.selectStatement("SELECT * FROM structs")
|
||||
let missingS = SimpleRowConvertible.fetchOne(statement)
|
||||
XCTAssertTrue(missingS == nil)
|
||||
|
||||
try db.execute("INSERT INTO structs (firstName, lastName) VALUES (?, ?)", arguments: ["Arthur", "Martin"])
|
||||
let s = SimpleRowConvertible.fetchOne(statement)!
|
||||
XCTAssertEqual(s.firstName, "Arthur")
|
||||
XCTAssertEqual(s.lastName, "Martin")
|
||||
XCTAssertTrue(s.fetched)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-1250
File diff suppressed because it is too large.
Load diff
-172
@@ -1,172 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class SQLiteStatementConvertibleFetchTests: GRDBTestCase {
|
||||
|
||||
func testFetchFromStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (2)")
|
||||
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
let sequence = Int.fetch(statement)
|
||||
|
||||
XCTAssertEqual(Array(sequence), [1,2])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchAllFromStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (2)")
|
||||
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
let array = Int.fetchAll(statement)
|
||||
|
||||
XCTAssertEqual(array, [1,2])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchOneFromStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
|
||||
let nilBecauseMissingRow = Int.fetchOne(statement)
|
||||
XCTAssertTrue(nilBecauseMissingRow == nil)
|
||||
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
let nilBecauseMissingNULL = Int.fetchOne(statement)
|
||||
XCTAssertTrue(nilBecauseMissingNULL == nil)
|
||||
|
||||
try db.execute("DELETE FROM ints")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
let one = Int.fetchOne(statement)!
|
||||
XCTAssertEqual(one, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchFromDatabaes() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (2)")
|
||||
|
||||
let sequence = Int.fetch(db, "SELECT int FROM ints ORDER BY int")
|
||||
|
||||
XCTAssertEqual(Array(sequence), [1,2])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchAllFromDatabase() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (2)")
|
||||
|
||||
let array = Int.fetchAll(db, "SELECT int FROM ints ORDER BY int")
|
||||
|
||||
XCTAssertEqual(array, [1,2])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFetchOneFromDatabase() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
|
||||
let nilBecauseMissingRow = Int.fetchOne(db, "SELECT int FROM ints ORDER BY int")
|
||||
XCTAssertTrue(nilBecauseMissingRow == nil)
|
||||
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
let nilBecauseMissingNULL = Int.fetchOne(db, "SELECT int FROM ints ORDER BY int")
|
||||
XCTAssertTrue(nilBecauseMissingNULL == nil)
|
||||
|
||||
try db.execute("DELETE FROM ints")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
let one = Int.fetchOne(db, "SELECT int FROM ints ORDER BY int")!
|
||||
XCTAssertEqual(one, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testOptionalFetchFromStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
let sequence = Optional<Int>.fetch(statement)
|
||||
|
||||
let ints = Array(sequence)
|
||||
XCTAssertEqual(ints.count, 2)
|
||||
XCTAssertTrue(ints[0] == nil)
|
||||
XCTAssertEqual(ints[1]!, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testOptionalFetchAllFromStatement() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
let array = Optional<Int>.fetchAll(statement)
|
||||
|
||||
XCTAssertEqual(array.count, 2)
|
||||
XCTAssertTrue(array[0] == nil)
|
||||
XCTAssertEqual(array[1]!, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testOptionalFetchFromDatabaes() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let sequence = Optional<Int>.fetch(db, "SELECT int FROM ints ORDER BY int")
|
||||
|
||||
let ints = Array(sequence)
|
||||
XCTAssertEqual(ints.count, 2)
|
||||
XCTAssertTrue(ints[0] == nil)
|
||||
XCTAssertEqual(ints[1]!, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testOptionalFetchAllFromDatabase() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let array = Optional<Int>.fetchAll(db, "SELECT int FROM ints ORDER BY int")
|
||||
|
||||
XCTAssertEqual(array.count, 2)
|
||||
XCTAssertTrue(array[0] == nil)
|
||||
XCTAssertEqual(array[1]!, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class SelectStatementTests : GRDBTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
var migrator = DatabaseMigrator()
|
||||
|
||||
migrator.registerMigration("createPersons") { db in
|
||||
try db.execute(
|
||||
"CREATE TABLE persons (" +
|
||||
"id INTEGER PRIMARY KEY, " +
|
||||
"creationDate TEXT, " +
|
||||
"name TEXT NOT NULL, " +
|
||||
"age INT" +
|
||||
")")
|
||||
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (?,?)", arguments: ["Arthur", 41])
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (?,?)", arguments: ["Barbara", 26])
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (?,?)", arguments: ["Craig", 13])
|
||||
}
|
||||
|
||||
assertNoError {
|
||||
try migrator.migrate(dbQueue)
|
||||
}
|
||||
}
|
||||
|
||||
func testArrayStatementArguments() {
|
||||
assertNoError {
|
||||
dbQueue.inDatabase { db in
|
||||
let statement = db.selectStatement("SELECT COUNT(*) FROM persons WHERE age < ?")
|
||||
let ages = [20, 30, 40, 50]
|
||||
let counts = ages.map { Int.fetchOne(statement, arguments: [$0])! }
|
||||
XCTAssertEqual(counts, [1,2,2,3])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testStatementArgumentsSetterWithArray() {
|
||||
assertNoError {
|
||||
dbQueue.inDatabase { db in
|
||||
let statement = db.selectStatement("SELECT COUNT(*) FROM persons WHERE age < ?")
|
||||
let ages = [20, 30, 40, 50]
|
||||
let counts = ages.map { (age: Int) -> Int in
|
||||
statement.arguments = [age]
|
||||
return Int.fetchOne(statement)!
|
||||
}
|
||||
XCTAssertEqual(counts, [1,2,2,3])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testDictionaryStatementArguments() {
|
||||
assertNoError {
|
||||
dbQueue.inDatabase { db in
|
||||
let statement = db.selectStatement("SELECT COUNT(*) FROM persons WHERE age < :age")
|
||||
// TODO: Remove this explicit type declaration required by rdar://22357375
|
||||
let ageDicts: [[String: DatabaseValueConvertible?]] = [["age": 20], ["age": 30], ["age": 40], ["age": 50]]
|
||||
let counts = ageDicts.map { Int.fetchOne(statement, arguments: StatementArguments($0))! }
|
||||
XCTAssertEqual(counts, [1,2,2,3])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testStatementArgumentsSetterWithDictionary() {
|
||||
assertNoError {
|
||||
dbQueue.inDatabase { db in
|
||||
let statement = db.selectStatement("SELECT COUNT(*) FROM persons WHERE age < :age")
|
||||
// TODO: Remove this explicit type declaration required by rdar://22357375
|
||||
let ageDicts: [[String: DatabaseValueConvertible?]] = [["age": 20], ["age": 30], ["age": 40], ["age": 50]]
|
||||
let counts = ageDicts.map { ageDict -> Int in
|
||||
statement.arguments = StatementArguments(ageDict)
|
||||
return Int.fetchOne(statement)!
|
||||
}
|
||||
XCTAssertEqual(counts, [1,2,2,3])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowSequenceCanBeFetchedTwice() {
|
||||
assertNoError {
|
||||
dbQueue.inDatabase { db in
|
||||
let statement = db.selectStatement("SELECT * FROM persons ORDER BY name")
|
||||
var names1 = Row.fetch(statement).map { $0.value(named: "name") as String }
|
||||
var names2 = Row.fetch(statement).map { $0.value(named: "name") as String }
|
||||
|
||||
XCTAssertEqual(names1[0], "Arthur")
|
||||
XCTAssertEqual(names1[1], "Barbara")
|
||||
XCTAssertEqual(names1[2], "Craig")
|
||||
XCTAssertEqual(names2[0], "Arthur")
|
||||
XCTAssertEqual(names2[1], "Barbara")
|
||||
XCTAssertEqual(names2[2], "Craig")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowSequenceCanBeIteratedTwice() {
|
||||
assertNoError {
|
||||
dbQueue.inDatabase { db in
|
||||
let statement = db.selectStatement("SELECT * FROM persons ORDER BY name")
|
||||
let rows = Row.fetch(statement)
|
||||
var names1 = rows.map { $0.value(named: "name") as String }
|
||||
var names2 = rows.map { $0.value(named: "name") as String }
|
||||
|
||||
XCTAssertEqual(names1[0], "Arthur")
|
||||
XCTAssertEqual(names1[1], "Barbara")
|
||||
XCTAssertEqual(names1[2], "Craig")
|
||||
XCTAssertEqual(names2[0], "Arthur")
|
||||
XCTAssertEqual(names2[1], "Barbara")
|
||||
XCTAssertEqual(names2[2], "Craig")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testValueSequenceCanBeFetchedTwice() {
|
||||
assertNoError {
|
||||
dbQueue.inDatabase { db in
|
||||
let statement = db.selectStatement("SELECT name FROM persons ORDER BY name")
|
||||
var names1 = Array(String.fetch(statement))
|
||||
var names2 = Array(String.fetch(statement))
|
||||
|
||||
XCTAssertEqual(names1[0], "Arthur")
|
||||
XCTAssertEqual(names1[1], "Barbara")
|
||||
XCTAssertEqual(names1[2], "Craig")
|
||||
XCTAssertEqual(names2[0], "Arthur")
|
||||
XCTAssertEqual(names2[1], "Barbara")
|
||||
XCTAssertEqual(names2[2], "Craig")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testValueSequenceCanBeIteratedTwice() {
|
||||
assertNoError {
|
||||
dbQueue.inDatabase { db in
|
||||
let statement = db.selectStatement("SELECT name FROM persons ORDER BY name")
|
||||
let nameSequence = String.fetch(statement)
|
||||
var names1 = Array(nameSequence)
|
||||
var names2 = Array(nameSequence)
|
||||
|
||||
XCTAssertEqual(names1[0], "Arthur")
|
||||
XCTAssertEqual(names1[1], "Barbara")
|
||||
XCTAssertEqual(names1[2], "Craig")
|
||||
XCTAssertEqual(names2[0], "Arthur")
|
||||
XCTAssertEqual(names2[1], "Barbara")
|
||||
XCTAssertEqual(names2[2], "Craig")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class UpdateStatementTests : GRDBTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
var migrator = DatabaseMigrator()
|
||||
|
||||
migrator.registerMigration("createPersons") { db in
|
||||
try db.execute(
|
||||
"CREATE TABLE persons (" +
|
||||
"id INTEGER PRIMARY KEY, " +
|
||||
"creationDate TEXT, " +
|
||||
"name TEXT NOT NULL, " +
|
||||
"age INT" +
|
||||
")")
|
||||
}
|
||||
|
||||
assertNoError {
|
||||
try migrator.migrate(dbQueue)
|
||||
}
|
||||
}
|
||||
|
||||
func testTrailingSemiColonIsAcceptedAndOptional() {
|
||||
assertNoError {
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.updateStatement("INSERT INTO persons (name, age) VALUES ('Arthur', ?)").execute()
|
||||
try db.updateStatement("INSERT INTO persons (name, age) VALUES ('Barbara', ?)").execute()
|
||||
try db.updateStatement("INSERT INTO persons (name, age) VALUES ('Arthur', ?);").execute()
|
||||
try db.updateStatement("INSERT INTO persons (name, age) VALUES ('Barbara', ?);").execute()
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
let rows = Row.fetchAll(db, "SELECT * FROM persons ORDER BY name")
|
||||
XCTAssertEqual(rows.count, 4)
|
||||
XCTAssertEqual(rows[0].value(named: "name") as String, "Arthur")
|
||||
XCTAssertEqual(rows[1].value(named: "name") as String, "Arthur")
|
||||
XCTAssertEqual(rows[2].value(named: "name") as String, "Barbara")
|
||||
XCTAssertEqual(rows[3].value(named: "name") as String, "Barbara")
|
||||
}
|
||||
}
|
||||
|
||||
func testArrayStatementArguments() {
|
||||
assertNoError {
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
|
||||
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES (?, ?)")
|
||||
let persons: [[DatabaseValueConvertible?]] = [
|
||||
["Arthur", 41],
|
||||
["Barbara", nil],
|
||||
]
|
||||
for person in persons {
|
||||
try statement.execute(arguments: StatementArguments(person))
|
||||
}
|
||||
|
||||
return .Commit
|
||||
}
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
let rows = Row.fetchAll(db, "SELECT * FROM persons ORDER BY name")
|
||||
XCTAssertEqual(rows.count, 2)
|
||||
XCTAssertEqual(rows[0].value(named: "name") as String, "Arthur")
|
||||
XCTAssertEqual(rows[0].value(named: "age") as Int, 41)
|
||||
XCTAssertEqual(rows[1].value(named: "name") as String, "Barbara")
|
||||
XCTAssertTrue(rows[1].value(named: "age") == nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testStatementArgumentsSetterWithArray() {
|
||||
assertNoError {
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
|
||||
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES (?, ?)")
|
||||
let persons: [[DatabaseValueConvertible?]] = [
|
||||
["Arthur", 41],
|
||||
["Barbara", nil],
|
||||
]
|
||||
for person in persons {
|
||||
statement.arguments = StatementArguments(person)
|
||||
try statement.execute()
|
||||
}
|
||||
|
||||
return .Commit
|
||||
}
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
let rows = Row.fetchAll(db, "SELECT * FROM persons ORDER BY name")
|
||||
XCTAssertEqual(rows.count, 2)
|
||||
XCTAssertEqual(rows[0].value(named: "name") as String, "Arthur")
|
||||
XCTAssertEqual(rows[0].value(named: "age") as Int, 41)
|
||||
XCTAssertEqual(rows[1].value(named: "name") as String, "Barbara")
|
||||
XCTAssertTrue(rows[1].value(named: "age") == nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testDictionaryStatementArguments() {
|
||||
assertNoError {
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
|
||||
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES (:name, :age)")
|
||||
let persons: [[String: DatabaseValueConvertible?]] = [
|
||||
["name": "Arthur", "age": 41],
|
||||
["name": "Barbara", "age": nil],
|
||||
]
|
||||
for person in persons {
|
||||
try statement.execute(arguments: StatementArguments(person))
|
||||
}
|
||||
|
||||
return .Commit
|
||||
}
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
let rows = Row.fetchAll(db, "SELECT * FROM persons ORDER BY name")
|
||||
XCTAssertEqual(rows.count, 2)
|
||||
XCTAssertEqual(rows[0].value(named: "name") as String, "Arthur")
|
||||
XCTAssertEqual(rows[0].value(named: "age") as Int, 41)
|
||||
XCTAssertEqual(rows[1].value(named: "name") as String, "Barbara")
|
||||
XCTAssertTrue(rows[1].value(named: "age") == nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testStatementArgumentsSetterWithDictionary() {
|
||||
assertNoError {
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
|
||||
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES (:name, :age)")
|
||||
let persons: [[String: DatabaseValueConvertible?]] = [
|
||||
["name": "Arthur", "age": 41],
|
||||
["name": "Barbara", "age": nil],
|
||||
]
|
||||
for person in persons {
|
||||
statement.arguments = StatementArguments(person)
|
||||
try statement.execute()
|
||||
}
|
||||
|
||||
return .Commit
|
||||
}
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
let rows = Row.fetchAll(db, "SELECT * FROM persons ORDER BY name")
|
||||
XCTAssertEqual(rows.count, 2)
|
||||
XCTAssertEqual(rows[0].value(named: "name") as String, "Arthur")
|
||||
XCTAssertEqual(rows[0].value(named: "age") as Int, 41)
|
||||
XCTAssertEqual(rows[1].value(named: "name") as String, "Barbara")
|
||||
XCTAssertTrue(rows[1].value(named: "age") == nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,611 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class TransactionObserver : TransactionObserverType {
|
||||
var lastCommittedEvents: [DatabaseEvent] = []
|
||||
var events: [DatabaseEvent] = []
|
||||
var commitError: ErrorType?
|
||||
|
||||
var didChangeCount: Int = 0
|
||||
var willCommitCount: Int = 0
|
||||
var didCommitCount: Int = 0
|
||||
var didRollbackCount: Int = 0
|
||||
|
||||
func resetCounts() {
|
||||
didChangeCount = 0
|
||||
willCommitCount = 0
|
||||
didCommitCount = 0
|
||||
didRollbackCount = 0
|
||||
}
|
||||
|
||||
func databaseDidChangeWithEvent(event: DatabaseEvent) {
|
||||
didChangeCount++
|
||||
events.append(event)
|
||||
}
|
||||
|
||||
func databaseWillCommit() throws {
|
||||
willCommitCount++
|
||||
if let commitError = commitError {
|
||||
throw commitError
|
||||
}
|
||||
}
|
||||
|
||||
func databaseDidCommit(db: Database) {
|
||||
didCommitCount++
|
||||
lastCommittedEvents = events
|
||||
events = []
|
||||
}
|
||||
|
||||
func databaseDidRollback(db: Database) {
|
||||
didRollbackCount++
|
||||
lastCommittedEvents = []
|
||||
events = []
|
||||
}
|
||||
}
|
||||
|
||||
class Artist : Record {
|
||||
var id: Int64?
|
||||
var name: String?
|
||||
|
||||
init(name: String?) {
|
||||
self.name = name
|
||||
super.init()
|
||||
}
|
||||
|
||||
required init(row: Row) {
|
||||
super.init(row: row)
|
||||
}
|
||||
|
||||
static override func databaseTableName() -> String {
|
||||
return "artists"
|
||||
}
|
||||
|
||||
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
|
||||
return ["id": id, "name": name]
|
||||
}
|
||||
|
||||
override func updateFromRow(row: Row) {
|
||||
if let dbv = row["id"] { id = dbv.value() }
|
||||
if let dbv = row["name"] { name = dbv.value() }
|
||||
super.updateFromRow(row)
|
||||
}
|
||||
|
||||
static func setupInDatabase(db: Database) throws {
|
||||
try db.execute(
|
||||
"CREATE TABLE artists (" +
|
||||
"id INTEGER PRIMARY KEY, " +
|
||||
"name TEXT" +
|
||||
")")
|
||||
}
|
||||
}
|
||||
|
||||
class Artwork : Record {
|
||||
var id: Int64?
|
||||
var artistId: Int64?
|
||||
var title: String?
|
||||
|
||||
init(title: String?, artistId: Int64? = nil) {
|
||||
self.title = title
|
||||
self.artistId = artistId
|
||||
super.init()
|
||||
}
|
||||
|
||||
required init(row: Row) {
|
||||
super.init(row: row)
|
||||
}
|
||||
|
||||
static override func databaseTableName() -> String {
|
||||
return "artworks"
|
||||
}
|
||||
|
||||
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
|
||||
return ["id": id, "artistId": artistId, "title": title]
|
||||
}
|
||||
|
||||
override func updateFromRow(row: Row) {
|
||||
if let dbv = row["id"] { id = dbv.value() }
|
||||
if let dbv = row["artistId"] { artistId = dbv.value() }
|
||||
if let dbv = row["title"] { title = dbv.value() }
|
||||
super.updateFromRow(row)
|
||||
}
|
||||
|
||||
static func setupInDatabase(db: Database) throws {
|
||||
try db.execute(
|
||||
"CREATE TABLE artworks (" +
|
||||
"id INTEGER PRIMARY KEY, " +
|
||||
"artistId INTEGER NOT NULL REFERENCES artists(id) ON DELETE CASCADE ON UPDATE CASCADE, " +
|
||||
"title TEXT" +
|
||||
")")
|
||||
}
|
||||
}
|
||||
|
||||
class TransactionObserverTests: GRDBTestCase {
|
||||
var observer: TransactionObserver!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try Artist.setupInDatabase(db)
|
||||
try Artwork.setupInDatabase(db)
|
||||
}
|
||||
}
|
||||
|
||||
self.observer.resetCounts()
|
||||
}
|
||||
|
||||
override var dbConfiguration: Configuration {
|
||||
observer = TransactionObserver()
|
||||
var c = super.dbConfiguration
|
||||
c.transactionObserver = observer
|
||||
return c
|
||||
}
|
||||
|
||||
func match(event event: DatabaseEvent, kind: DatabaseEvent.Kind, tableName: String, rowId: Int64) -> Bool {
|
||||
return (event.tableName == tableName) && (event.rowID == rowId) && (event.kind == kind)
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Events
|
||||
|
||||
func testInsertEvent() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
let artist = Artist(name: "Gerhard Richter")
|
||||
|
||||
//
|
||||
try artist.save(db)
|
||||
XCTAssertEqual(self.observer.lastCommittedEvents.count, 1)
|
||||
let event = self.observer.lastCommittedEvents.filter { event in
|
||||
self.match(event: event, kind: .Insert, tableName: "artists", rowId: artist.id!)
|
||||
}.first
|
||||
XCTAssertTrue(event != nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testUpdateEvent() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
let artist = Artist(name: "Gerhard Richter")
|
||||
try artist.save(db)
|
||||
artist.name = "Vincent Fournier"
|
||||
|
||||
//
|
||||
try artist.save(db)
|
||||
XCTAssertEqual(self.observer.lastCommittedEvents.count, 1)
|
||||
let event = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Update, tableName: "artists", rowId: artist.id!)
|
||||
}.first
|
||||
XCTAssertTrue(event != nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testDeleteEvent() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
let artist = Artist(name: "Gerhard Richter")
|
||||
try artist.save(db)
|
||||
|
||||
//
|
||||
try artist.delete(db)
|
||||
XCTAssertEqual(self.observer.lastCommittedEvents.count, 1)
|
||||
let event = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Delete, tableName: "artists", rowId: artist.id!)
|
||||
}.first
|
||||
XCTAssertTrue(event != nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testCascadingDeleteEvents() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
let artist = Artist(name: "Gerhard Richter")
|
||||
try artist.save(db)
|
||||
let artwork1 = Artwork(title: "Cloud", artistId: artist.id)
|
||||
try artwork1.save(db)
|
||||
let artwork2 = Artwork(title: "Ema (Nude on a Staircase)", artistId: artist.id)
|
||||
try artwork2.save(db)
|
||||
|
||||
//
|
||||
try artist.delete(db)
|
||||
XCTAssertEqual(self.observer.lastCommittedEvents.count, 3)
|
||||
let artistEvent = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Delete, tableName: "artists", rowId: artist.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artistEvent != nil)
|
||||
let artwork1Event = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Delete, tableName: "artworks", rowId: artwork1.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artwork1Event != nil)
|
||||
let artwork2Event = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Delete, tableName: "artworks", rowId: artwork2.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artwork2Event != nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Commits & Rollback
|
||||
|
||||
func testImplicitTransactionCommit() {
|
||||
assertNoError {
|
||||
let artist = Artist(name: "Gerhard Richter")
|
||||
|
||||
try dbQueue.inDatabase { db in
|
||||
self.observer.resetCounts()
|
||||
try artist.save(db)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 1)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 1)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 1)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testCascadeWithImplicitTransactionCommit() {
|
||||
assertNoError {
|
||||
let artist = Artist(name: "Gerhard Richter")
|
||||
let artwork1 = Artwork(title: "Cloud")
|
||||
let artwork2 = Artwork(title: "Ema (Nude on a Staircase)")
|
||||
|
||||
try dbQueue.inDatabase { db in
|
||||
try artist.save(db)
|
||||
artwork1.artistId = artist.id
|
||||
artwork2.artistId = artist.id
|
||||
try artwork1.save(db)
|
||||
try artwork2.save(db)
|
||||
|
||||
//
|
||||
self.observer.resetCounts()
|
||||
try artist.delete(db)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 3) // 3 deletes
|
||||
XCTAssertEqual(self.observer.willCommitCount, 1)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 1)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
|
||||
let artistDeleteEvent = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Delete, tableName: "artists", rowId: artist.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artistDeleteEvent != nil)
|
||||
|
||||
let artwork1DeleteEvent = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Delete, tableName: "artworks", rowId: artwork1.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artwork1DeleteEvent != nil)
|
||||
|
||||
let artwork2DeleteEvent = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Delete, tableName: "artworks", rowId: artwork2.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artwork2DeleteEvent != nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testExplicitTransactionCommit() {
|
||||
assertNoError {
|
||||
let artist = Artist(name: "Gerhard Richter")
|
||||
let artwork1 = Artwork(title: "Cloud")
|
||||
let artwork2 = Artwork(title: "Ema (Nude on a Staircase)")
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
self.observer.resetCounts()
|
||||
try artist.save(db)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 1)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
|
||||
artwork1.artistId = artist.id
|
||||
artwork2.artistId = artist.id
|
||||
|
||||
self.observer.resetCounts()
|
||||
try artwork1.save(db)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 1)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
|
||||
self.observer.resetCounts()
|
||||
try artwork2.save(db)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 1)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
|
||||
self.observer.resetCounts()
|
||||
return .Commit
|
||||
}
|
||||
XCTAssertEqual(self.observer.didChangeCount, 0)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 1)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 1)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
XCTAssertEqual(observer.lastCommittedEvents.count, 3)
|
||||
|
||||
let artistEvent = observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Insert, tableName: "artists", rowId: artist.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artistEvent != nil)
|
||||
|
||||
let artwork1Event = observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Insert, tableName: "artworks", rowId: artwork1.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artwork1Event != nil)
|
||||
|
||||
let artwork2Event = observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Insert, tableName: "artworks", rowId: artwork2.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artwork2Event != nil)
|
||||
}
|
||||
}
|
||||
|
||||
func testCascadeWithExplicitTransactionCommit() {
|
||||
assertNoError {
|
||||
let artist = Artist(name: "Gerhard Richter")
|
||||
let artwork1 = Artwork(title: "Cloud")
|
||||
let artwork2 = Artwork(title: "Ema (Nude on a Staircase)")
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try artist.save(db)
|
||||
artwork1.artistId = artist.id
|
||||
artwork2.artistId = artist.id
|
||||
try artwork1.save(db)
|
||||
try artwork2.save(db)
|
||||
|
||||
//
|
||||
self.observer.resetCounts()
|
||||
try artist.delete(db)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 3) // 3 deletes
|
||||
XCTAssertEqual(self.observer.willCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
|
||||
self.observer.resetCounts()
|
||||
return .Commit
|
||||
}
|
||||
XCTAssertEqual(self.observer.didChangeCount, 0)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 1)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 1)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
XCTAssertEqual(self.observer.lastCommittedEvents.count, 6) // 3 inserts, and 3 deletes
|
||||
|
||||
let artistInsertEvent = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Insert, tableName: "artists", rowId: artist.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artistInsertEvent != nil)
|
||||
|
||||
let artwork1InsertEvent = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Insert, tableName: "artworks", rowId: artwork1.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artwork1InsertEvent != nil)
|
||||
|
||||
let artwork2InsertEvent = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Insert, tableName: "artworks", rowId: artwork2.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artwork2InsertEvent != nil)
|
||||
|
||||
let artistDeleteEvent = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Delete, tableName: "artists", rowId: artist.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artistDeleteEvent != nil)
|
||||
|
||||
let artwork1DeleteEvent = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Delete, tableName: "artworks", rowId: artwork1.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artwork1DeleteEvent != nil)
|
||||
|
||||
let artwork2DeleteEvent = self.observer.lastCommittedEvents.filter {
|
||||
self.match(event: $0, kind: .Delete, tableName: "artworks", rowId: artwork2.id!)
|
||||
}.first
|
||||
XCTAssertTrue(artwork2DeleteEvent != nil)
|
||||
}
|
||||
}
|
||||
|
||||
func testExplicitTransactionRollback() {
|
||||
assertNoError {
|
||||
let artist = Artist(name: "Gerhard Richter")
|
||||
let artwork1 = Artwork(title: "Cloud")
|
||||
let artwork2 = Artwork(title: "Ema (Nude on a Staircase)")
|
||||
|
||||
try dbQueue.inTransaction { db in
|
||||
try artist.save(db)
|
||||
artwork1.artistId = artist.id
|
||||
artwork2.artistId = artist.id
|
||||
try artwork1.save(db)
|
||||
try artwork2.save(db)
|
||||
|
||||
self.observer.resetCounts()
|
||||
return .Rollback
|
||||
}
|
||||
XCTAssertEqual(self.observer.didChangeCount, 0)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 1)
|
||||
}
|
||||
}
|
||||
|
||||
func testImplicitTransactionRollbackCausedByDatabaseError() {
|
||||
assertNoError {
|
||||
do {
|
||||
try dbQueue.inDatabase { db in
|
||||
do {
|
||||
try Artwork(title: "meh").save(db)
|
||||
XCTFail("Expected Error")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.code, 19)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 0)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
XCTFail("Expected Error")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.code, 19)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 0)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testExplicitTransactionRollbackCausedByDatabaseError() {
|
||||
assertNoError {
|
||||
do {
|
||||
try dbQueue.inTransaction { db in
|
||||
do {
|
||||
try Artwork(title: "meh").save(db)
|
||||
XCTFail("Expected Error")
|
||||
} catch let error as DatabaseError {
|
||||
// Immediate constraint check has failed.
|
||||
XCTAssertEqual(error.code, 19)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 0)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
throw error
|
||||
}
|
||||
return .Commit
|
||||
}
|
||||
XCTFail("Expected Error")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.code, 19)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 0)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testImplicitTransactionRollbackCausedByTransactionObserver() {
|
||||
assertNoError {
|
||||
self.observer.commitError = NSError(domain: "foo", code: 0, userInfo: nil)
|
||||
dbQueue.inDatabase { db in
|
||||
do {
|
||||
try Artist(name: "Gerhard Richter").save(db)
|
||||
XCTFail("Expected Error")
|
||||
} catch let error as NSError {
|
||||
XCTAssertEqual(error.domain, "foo")
|
||||
XCTAssertEqual(error.code, 0)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 1)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 1)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testExplicitTransactionRollbackCausedByTransactionObserver() {
|
||||
assertNoError {
|
||||
self.observer.commitError = NSError(domain: "foo", code: 0, userInfo: nil)
|
||||
do {
|
||||
try dbQueue.inTransaction { db in
|
||||
try Artist(name: "Gerhard Richter").save(db)
|
||||
return .Commit
|
||||
}
|
||||
XCTFail("Expected Error")
|
||||
} catch let error as NSError {
|
||||
XCTAssertEqual(error.domain, "foo")
|
||||
XCTAssertEqual(error.code, 0)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 1)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 1)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testImplicitTransactionRollbackCausedByDatabaseErrorSuperseedTransactionObserver() {
|
||||
assertNoError {
|
||||
self.observer.commitError = NSError(domain: "foo", code: 0, userInfo: nil)
|
||||
do {
|
||||
try dbQueue.inDatabase { db in
|
||||
do {
|
||||
try Artwork(title: "meh").save(db)
|
||||
XCTFail("Expected Error")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.code, 19)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 0)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
XCTFail("Expected Error")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.code, 19)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 0)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testExplicitTransactionRollbackCausedByDatabaseErrorSuperseedTransactionObserver() {
|
||||
assertNoError {
|
||||
self.observer.commitError = NSError(domain: "foo", code: 0, userInfo: nil)
|
||||
do {
|
||||
try dbQueue.inTransaction { db in
|
||||
do {
|
||||
try Artwork(title: "meh").save(db)
|
||||
XCTFail("Expected Error")
|
||||
} catch let error as DatabaseError {
|
||||
// Immediate constraint check has failed.
|
||||
XCTAssertEqual(error.code, 19)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 0)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
throw error
|
||||
}
|
||||
return .Commit
|
||||
}
|
||||
XCTFail("Expected Error")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.code, 19)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 0)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 0)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testMinimalRowIDUpdateObservation() {
|
||||
// Here we test that updating a Record made of a single primary key
|
||||
// column performs an actual UPDATE statement, even though it is
|
||||
// totally useless (UPDATE id = 1 FROM records WHERE id = 1).
|
||||
//
|
||||
// It is important to update something, so that TransactionObserverType
|
||||
// can observe a change.
|
||||
//
|
||||
// The goal is to be able to write tests with minimal tables,
|
||||
// including tables made of a single primary key column. The less we
|
||||
// have exceptions, the better it is.
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try MinimalRowID.setupInDatabase(db)
|
||||
|
||||
let record = MinimalRowID()
|
||||
try record.save(db)
|
||||
|
||||
self.observer.resetCounts()
|
||||
try record.update(db)
|
||||
XCTAssertEqual(self.observer.didChangeCount, 1)
|
||||
XCTAssertEqual(self.observer.willCommitCount, 1)
|
||||
XCTAssertEqual(self.observer.didCommitCount, 1)
|
||||
XCTAssertEqual(self.observer.didRollbackCount, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import XCTest
|
||||
import CoreGraphics
|
||||
import GRDB
|
||||
|
||||
class CGFloatTests: GRDBTestCase {
|
||||
|
||||
func testCGFLoat() {
|
||||
assertNoError {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE points (x DOUBLE, y DOUBLE)")
|
||||
|
||||
let x: CGFloat = 1
|
||||
let y: CGFloat? = nil
|
||||
try db.execute("INSERT INTO points VALUES (?,?)", arguments: [x, y])
|
||||
|
||||
let row = Row.fetchOne(db, "SELECT * FROM points")!
|
||||
let fetchedX: CGFloat = row.value(named: "x")
|
||||
let fetchedY: CGFloat? = row.value(named: "y")
|
||||
XCTAssertEqual(x, fetchedX)
|
||||
XCTAssertTrue(fetchedY == nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,663 +0,0 @@
|
||||
// All tests in this file must crash.
|
||||
//
|
||||
// To run those tests, check the GRDBOSXTests and GRDBiOSTests membership.
|
||||
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
|
||||
// MARK: - Support
|
||||
|
||||
class RecordWithoutDatabaseTableName: Record { }
|
||||
|
||||
class RecordWithInexistingDatabaseTable: Record {
|
||||
override static func databaseTableName() -> String? {
|
||||
return "foo"
|
||||
}
|
||||
}
|
||||
|
||||
class RecordWithEmptyStoredDatabaseDictionary : Record {
|
||||
override static func databaseTableName() -> String? {
|
||||
return "records"
|
||||
}
|
||||
}
|
||||
|
||||
class RecordWithNilPrimaryKey : Record {
|
||||
override static func databaseTableName() -> String? {
|
||||
return "records"
|
||||
}
|
||||
|
||||
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
|
||||
return ["id": nil]
|
||||
}
|
||||
}
|
||||
|
||||
class RecordForTableWithoutPrimaryKey : Record {
|
||||
override static func databaseTableName() -> String? {
|
||||
return "records"
|
||||
}
|
||||
|
||||
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
|
||||
return ["name": "foo"]
|
||||
}
|
||||
}
|
||||
|
||||
class RecordForTableWithMultipleColumnsPrimaryKey : Record {
|
||||
override static func databaseTableName() -> String? {
|
||||
return "records"
|
||||
}
|
||||
|
||||
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
|
||||
return ["name": "foo"]
|
||||
}
|
||||
}
|
||||
|
||||
class RecordWithRowIDPrimaryKeyNotExposedInStoredDatabaseDictionary : Record {
|
||||
override static func databaseTableName() -> String? {
|
||||
return "records"
|
||||
}
|
||||
|
||||
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
|
||||
return ["name": "foo"]
|
||||
}
|
||||
}
|
||||
|
||||
// A type that adopts DatabaseValueConvertible but does not adopt SQLiteStatementConvertible
|
||||
struct IntConvertible: DatabaseValueConvertible {
|
||||
let int: Int
|
||||
init(int: Int) {
|
||||
self.int = int
|
||||
}
|
||||
var databaseValue: DatabaseValue {
|
||||
return DatabaseValue(int64: Int64(int))
|
||||
}
|
||||
static func fromDatabaseValue(databaseValue: DatabaseValue) -> IntConvertible? {
|
||||
guard let int = Int.fromDatabaseValue(databaseValue) else {
|
||||
return nil
|
||||
}
|
||||
return IntConvertible(int: int)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - CrashTests
|
||||
|
||||
class CrashTests: GRDBTestCase {
|
||||
|
||||
// This method does not actually catch any crash.
|
||||
// But it expresses an intent :-)
|
||||
func assertCrash(message: String, @noescape block: () throws -> ()) {
|
||||
do {
|
||||
try block()
|
||||
XCTFail("Crash expected: \(message)")
|
||||
} catch {
|
||||
XCTFail("Unexpected error: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// MARK: - Migrations
|
||||
|
||||
func testMigrationNamesMustBeUnique() {
|
||||
assertCrash("Already registered migration: \"foo\"") {
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.registerMigration("foo") { db in }
|
||||
migrator.registerMigration("foo") { db in }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// MARK: - Queue
|
||||
|
||||
func testInDatabaseIsNotReentrant() {
|
||||
assertCrash("DatabaseQueue.inDatabase(_:) or DatabaseQueue.inTransaction(_:) was called reentrantly, which would lead to a deadlock.") {
|
||||
dbQueue.inDatabase { db in
|
||||
self.dbQueue.inDatabase { db in
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testInTransactionInsideInDatabaseIsNotReentrant() {
|
||||
assertCrash("DatabaseQueue.inDatabase(_:) or DatabaseQueue.inTransaction(_:) was called reentrantly, which would lead to a deadlock.") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try self.dbQueue.inTransaction { db in
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testInTransactionIsNotReentrant() {
|
||||
assertCrash("DatabaseQueue.inDatabase(_:) or DatabaseQueue.inTransaction(_:) was called reentrantly, which would lead to a deadlock.") {
|
||||
try dbQueue.inTransaction { db in
|
||||
try self.dbQueue.inTransaction { db in
|
||||
return .Commit
|
||||
}
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRowSequenceCanNotBeGeneratedOutsideOfDatabaseQueue() {
|
||||
assertCrash("Database was not used on the correct queue.") {
|
||||
var rows: DatabaseSequence<Row>?
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT)")
|
||||
rows = Row.fetch(db, "SELECT * FROM persons")
|
||||
}
|
||||
let _ = rows!.generate()
|
||||
}
|
||||
}
|
||||
|
||||
func testRowSequenceCanNotBeIteratedOutsideOfDatabaseQueue() {
|
||||
assertCrash("Database was not used on the correct queue.") {
|
||||
var generator: DatabaseGenerator<Row>?
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT)")
|
||||
generator = Row.fetch(db, "SELECT * FROM persons").generate()
|
||||
}
|
||||
generator!.next()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// MARK: - Statements
|
||||
|
||||
func testExecuteDoesNotSupportMultipleStatement() {
|
||||
assertCrash("Invalid SQL string: multiple statements found.") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT, age INT); CREATE TABLE books (name TEXT, age INT)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testInvalidNamedBinding() {
|
||||
assertCrash("Key not found in SQLite statement: `:XXX`") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
|
||||
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["XXX": "foo", "name": "Arthur", "age": 41])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// MARK: - RecordWithoutDatabaseTableName
|
||||
|
||||
func testRecordWithoutDatabaseTableNameCanNotBeFetchedByID() {
|
||||
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
|
||||
dbQueue.inDatabase { db in
|
||||
RecordWithoutDatabaseTableName.fetchOne(db, primaryKey: 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithoutDatabaseTableNameCanNotBeFetchedByKey() {
|
||||
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
|
||||
dbQueue.inDatabase { db in
|
||||
RecordWithoutDatabaseTableName.fetchOne(db, key: ["foo": "bar"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithoutDatabaseTableNameCanNotBeInserted() {
|
||||
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try RecordWithoutDatabaseTableName().insert(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithoutDatabaseTableNameCanNotBeUpdated() {
|
||||
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try RecordWithoutDatabaseTableName().update(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithoutDatabaseTableNameCanNotBeSaved() {
|
||||
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try RecordWithoutDatabaseTableName().save(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithoutDatabaseTableNameCanNotBeDeleted() {
|
||||
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try RecordWithoutDatabaseTableName().delete(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithoutDatabaseTableNameCanNotBeReloaded() {
|
||||
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try RecordWithoutDatabaseTableName().reload(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithoutDatabaseTableNameCanNotBeTestedForExistence() {
|
||||
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
|
||||
dbQueue.inDatabase { db in
|
||||
RecordWithoutDatabaseTableName().exists(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// MARK: - RecordWithInexistingDatabaseTable
|
||||
|
||||
func testRecordWithInexistingDatabaseTableCanNotBeFetchedByID() {
|
||||
assertCrash("Table \"foo\" does not exist.") {
|
||||
dbQueue.inDatabase { db in
|
||||
RecordWithInexistingDatabaseTable.fetchOne(db, primaryKey: 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithInexistingDatabaseTableCanNotBeFetchedByKey() {
|
||||
assertCrash("no such table: foo") {
|
||||
dbQueue.inDatabase { db in
|
||||
RecordWithInexistingDatabaseTable.fetchOne(db, key: ["id": 1])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithInexistingDatabaseTableCanNotBeInserted() {
|
||||
assertCrash("Table \"foo\" does not exist.") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try RecordWithInexistingDatabaseTable().insert(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithInexistingDatabaseTableCanNotBeUpdated() {
|
||||
assertCrash("Table \"foo\" does not exist.") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try RecordWithInexistingDatabaseTable().update(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithInexistingDatabaseTableCanNotBeSaved() {
|
||||
assertCrash("Table \"foo\" does not exist.") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try RecordWithInexistingDatabaseTable().save(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithInexistingDatabaseTableCanNotBeDeleted() {
|
||||
assertCrash("Table \"foo\" does not exist.") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try RecordWithInexistingDatabaseTable().delete(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithInexistingDatabaseTableCanNotBeReloaded() {
|
||||
assertCrash("Table \"foo\" does not exist.") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try RecordWithInexistingDatabaseTable().reload(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithInexistingDatabaseTableCanNotBeTestedForExistence() {
|
||||
assertCrash("Table \"foo\" does not exist.") {
|
||||
dbQueue.inDatabase { db in
|
||||
RecordWithInexistingDatabaseTable().exists(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// MARK: - RecordWithEmptyStoredDatabaseDictionary
|
||||
|
||||
func testRecordWithEmptyStoredDatabaseDictionaryCanNotBeInserted() {
|
||||
assertCrash("Invalid empty dictionary") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
|
||||
try RecordWithEmptyStoredDatabaseDictionary().insert(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithEmptyStoredDatabaseDictionaryCanNotBeUpdated() {
|
||||
assertCrash("Invalid empty dictionary") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
|
||||
try RecordWithEmptyStoredDatabaseDictionary().update(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithEmptyStoredDatabaseDictionaryCanNotBeSaved() {
|
||||
assertCrash("Invalid empty dictionary") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
|
||||
try RecordWithEmptyStoredDatabaseDictionary().save(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithEmptyStoredDatabaseDictionaryCanNotBeDeleted() {
|
||||
assertCrash("Invalid empty dictionary") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
|
||||
try RecordWithEmptyStoredDatabaseDictionary().delete(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithEmptyStoredDatabaseDictionaryCanNotBeReloaded() {
|
||||
assertCrash("Invalid empty dictionary") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
|
||||
try RecordWithEmptyStoredDatabaseDictionary().reload(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithEmptyStoredDatabaseDictionaryCanNotBeTestedForExistence() {
|
||||
assertCrash("Invalid empty dictionary") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
|
||||
RecordWithEmptyStoredDatabaseDictionary().exists(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// MARK: - RecordWithNilPrimaryKey
|
||||
|
||||
func testRecordWithNilPrimaryKeyCanNotBeUpdated() {
|
||||
assertCrash("Invalid primary key") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
|
||||
try RecordWithNilPrimaryKey().update(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithNilPrimaryKeyCanNotBeDeleted() {
|
||||
assertCrash("Invalid primary key") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
|
||||
try RecordWithNilPrimaryKey().delete(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithNilPrimaryKeyCanNotBeReloaded() {
|
||||
assertCrash("Invalid primary key") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
|
||||
try RecordWithNilPrimaryKey().reload(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordWithNilPrimaryKeyCanNotBeTestedForExistence() {
|
||||
assertCrash("Invalid primary key") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
|
||||
RecordWithNilPrimaryKey().exists(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// MARK: - RecordForTableWithoutPrimaryKey
|
||||
|
||||
func testRecordForTableWithoutPrimaryKeyCanNotBeFetchedByID() {
|
||||
assertCrash("Primary key of table \"records\" is not made of a single column.") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (name TEXT)")
|
||||
RecordForTableWithoutPrimaryKey.fetchOne(db, primaryKey: 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordForTableWithoutPrimaryKeyCanNotBeUpdated() {
|
||||
assertCrash("Invalid primary key") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (name TEXT)")
|
||||
try RecordForTableWithoutPrimaryKey().update(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordForTableWithoutPrimaryKeyCanNotBeDeleted() {
|
||||
assertCrash("Invalid primary key") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (name TEXT)")
|
||||
try RecordForTableWithoutPrimaryKey().delete(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordForTableWithoutPrimaryKeyCanNotBeReloaded() {
|
||||
assertCrash("Invalid primary key") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (name TEXT)")
|
||||
try RecordForTableWithoutPrimaryKey().reload(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRecordForTableWithoutPrimaryKeyCanNotBeTestedForExistence() {
|
||||
assertCrash("Invalid primary key") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (name TEXT)")
|
||||
RecordForTableWithoutPrimaryKey().exists(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// MARK: - RecordForTableWithMultipleColumnsPrimaryKey
|
||||
|
||||
func testRecordForTableWithMultipleColumnsPrimaryKeyCanNotBeFetchedByID() {
|
||||
assertCrash("Primary key of table \"records\" is not made of a single column.") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (a TEXT, b TEXT, PRIMARY KEY(a,b))")
|
||||
RecordForTableWithMultipleColumnsPrimaryKey.fetchOne(db, primaryKey: 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// MARK: - RecordWithRowIDPrimaryKeyNotExposedInStoredDatabaseDictionary
|
||||
|
||||
func testRecordWithRowIDPrimaryKeyNotExposedInStoredDatabaseDictionaryCanNotBeInserted() {
|
||||
assertCrash("RecordWithRowIDPrimaryKeyNotExposedInStoredDatabaseDictionary.storedDatabaseDictionary must return the value for the primary key \"id\"") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY, name TEXT)")
|
||||
try RecordWithRowIDPrimaryKeyNotExposedInStoredDatabaseDictionary().insert(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// MARK: - Concurrency
|
||||
|
||||
func testReaderCrashDuringExclusiveTransaction() {
|
||||
assertCrash("SQLite error 5 with statement `SELECT * FROM stuffs`: database is locked") {
|
||||
databasePath = "/tmp/GRDBTestReaderDuringExclusiveTransaction.sqlite"
|
||||
do { try NSFileManager.defaultManager().removeItemAtPath(databasePath) } catch { }
|
||||
let dbQueue1 = try! DatabaseQueue(path: databasePath)
|
||||
let dbQueue2 = try! DatabaseQueue(path: databasePath)
|
||||
|
||||
try! dbQueue1.inDatabase { db in
|
||||
try db.execute("CREATE TABLE stuffs (id INTEGER PRIMARY KEY)")
|
||||
}
|
||||
|
||||
let queue = NSOperationQueue()
|
||||
queue.maxConcurrentOperationCount = 2
|
||||
queue.addOperation(NSBlockOperation {
|
||||
do {
|
||||
try dbQueue1.inTransaction(.Exclusive) { db in
|
||||
sleep(2) // let other queue try to read.
|
||||
return .Commit
|
||||
}
|
||||
}
|
||||
catch is DatabaseError {
|
||||
}
|
||||
catch {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
})
|
||||
|
||||
queue.addOperation(NSBlockOperation {
|
||||
dbQueue2.inDatabase { db in
|
||||
sleep(1) // let other queue open transaction
|
||||
Row.fetch(db, "SELECT * FROM stuffs") // Crash expected
|
||||
}
|
||||
})
|
||||
|
||||
queue.waitUntilAllOperationsAreFinished()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// MARK: - DatabaseValueConvertible
|
||||
|
||||
func testCrashFetchDatabaseValueConvertibleFromStatement() {
|
||||
assertCrash("Could not convert NULL to IntConvertible while iterating `SELECT int FROM ints ORDER BY int`.") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
let sequence = IntConvertible.fetch(statement)
|
||||
for _ in sequence { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testCrashFetchAllDatabaseValueConvertibleFromStatement() {
|
||||
assertCrash("Could not convert NULL to IntConvertible while iterating `SELECT int FROM ints ORDER BY int`.") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
let _ = IntConvertible.fetchAll(statement)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testCrashFetchDatabaseValueConvertibleFromDatabase() {
|
||||
assertCrash("Could not convert NULL to IntConvertible while iterating `SELECT int FROM ints ORDER BY int`.") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let sequence = IntConvertible.fetch(db, "SELECT int FROM ints ORDER BY int")
|
||||
for _ in sequence { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testCrashFetchAllDatabaseValueConvertibleFromDatabase() {
|
||||
assertCrash("Could not convert NULL to IntConvertible while iterating `SELECT int FROM ints ORDER BY int`.") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let _ = IntConvertible.fetchAll(db, "SELECT int FROM ints ORDER BY int")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testCrashDatabaseValueConvertibleInvalidConversionFromNULL() {
|
||||
assertCrash("Could not convert NULL to IntConvertible.") {
|
||||
let row = Row(dictionary: ["int": nil])
|
||||
let _ = row.value(named: "int") as IntConvertible
|
||||
}
|
||||
}
|
||||
|
||||
func testCrashDatabaseValueConvertibleInvalidConversionFromInvalidType() {
|
||||
assertCrash("Could not convert \"foo\" to IntConvertible.") {
|
||||
let row = Row(dictionary: ["int": "foo"])
|
||||
let _ = row.value(named: "int") as IntConvertible
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// MARK: - SQLiteStatementConvertible
|
||||
|
||||
func testCrashFetchSQLiteStatementConvertibleFromStatement() {
|
||||
assertCrash("Found NULL") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
let sequence = Int.fetch(statement)
|
||||
for _ in sequence { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testCrashFetchAllSQLiteStatementConvertibleFromStatement() {
|
||||
assertCrash("Found NULL") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
|
||||
let _ = Int.fetchAll(statement)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testCrashFetchSQLiteStatementConvertibleFromDatabase() {
|
||||
assertCrash("Found NULL") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let sequence = Int.fetch(db, "SELECT int FROM ints ORDER BY int")
|
||||
for _ in sequence { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testCrashFetchAllSQLiteStatementConvertibleFromDatabase() {
|
||||
assertCrash("Found NULL") {
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE ints (int Int)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (1)")
|
||||
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
|
||||
|
||||
let _ = Int.fetchAll(db, "SELECT int FROM ints ORDER BY int")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 472 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user