summaryrefslogtreecommitdiffstats
path: root/sql
diff options
context:
space:
mode:
authorshess <shess@chromium.org>2016-03-09 17:23:21 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-10 01:25:09 +0000
commit81bdd5bca887096575be7d13127095ed56b3d3c4 (patch)
tree106d173232c414474578e0d903a5ed35959c371e /sql
parente403d0d8cf1622909d15c3ae408c37acef7e1d19 (diff)
downloadchromium_src-81bdd5bca887096575be7d13127095ed56b3d3c4.zip
chromium_src-81bdd5bca887096575be7d13127095ed56b3d3c4.tar.gz
chromium_src-81bdd5bca887096575be7d13127095ed56b3d3c4.tar.bz2
[sqlite] sql::Recovery working under USE_SYSTEM_SQLITE.
Removes the USE_SYSTEM_SQLITE conditional sections in sql::Recover implementation and tests. third_party/sqlite includes sqlite_recover library for the USE_SYSTEM_SQLITE case, with recover.c compiled against the system version of SQLite. Additionally remove interiorCursorEOF() from recover.c, as it was unused, rather than adding a compile flag to allow it. [Relands https://codereview.chromium.org/1757653002/ ] BUG=584407 TBR=sdefresne@chromium.org Review URL: https://codereview.chromium.org/1782633002 Cr-Commit-Position: refs/heads/master@{#380287}
Diffstat (limited to 'sql')
-rw-r--r--sql/BUILD.gn2
-rw-r--r--sql/recovery.cc19
-rw-r--r--sql/recovery_unittest.cc4
-rw-r--r--sql/sql.gyp12
4 files changed, 15 insertions, 22 deletions
diff --git a/sql/BUILD.gn b/sql/BUILD.gn
index 4ffa421..8c1cbb7 100644
--- a/sql/BUILD.gn
+++ b/sql/BUILD.gn
@@ -113,6 +113,8 @@ test("sql_unittests") {
# '../testing/android/native_test.gyp:native_test_native_code',
# ],
#}],
+
+ # TODO(GYP): dep on copy_test_data_ios action.
}
if (is_android) {
diff --git a/sql/recovery.cc b/sql/recovery.cc
index b79fe08..7b9ca9f 100644
--- a/sql/recovery.cc
+++ b/sql/recovery.cc
@@ -98,11 +98,7 @@ void RecordRecoveryEvent(RecoveryEventType recovery_event) {
// static
bool Recovery::FullRecoverySupported() {
// TODO(shess): See comment in Init().
-#if defined(USE_SYSTEM_SQLITE)
- return false;
-#else
return true;
-#endif
}
// static
@@ -203,16 +199,7 @@ bool Recovery::Init(const base::FilePath& db_path) {
return false;
}
- // TODO(shess): Figure out a story for USE_SYSTEM_SQLITE. The
- // virtual table implementation relies on SQLite internals for some
- // types and functions, which could be copied inline to make it
- // standalone. Or an alternate implementation could try to read
- // through errors entirely at the SQLite level.
- //
- // For now, defer to the caller. The setup will succeed, but the
- // later CREATE VIRTUAL TABLE call will fail, at which point the
- // caller can fire Unrecoverable().
-#if !defined(USE_SYSTEM_SQLITE)
+ // Enable the recover virtual table for this connection.
int rc = recoverVtableInit(recover_db_.db_);
if (rc != SQLITE_OK) {
RecordRecoveryEvent(RECOVERY_FAILED_VIRTUAL_TABLE_INIT);
@@ -220,10 +207,6 @@ bool Recovery::Init(const base::FilePath& db_path) {
<< recover_db_.GetErrorMessage();
return false;
}
-#else
- // If this is infrequent enough, just wire it to Raze().
- RecordRecoveryEvent(RECOVERY_FAILED_VIRTUAL_TABLE_SYSTEM_SQLITE);
-#endif
// Turn on |SQLITE_RecoveryMode| for the handle, which allows
// reading certain broken databases.
diff --git a/sql/recovery_unittest.cc b/sql/recovery_unittest.cc
index e4fdb7b1..d3b04b1 100644
--- a/sql/recovery_unittest.cc
+++ b/sql/recovery_unittest.cc
@@ -172,9 +172,6 @@ TEST_F(SQLRecoveryTest, RecoverBasic) {
ExecuteWithResults(&db(), kXSql, "|", "\n"));
}
-// The recovery virtual table is only supported for Chromium's SQLite.
-#if !defined(USE_SYSTEM_SQLITE)
-
// Test operation of the virtual table used by sql::Recovery.
TEST_F(SQLRecoveryTest, VirtualTable) {
const char kCreateSql[] = "CREATE TABLE x (t TEXT)";
@@ -737,7 +734,6 @@ TEST_F(SQLRecoveryTest, Bug387868) {
EXPECT_TRUE(sql::Recovery::Recovered(std::move(recovery)));
}
}
-#endif // !defined(USE_SYSTEM_SQLITE)
// Memory-mapped I/O interacts poorly with I/O errors. Make sure the recovery
// database doesn't accidentally enable it.
diff --git a/sql/sql.gyp b/sql/sql.gyp
index 30bd76d..cde3057 100644
--- a/sql/sql.gyp
+++ b/sql/sql.gyp
@@ -114,6 +114,18 @@
'../testing/android/native_test.gyp:native_test_native_code',
],
}],
+ ['OS == "ios"', {
+ 'actions': [{
+ 'action_name': 'copy_test_data',
+ 'variables': {
+ 'test_data_files': [
+ 'test/data',
+ ],
+ 'test_data_prefix' : 'sql',
+ },
+ 'includes': [ '../build/copy_test_data_ios.gypi' ],
+ }],
+ }],
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],