Commit 57e9f5f5 authored by Justin DeWitt's avatar Justin DeWitt Committed by Commit Bot

Remove whitespace from the beginning of SQL strings

sql::connection DCHECKs that cached statements match that extracted
from the SQL statement object.  However SQLite strips whitespace from the
beginning and end of such strings.

Change-Id: I470515e53e20c2d3fd8a51cb3820232ff56104ba
Reviewed-on: https://chromium-review.googlesource.com/1240866
Commit-Queue: Justin DeWitt <dewittj@chromium.org>
Reviewed-by: default avatarDmitry Titov <dimich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593754}
parent 0f3d65a9
......@@ -13,24 +13,20 @@
namespace explore_sites {
namespace {
static const char kSelectCategorySql[] = R"(
SELECT category_id, type, label FROM categories
static const char kSelectCategorySql[] = R"(SELECT category_id, type, label
FROM categories
WHERE version = ?
ORDER BY category_id ASC;
)";
ORDER BY category_id ASC;)";
static const char kSelectSiteSql[] = R"(
SELECT site_id, url, title FROM sites
WHERE category_id = ?
)";
static const char kSelectSiteSql[] = R"(SELECT site_id, url, title
FROM sites
WHERE category_id = ?)";
const char kDeleteSiteSql[] = R"(
DELETE FROM sites WHERE category_id NOT IN
const char kDeleteSiteSql[] = R"(DELETE FROM sites
WHERE category_id NOT IN
(SELECT category_id FROM categories WHERE version = ?);)";
const char kDeleteCategorySql[] = R"(
DELETE FROM categories WHERE version <> ?;
)";
const char kDeleteCategorySql[] = "DELETE FROM categories WHERE version <> ?;";
} // namespace
......
......@@ -12,25 +12,25 @@
namespace explore_sites {
namespace {
static const char kDeleteExistingCategorySql[] =
"DELETE FROM categories WHERE version = ?";
static const char kInsertCategorySql[] = R"(
INSERT INTO categories
static const char kInsertCategorySql[] = R"(INSERT INTO categories
(version, type, label, image)
VALUES
(?, ?, ?, ?);)";
static const char kDeleteExistingSiteSql[] = R"(
DELETE FROM sites
static const char kDeleteExistingSiteSql[] = R"(DELETE FROM sites
WHERE (
SELECT COUNT(1) FROM categories
WHERE category_id = sites.category_id AND categories.version = ?) > 0
)";
static const char kInsertSiteSql[] = R"(
INSERT INTO sites
WHERE category_id = sites.category_id AND categories.version = ?) > 0)";
static const char kInsertSiteSql[] = R"(INSERT INTO sites
(url, category_id, title, favicon)
VALUES
(?, ?, ?, ?);)";
} // namespace
bool ImportCatalogSync(int64_t catalog_timestamp,
......
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