Commit 5ad7ee45 authored by Victor Costan's avatar Victor Costan Committed by Chromium LUCI CQ

sql: Clarify comment for MetaTable::SetCompatibleVersion().

The current comment is slightly misleading, causing extra code review
round-trips.

Change-Id: I899147eab2bc3afdb2717955ad0f2cc4d31524ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2582817
Auto-Submit: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarChris Mumford <cmumford@google.com>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836341}
parent 12003880
...@@ -76,16 +76,18 @@ class COMPONENT_EXPORT(SQL) MetaTable { ...@@ -76,16 +76,18 @@ class COMPONENT_EXPORT(SQL) MetaTable {
void SetVersionNumber(int version); void SetVersionNumber(int version);
int GetVersionNumber(); int GetVersionNumber();
// The compatible version number is the lowest version of the code that this // The compatible version number is the lowest current version embedded in
// database can be read by. If there are minor changes or additions, old // Chrome code that can still use this database. This is usually the same as
// versions of the code can still work with the database without failing. // the current version. In some limited cases, such as adding a column without
// a NOT NULL constraint, the SQL queries embedded in older code can still
// execute successfully.
// //
// For example, if an optional column is added to a table in version 3, the // For example, if an optional column is added to a table in version 3, the
// new code will set the version to 3, and the compatible version to 2, since // new code will set the version to 3, and the compatible version to 2, since
// the code expecting version 2 databases can still read and write the table. // the code expecting version 2 databases can still read and write the table.
// //
// Rule of thumb: check the version number when you're upgrading, but check // Rule of thumb: check the version number when you're upgrading, but check
// the compatible version number to see if you can read the file at all. If // the compatible version number to see if you can use the file at all. If
// it's larger than you code is expecting, fail. // it's larger than you code is expecting, fail.
// //
// The compatible version number will be 0 if there is no previously set // The compatible version number will be 0 if there is no previously set
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment