summaryrefslogtreecommitdiffstats
path: root/sql/connection_unittest.cc
diff options
context:
space:
mode:
authorScott Hess <shess@chromium.org>2015-02-10 13:33:29 -0800
committerScott Hess <shess@chromium.org>2015-02-10 21:37:23 +0000
commitdcf12048055030a2b5858ceca5ce26294a82a6e4 (patch)
treec84f0e56702c610d82cf961829c6766d281dc98b /sql/connection_unittest.cc
parent22a8af1afb44b29cfcee081f492ac1f434b54201 (diff)
downloadchromium_src-dcf12048055030a2b5858ceca5ce26294a82a6e4.zip
chromium_src-dcf12048055030a2b5858ceca5ce26294a82a6e4.tar.gz
chromium_src-dcf12048055030a2b5858ceca5ce26294a82a6e4.tar.bz2
Import SQLite 3.8.7.4.
Ran through the import script in third_party/sqlite/README.Chromium, including the SQLite test suite. There are a few pager errors which are because of a change required for WebDatabase support (documented in README). SQLite changes are at http://www.sqlite.org/changes.html , Chromium previously used 3.7.6.3. All patches were applied and the results reviewed to make sure backported patches were safe to remove, and retained patches were still covering what was necessary. Keep fts4 disabled, and also the new fts3 virtual table and unicode61 tokenizer. Once enabled, these are very hard to disable, and there doesn't seem to be any pressure to enable them. Other SQLITE_* flags were reviewed for applicability, none looked essential. Fixes to Chromium: - In recovery.cc, pk_column now follows the documentation. - Short garbage files now see SQLITE_NOTADB rather than SQLITE_IOERR_SHORT_READ. - Adjust to allow clients to use ScopedErrorIgnore without adding dependencies. - More-specific SQLITE_CONSTRAINT_* errors aren't necessary. - Force recovery test to scan table rather than index. BUG=340757 TEST=*EVERYTHING* continues to work. R=michaeln@chromium.org Review URL: https://codereview.chromium.org/901033002 Cr-Commit-Position: refs/heads/master@{#315646}
Diffstat (limited to 'sql/connection_unittest.cc')
-rw-r--r--sql/connection_unittest.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/sql/connection_unittest.cc b/sql/connection_unittest.cc
index d79cba8..07c9fa7 100644
--- a/sql/connection_unittest.cc
+++ b/sql/connection_unittest.cc
@@ -237,7 +237,10 @@ TEST_F(SQLConnectionTest, ErrorCallback) {
sql::ScopedErrorCallback sec(
&db(), base::Bind(&sql::CaptureErrorCallback, &error));
EXPECT_FALSE(db().Execute("INSERT INTO foo (id) VALUES (12)"));
- EXPECT_EQ(SQLITE_CONSTRAINT, error);
+
+ // Later versions of SQLite throw SQLITE_CONSTRAINT_UNIQUE. The specific
+ // sub-error isn't really important.
+ EXPECT_EQ(SQLITE_CONSTRAINT, (error&0xff));
}
// Callback is no longer in force due to reset.
@@ -448,12 +451,20 @@ TEST_F(SQLConnectionTest, RazeNOTADB) {
}
ASSERT_TRUE(base::PathExists(db_path()));
- // SQLite will successfully open the handle, but will fail with
- // SQLITE_IOERR_SHORT_READ on pragma statemenets which read the
- // header.
+ // SQLite will successfully open the handle, but fail when running PRAGMA
+ // statements that access the database.
{
sql::ScopedErrorIgnorer ignore_errors;
- ignore_errors.IgnoreError(SQLITE_IOERR_SHORT_READ);
+
+ // Earlier versions of Chromium compiled against SQLite 3.6.7.3, which
+ // returned SQLITE_IOERR_SHORT_READ in this case. Some platforms may still
+ // compile against an earlier SQLite via USE_SYSTEM_SQLITE.
+ if (ignore_errors.SQLiteLibVersionNumber() < 3008007) {
+ ignore_errors.IgnoreError(SQLITE_IOERR_SHORT_READ);
+ } else {
+ ignore_errors.IgnoreError(SQLITE_NOTADB);
+ }
+
EXPECT_TRUE(db().Open(db_path()));
ASSERT_TRUE(ignore_errors.CheckIgnoredErrors());
}