From 0688305f86b6b382f7f1f4cc785fa1a85e1137ac Mon Sep 17 00:00:00 2001 From: kluufger Date: Sun, 22 Apr 2018 14:44:32 +0000 Subject: [PATCH 01/15] fix small typo in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 850cbbcda..0ac6779c1 100644 --- a/README.md +++ b/README.md @@ -2062,7 +2062,7 @@ protocol RowConvertible { } ``` -**To use RowConvertible**, subclass the [Record](#record-class) class, or adopt it explicitely. For example: +**To use RowConvertible**, subclass the [Record](#record-class) class, or adopt it explicitly. For example: ```swift struct Place { From 05269946033fa3f0582cb26df4f0564eca8bb0fa Mon Sep 17 00:00:00 2001 From: kluufger Date: Sun, 22 Apr 2018 14:55:51 +0000 Subject: [PATCH 02/15] one more --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0ac6779c1..c2fc466f9 100644 --- a/README.md +++ b/README.md @@ -2212,7 +2212,7 @@ The `encode(to:)` method defines which [values](#values) (Bool, Int, String, Dat The optional `didInsert` method lets the adopting type store its rowID after successful insertion. If your table has an INTEGER PRIMARY KEY column, you are likely to define this method. Otherwise, you can safely ignore it. It is called from a protected dispatch queue, and serialized with all database updates. -**To use those protocols**, subclass the [Record](#record-class) class, or adopt one of them explicitely. For example: +**To use those protocols**, subclass the [Record](#record-class) class, or adopt one of them explicitly. For example: ```swift extension Place : MutablePersistable { From 8fd321f823cdce6d54740ad26e2149c278dc75e8 Mon Sep 17 00:00:00 2001 From: kluufger Date: Sun, 22 Apr 2018 15:12:46 +0000 Subject: [PATCH 03/15] add .unique() to email column --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c2fc466f9..56a5c434e 100644 --- a/README.md +++ b/README.md @@ -2600,7 +2600,7 @@ The [five different policies](https://www.sqlite.org/lang_conflict.html) are: ab // ) try db.create(table: "players") { t in t.column("id", .integer).primaryKey() - t.column("email", .text) + t.column("email", .text).unique() } // Again, despite the unique index on email, both inserts succeed. From ee7b8f74d7e50270fcc91015e423c0e3c676cfac Mon Sep 17 00:00:00 2001 From: kluufger Date: Sun, 22 Apr 2018 15:35:50 +0000 Subject: [PATCH 04/15] update db.create(table: "example") --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 56a5c434e..1639bbe0c 100644 --- a/README.md +++ b/README.md @@ -2969,10 +2969,11 @@ try db.create(table: "example", temporary: true, ifNotExists: true) { t in // a, // name TEXT, // creationDate DATETIME, -try db.create(table: "example") { t in ... } +try db.create(table: "example") { t in t.column("a") t.column("name", .text) t.column("creationDate", .datetime) + ... ``` Define **not null** columns, and set **default** values: From 4993198266594dd246a79894439cc02c696d1dea Mon Sep 17 00:00:00 2001 From: kluufger Date: Sun, 22 Apr 2018 15:38:05 +0000 Subject: [PATCH 05/15] no need for the ellipses --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 1639bbe0c..fca33bead 100644 --- a/README.md +++ b/README.md @@ -2973,7 +2973,6 @@ try db.create(table: "example") { t in t.column("a") t.column("name", .text) t.column("creationDate", .datetime) - ... ``` Define **not null** columns, and set **default** values: From 85849a889fac6a03f5e17cf0a76cadcff3a05ce4 Mon Sep 17 00:00:00 2001 From: kluufger Date: Sun, 22 Apr 2018 15:42:04 +0000 Subject: [PATCH 06/15] parent -> parents not sure about this one, where do `(c, d)` come from? --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fca33bead..d36590aec 100644 --- a/README.md +++ b/README.md @@ -3025,7 +3025,7 @@ Other **table constraints** can involve several columns: t.uniqueKey(["a", "b"], onConfict: .replace) // FOREIGN KEY (a, b) REFERENCES parents(c, d), - t.foreignKey(["a", "b"], references: "parent") + t.foreignKey(["a", "b"], references: "parents") // CHECK (a + b < 10), t.check(Column("a") + Column("b") < 10) From 3c290ed6e20f293d2fd20b38b90d84418b8a46d1 Mon Sep 17 00:00:00 2001 From: kluufger Date: Sun, 22 Apr 2018 15:59:17 +0000 Subject: [PATCH 07/15] case-unsensitive -> case-insensitive --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d36590aec..a8adaa149 100644 --- a/README.md +++ b/README.md @@ -3380,7 +3380,7 @@ Feed [requests](#requests) with SQL expressions built from your Swift code: Player.filter(emailColumn.like("%@example.com")) ``` - > :point_up: **Note**: the SQLite LIKE operator is case-unsensitive but not Unicode-aware. For example, the expression `'a' LIKE 'A'` is true but `'æ' LIKE 'Æ'` is false. + > :point_up: **Note**: the SQLite LIKE operator is case-insensitive but not Unicode-aware. For example, the expression `'a' LIKE 'A'` is true but `'æ' LIKE 'Æ'` is false. - `MATCH` From 70e6454c381ad6e49a660d13ede36e1e8cbb8033 Mon Sep 17 00:00:00 2001 From: kluufger Date: Sun, 22 Apr 2018 19:49:06 +0000 Subject: [PATCH 08/15] fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a8adaa149..363470a4f 100644 --- a/README.md +++ b/README.md @@ -4974,7 +4974,7 @@ func startMonitoring(_ db: Database, region: CLRegion) throws { } ``` -The method above won't trigger the location manager if the transaction is eventually rollbacked (explicitely, or because of an error), as in the sample code below: +The method above won't trigger the location manager if the transaction is eventually rollbacked (explicitly, or because of an error), as in the sample code below: ```swift try dbQueue.inTransaction { db in From 3aa57196009f1275a8cec22fd8e9c4e6d7ebbd17 Mon Sep 17 00:00:00 2001 From: kluufger Date: Sun, 22 Apr 2018 21:01:12 +0000 Subject: [PATCH 09/15] identity -> identify --- Documentation/WhyAdoptGRDB.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/WhyAdoptGRDB.md b/Documentation/WhyAdoptGRDB.md index 75d3257e5..14b93c189 100644 --- a/Documentation/WhyAdoptGRDB.md +++ b/Documentation/WhyAdoptGRDB.md @@ -143,7 +143,7 @@ Database queues look a lot like FMDB's [FMDatabaseQueue](https://github.com/ccgu ### Strong and clear multi-threading guarantees -I'd like to compare GRDB's handling of concurrency with other libraries. To be as clear as possible, we'll identity a few threats, or potential sources of bugs, and wonder if those are handled by the library, or left to the host application. +I'd like to compare GRDB's handling of concurrency with other libraries. To be as clear as possible, we'll identify a few threats, or potential sources of bugs, and wonder if those are handled by the library, or left to the host application. The more threats are handled by the application, the more skilled and careful a developer has to be in order to avoid them. From 6f03d513905edaa52914242db18ba82bfc90e49a Mon Sep 17 00:00:00 2001 From: kluufger Date: Mon, 23 Apr 2018 07:18:32 +0000 Subject: [PATCH 10/15] fix link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 363470a4f..16a2f5b0b 100644 --- a/README.md +++ b/README.md @@ -5268,7 +5268,7 @@ See also [RxGRDB](http://github.com/RxSwiftCommunity/RxGRDB), an [RxSwift](https - [The Changes Notifications](#the-changes-notifications) - [Modifying the Fetch Request](#modifying-the-fetch-request) - [Table and Collection Views](#table-and-collection-views) - - [Implementing the Table View Datasource Methods](#implementing-the-table-view-datasource methods) + - [Implementing the Table View Datasource Methods](#implementing-the-table-view-datasource-methods) - [Implementing Table View Updates](#implementing-table-view-updates) - [FetchedRecordsController Concurrency](#fetchedrecordscontroller-concurrency) From 7ffc2faa9a1e17d54114f95aea532c7a33ed70ee Mon Sep 17 00:00:00 2001 From: kluufger Date: Mon, 23 Apr 2018 11:00:23 +0000 Subject: [PATCH 11/15] uppercase -> uppercased since later it's called as uppercased --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 16a2f5b0b..d1ca9ca6e 100644 --- a/README.md +++ b/README.md @@ -5969,7 +5969,7 @@ GRDB extends SQLite with [SQL functions](#custom-sql-functions-and-aggregates) t ```swift // "JÉRÔME" -let uppercase = DatabaseFunction.uppercase +let uppercased = DatabaseFunction.uppercase try String.fetchOne(db, "SELECT \(uppercased.name)('Jérôme')") ``` From eae2c38e23d632200da292ec6f0936773a359bbf Mon Sep 17 00:00:00 2001 From: kluufger Date: Mon, 23 Apr 2018 11:06:17 +0000 Subject: [PATCH 12/15] sharedApplication() -> shared --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d1ca9ca6e..a4b32d6be 100644 --- a/README.md +++ b/README.md @@ -6054,7 +6054,7 @@ This method blocks the current thread until all current database accesses are co ``` let dbQueue = try DatabaseQueue(...) -dbQueue.setupMemoryManagement(in: UIApplication.sharedApplication()) +dbQueue.setupMemoryManagement(in: UIApplication.shared) ``` From 4804f78042bd2eed7e245a7b1ed8924294a05fe2 Mon Sep 17 00:00:00 2001 From: kluufger Date: Mon, 23 Apr 2018 11:20:47 +0000 Subject: [PATCH 13/15] datase -> database --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a4b32d6be..b38b6147a 100644 --- a/README.md +++ b/README.md @@ -6406,7 +6406,7 @@ DatabaseWriter and DatabaseReader fuel, for example: } ``` - When used on a datase queue, the closure argument is allowed to write in the database. + When used on a database queue, the closure argument is allowed to write in the database. - **`unsafeReentrantRead`** From 16513dc387f7e4beab32702c7b7499abbdb416b6 Mon Sep 17 00:00:00 2001 From: kluufger Date: Mon, 23 Apr 2018 11:51:16 +0000 Subject: [PATCH 14/15] as -> at --- Documentation/WhyAdoptGRDB.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/WhyAdoptGRDB.md b/Documentation/WhyAdoptGRDB.md index 14b93c189..5521063f4 100644 --- a/Documentation/WhyAdoptGRDB.md +++ b/Documentation/WhyAdoptGRDB.md @@ -147,7 +147,7 @@ I'd like to compare GRDB's handling of concurrency with other libraries. To be a The more threats are handled by the application, the more skilled and careful a developer has to be in order to avoid them. -- **Concurrent writes**: Two threads want to write in the database as the same time. SQLite does not allow that. +- **Concurrent writes**: Two threads want to write in the database at the same time. SQLite does not allow that. - **Isolation troubles**: As two database queries run one after the other, a concurrent thread sneaks in and modifies the database in between. The two queries can thus perform inconsistent fetches or updates, unless they are properly isolated. Lack of isolation may display funny values on the screen, trigger a relational constraint error, or silently corrupt the database content. - **Conflicts**: The same piece of data is both edited by the application user, and refreshed from a network operation. What will eventually be stored in the database? Can any conflict be noticed? - **Blocked UI**: Can it happen that the UI is blocked because the main thread has to wait for a background thread to release a lock on the database? From f1baa0503fcff99114b76e91d18a5d7e3acdd317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Rou=C3=A9?= Date: Mon, 23 Apr 2018 14:46:12 +0200 Subject: [PATCH 15/15] #339 follow-up: extend the thank you notice :-) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b38b6147a..946e82a32 100644 --- a/README.md +++ b/README.md @@ -6863,6 +6863,6 @@ Sample Code **Thanks** - [Pierlis](http://pierlis.com), where we write great software. -- [Vladimir Babin](https://github.com/Chiliec), [Darren Clark](https://github.com/darrenclark), [Pascal Edmond](https://github.com/pakko972), [Andrey Fidrya](https://github.com/zmeyc), [Cristian Filipov](https://github.com/cfilipov), [David Hart](https://github.com/hartbit), [Brad Lindsay](https://github.com/bfad), [@peter-ss](https://github.com/peter-ss), [Pierre-Loïc Raynaud](https://github.com/pierlo), [Stefano Rodriguez](https://github.com/sroddy) [Steven Schveighoffer](https://github.com/schveiguy), [@swiftlyfalling](https://github.com/swiftlyfalling), and [Kevin Wooten](https://github.com/kdubb) for their contributions, help, and feedback on GRDB. +- [Vladimir Babin](https://github.com/Chiliec), [Darren Clark](https://github.com/darrenclark), [Pascal Edmond](https://github.com/pakko972), [Andrey Fidrya](https://github.com/zmeyc), [Cristian Filipov](https://github.com/cfilipov), [David Hart](https://github.com/hartbit), [@kluufger](https://github.com/kluufger), [Brad Lindsay](https://github.com/bfad), [@peter-ss](https://github.com/peter-ss), [Pierre-Loïc Raynaud](https://github.com/pierlo), [Stefano Rodriguez](https://github.com/sroddy) [Steven Schveighoffer](https://github.com/schveiguy), [@swiftlyfalling](https://github.com/swiftlyfalling), and [Kevin Wooten](https://github.com/kdubb) for their contributions, help, and feedback on GRDB. - [@aymerick](https://github.com/aymerick) and [Mathieu "Kali" Poumeyrol](https://github.com/kali) because SQL. - [ccgus/fmdb](https://github.com/ccgus/fmdb) for its excellency.