explore: Covert double-quoted SQL string literals to single-quoted.
Double-quoted string literals are non-standard SQL. Allowing
double-quoted string literals is now considered a misfeature by SQLite
authors. See https://www.sqlite.org/quirks.html#dblquote
This CL converts existing occurrences of double-quoted string literals,
in preparation for blocking them for Chrome features.
This CL also re-formats one of the modified queries, to match the (new)
guidelines in //sql/README.md.
Bug: 1230199
Change-Id: Ic8807effd4413a4847a911cd58bd6a184fb8ecb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3040745
Reviewed-by: Cathy Li <chili@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#903520}
diff --git a/chrome/browser/android/explore_sites/get_catalog_task_unittest.cc b/chrome/browser/android/explore_sites/get_catalog_task_unittest.cc
index 0e3f405b..9e7324e5 100644
--- a/chrome/browser/android/explore_sites/get_catalog_task_unittest.cc
+++ b/chrome/browser/android/explore_sites/get_catalog_task_unittest.cc
@@ -360,7 +360,7 @@
SetDownloadingAndCurrentVersion("1234", "");
ExecuteSync(base::BindLambdaForTesting([&](sql::Database* db) {
sql::Statement cat_count(db->GetUniqueStatement(
- "DELETE FROM categories where version_token <> \"1234\";"));
+ "DELETE FROM categories where version_token <> '1234'"));
return cat_count.Run();
}));
auto callback = base::BindLambdaForTesting(
diff --git a/chrome/browser/android/explore_sites/increment_shown_count_task_unittest.cc b/chrome/browser/android/explore_sites/increment_shown_count_task_unittest.cc
index dab3e6e..56ca932 100644
--- a/chrome/browser/android/explore_sites/increment_shown_count_task_unittest.cc
+++ b/chrome/browser/android/explore_sites/increment_shown_count_task_unittest.cc
@@ -59,13 +59,15 @@
void ExploreSitesIncrementShownCountTaskTest::PopulateCategories() {
ExecuteSync(base::BindLambdaForTesting([&](sql::Database* db) {
- sql::Statement insert_categories(db->GetUniqueStatement(R"(
-INSERT INTO categories
-(category_id, version_token, type, label, ntp_shown_count)
-VALUES
-(1, "1234", 1, "label_1", 5),
-(2, "1234", 2, "label_2", 2)
- )"));
+ static constexpr char kSql[] =
+ // clang-format off
+ "INSERT INTO categories"
+ "(category_id, version_token, type, label, ntp_shown_count)"
+ "VALUES "
+ "(1, '1234', 1, 'label_1', 5),"
+ "(2, '1234', 2, 'label_2', 2)";
+ // clang-format on
+ sql::Statement insert_categories(db->GetUniqueStatement(kSql));
return insert_categories.Run();
}));
}