diff --git a/Documentation/WhyAdoptGRDB.md b/Documentation/WhyAdoptGRDB.md
index db582af51..8aef278a5 100644
--- a/Documentation/WhyAdoptGRDB.md
+++ b/Documentation/WhyAdoptGRDB.md
@@ -37,7 +37,7 @@ GRDB puts all bets on SQLite, and focuses on front-end GUI applications.
This means that dealing with servers, MySQL, or PostgreSQL is out of scope. GRDB is not an alternative to IBM's [Swift-Kuery], Vapor's [Fluent], or Perfect's [StORM].
-Focusing on SQLite and applications has allowed GRDB to build features usually only found in company-sponsored libraries: migrations, changes tracking, database observation, multi-threading safety, table view animations, support for reactive streams...
+Focusing on SQLite and applications has allowed GRDB to build features usually only found in company-sponsored libraries: migrations, record comparison, database observation, multi-threading safety, table view animations, support for reactive streams...
Some will call GRDB "opinionated", or "bloated". Well, the bet of GRDB is that developers can take great profit from a library that provides efficient and community-tested solutions to existing problems. For example, one can not address the multithreading difficulties of Core Data or Realm without looking at database concurrency and records straight in the face.
diff --git a/GRDB/Record/PersistableRecord.swift b/GRDB/Record/PersistableRecord.swift
index f3bcdfd6d..067d65a14 100644
--- a/GRDB/Record/PersistableRecord.swift
+++ b/GRDB/Record/PersistableRecord.swift
@@ -437,7 +437,7 @@ extension MutablePersistableRecord {
return try performExists(db)
}
- // MARK: - Changes Tracking
+ // MARK: - Record Comparison
/// Returns a boolean indicating whether this record and the other record
/// have the same database representation.
diff --git a/GRDB/Record/Record.swift b/GRDB/Record/Record.swift
index 317fbb316..ddad9f547 100644
--- a/GRDB/Record/Record.swift
+++ b/GRDB/Record/Record.swift
@@ -163,7 +163,7 @@ open class Record : FetchableRecord, TableRecord, PersistableRecord {
}
- // MARK: - Changes Tracking
+ // MARK: - Compare with Previous Versions
/// A boolean that indicates whether the record has changes that have not
/// been saved.
diff --git a/Playgrounds/JSONSynchronization.playground/Contents.swift b/Playgrounds/JSONSynchronization.playground/Contents.swift
index fb3b7eef2..039c1ad3a 100644
--- a/Playgrounds/JSONSynchronization.playground/Contents.swift
+++ b/Playgrounds/JSONSynchronization.playground/Contents.swift
@@ -31,7 +31,7 @@ try dbQueue.inDatabase { db in
// Define the Player subclass of GRDB's Record.
//
-// Record provides change tracking that helps avoiding useless UPDATE statements.
+// Record can compare against itself, and that helps avoiding useless UPDATE statements.
class Player : Record {
var id: Int64
var name: String
diff --git a/README.md b/README.md
index 63870ab66..f8cb505e9 100644
--- a/README.md
+++ b/README.md
@@ -1842,7 +1842,7 @@ try dbQueue.inDatabase { db in
Of course, you need to open a [database connection](#database-connections), and [create a database table](#database-schema) first.
-Your custom structs and classes can adopt each protocol individually, and opt in to focused sets of features. Or you can subclass the `Record` class, and get the full toolkit in one go: fetching methods, persistence methods, and changes tracking. See the [list of record methods](#list-of-record-methods) for an overview.
+Your custom structs and classes can adopt each protocol individually, and opt in to focused sets of features. Or you can subclass the `Record` class, and get the full toolkit in one go: fetching methods, persistence methods, and record comparison. See the [list of record methods](#list-of-record-methods) for an overview.
> :point_up: **Note**: if you are familiar with Core Data's NSManagedObject or Realm's Object, you may experience a cultural shock: GRDB records are not uniqued, and do not auto-update. This is both a purpose, and a consequence of protocol-oriented programming. You should read [How to build an iOS application with SQLite and GRDB.swift](https://medium.com/@gwendal.roue/how-to-build-an-ios-application-with-sqlite-and-grdb-swift-d023a06c29b3) for a general introduction.
@@ -1864,7 +1864,7 @@ Your custom structs and classes can adopt each protocol individually, and opt in
- [Customizing the Persistence Methods](#customizing-the-persistence-methods)
- [Codable Records](#codable-records)
- [Record Class](#record-class)
-- [Changes Tracking](#changes-tracking)
+- [Record Comparison]
- [Conflict Resolution](#conflict-resolution)
- [The Implicit RowID Primary Key](#the-implicit-rowid-primary-key)
- [List of Record Methods](#list-of-record-methods)
@@ -1914,7 +1914,7 @@ player.name = "Arthur"
try player.update(db)
```
-Records can [track their changes](#changes-tracking), so that you can avoid useless updates:
+Records can [avoid useless updates](#record-comparison):
```swift
let player = try Player.fetchOne(db, key: 1)!
@@ -1972,7 +1972,7 @@ Details follow:
- [PersistableRecord Protocol](#persistablerecord-protocol)
- [Codable Records](#codable-records)
- [Record Class](#record-class)
-- [Changes Tracking](#changes-tracking)
+- [Record Comparison]
- [Conflict Resolution](#conflict-resolution)
- [The Implicit RowID Primary Key](#the-implicit-rowid-primary-key)
- [List of Record Methods](#list-of-record-methods)
@@ -2479,7 +2479,7 @@ place.id // A unique id
## Record Class
-**Record** is a class that is designed to be subclassed. It inherits its features from the [FetchableRecord, TableRecord, and PersistableRecord](#record-protocols-overview) protocols. On top of that, Record instances can [track their changes](#changes-tracking).
+**Record** is a class that is designed to be subclassed. It inherits its features from the [FetchableRecord, TableRecord, and PersistableRecord](#record-protocols-overview) protocols. On top of that, Record instances can compare against previous versions of themselves in order to [avoid useless updates](#record-comparison).
Record subclasses define their custom database relationship by overriding database methods:
@@ -2520,11 +2520,11 @@ class Place : Record {
```
-## Changes Tracking
+## Record Comparison
-**Changes tracking is the ability, for a record, to compare against another record, or against previous versions of itself.**
+**Records can compare against other records, or against previous versions of themselves.**
-The `update()` [method](#persistence-methods) always executes an UPDATE statement. When the record has not been edited, this costly database access is generally useless.
+This helps avoiding costly UPDATE statements when a record has not been edited.
You can use instead the `updateChanges` method, available on the [PersistableRecord] protocol, which performs an update of the changed columns only (and does nothing if record has no change):
@@ -2813,8 +2813,8 @@ This is the list of record methods, along with their required protocols. The [Re
| `record.save(db)` | [PersistableRecord] | |
| `record.update(db)` | [PersistableRecord] | |
| `record.update(db, columns:...)` | [PersistableRecord] | |
-| `record.updateChanges(db, from:...)` | [PersistableRecord] | [*](#changes-tracking) |
-| `record.updateChanges(db)` | [Record](#record-class) | [*](#changes-tracking) |
+| `record.updateChanges(db, from:...)` | [PersistableRecord] | [*](#record-comparison) |
+| `record.updateChanges(db)` | [Record](#record-class) | [*](#record-comparison) |
| **Delete Records** | | |
| `record.delete(db)` | [PersistableRecord] | |
| `Type.deleteOne(db, key:...)` | [PersistableRecord] | ¹ |
@@ -2846,7 +2846,7 @@ This is the list of record methods, along with their required protocols. The [Re
| `Type.fetchOne(db, sql)` | [FetchableRecord] | ³ |
| `Type.fetchOne(statement)` | [FetchableRecord] | ⁴ |
| `Type.filter(...).fetchOne(db)` | [FetchableRecord] & [TableRecord] | ² |
-| **[Changes Tracking](#changes-tracking)** | | |
+| **[Record Comparison]** | | |
| `record.databaseEqual(...)` | [PersistableRecord] | |
| `record.databaseChanges(from:...)` | [PersistableRecord] | |
| `record.updateChanges(db, from:...)` | [PersistableRecord] | |
@@ -6631,7 +6631,7 @@ if player.hasDatabaseChanges {
}
```
-See [changes tracking](#changes-tracking) for more information.
+See [Record Comparison] for more information.
### Performance tip: learn about SQL strengths and weaknesses
@@ -6916,6 +6916,10 @@ Sample Code
Legacy
======
+#### Changes Tracking
+
+This chapter has been renamed [Record Comparison].
+
#### Persistable Protocol
This protocol has been renamed [PersistableRecord] in GRDB 3.0.
@@ -6930,4 +6934,5 @@ This protocol has been renamed [TableRecord] in GRDB 3.0.
[FetchableRecord]: #fetchablerecord-protocol
[PersistableRecord]: #persistablerecord-protocol
+[Record Comparison]: #record-comparison
[TableRecord]: #tablerecord-protocol
diff --git a/TODO.md b/TODO.md
index 4f3fb051e..8283d1390 100644
--- a/TODO.md
+++ b/TODO.md
@@ -19,7 +19,7 @@ Xcode 9.3, Swift 4.1
GRDB 3.0
-- [ ] Rename "changes tracking" (ambiguous with database observation) to "record comparison"
+- [X] Rename "changes tracking" (ambiguous with database observation) to "record comparison"
- [ ] Refactor SQL generation and rowId extraction from expression on the visitor pattern. Provide more documentation for literal expressions which become the only way to extend GRDB. Remove QueryInterfaceExtensibilityTests.swift
- [ ] Make DatabasePool.write safe. See https://github.com/groue/GRDB.swift/commit/5e3c7d9c430df606a1cccfd4983be6b50e778a5c#commitcomment-26988970
- [ ] Do one of those two:
diff --git a/Tests/generatePerformanceReport.rb b/Tests/generatePerformanceReport.rb
index 7757a0a38..ac5bc49eb 100755
--- a/Tests/generatePerformanceReport.rb
+++ b/Tests/generatePerformanceReport.rb
@@ -48,7 +48,7 @@ All tests use the default settings of each library. For each library, we:
- Build and consume database rows with raw SQL and column indexes (aiming at the best performance)
- Build and consume database rows with column names (sacrificing performance for maintainability)
- Build and consume records values to and from database rows (aiming at the shortest code from database to records)
-- Build and consume records values to and from database rows, with [change tracking](https://github.com/groue/GRDB.swift/blob/master/README.md#changes-tracking) (records know if they have unsaved changes)
+- Build and consume records values to and from database rows, with [change tracking](https://github.com/groue/GRDB.swift/blob/master/README.md#record-comparison) (records know if they have unsaved changes)
As a bottom line, the raw SQLite C API is used as efficiently as possible, without any error checking.