Skip to content

Commit

Permalink
[Core] Don't use WITHOUT ROWID tables with older sqlite3.
Browse files Browse the repository at this point in the history
 - This feature was only added in SQLite3 3.8.2.
  • Loading branch information
ddunbar committed Mar 25, 2016
1 parent 4187649 commit 368256d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/Core/SQLiteBuildDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,21 @@ class SQLiteBuildDB : public BuildDB {
if (result == SQLITE_OK) {
// Create the table used for storing rule dependencies.
//
// In order to reduce duplication, we use a WITHOUT ROWID table with a
// composite key on the rule_id and the dependency key. This allows us
// to use the table itself to perform efficient queries for all of the
// keys associated with a particular rule_id, and by doing so avoid
// having an ancillary index with duplicate data.
// In order to reduce duplication, we use a WITHOUT ROWID (if available)
// table with a composite key on the rule_id and the dependency
// key. This allows us to use the table itself to perform efficient
// queries for all of the keys associated with a particular rule_id, and
// by doing so avoid having an ancillary index with duplicate data.
result = sqlite3_exec(
db, ("CREATE TABLE rule_dependencies ("
"rule_id INTEGER, "
"key STRING, "
"PRIMARY KEY (rule_id, key) "
"FOREIGN KEY(rule_id) REFERENCES rule_info(id)) "
"WITHOUT ROWID;"),
#if SQLITE_VERSION_NUMBER >= 3008002
"WITHOUT ROWID"
#endif
";"),
nullptr, nullptr, &cError);
}

Expand Down

0 comments on commit 368256d

Please sign in to comment.