Skip to content

Commit

Permalink
fixup! Qualify const char[] sql queries with |static|
Browse files Browse the repository at this point in the history
Bug: 855465
Change-Id: I1736e5d83494341e068e4aeffeea535d624f3dd4
Reviewed-on: https://chromium-review.googlesource.com/1168944
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Cathy Li <chili@chromium.org>
Commit-Queue: Xunran Ding <xunran.ding@samsung.com>
Cr-Commit-Position: refs/heads/master@{#582080}
  • Loading branch information
Xunran Ding authored and Commit Bot committed Aug 10, 2018
1 parent c0273bf commit 35b72bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ bool CreateLatestSchema(sql::Database* db) {
int MigrateFromVersion1To2(sql::Database* db, sql::MetaTable* meta_table) {
const int target_version = 2;
const int target_compatible_version = 1;
const char kVersion1ToVersion2MigrationSql[] =
static const char kVersion1ToVersion2MigrationSql[] =
// Rename the existing items table.
"ALTER TABLE prefetch_items RENAME TO prefetch_items_old; "
// Creates the new items table.
Expand Down
8 changes: 5 additions & 3 deletions sql/test/test_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
namespace {

size_t CountSQLItemsOfType(sql::Database* db, const char* type) {
const char kTypeSQL[] = "SELECT COUNT(*) FROM sqlite_master WHERE type = ?";
static const char kTypeSQL[] =
"SELECT COUNT(*) FROM sqlite_master WHERE type = ?";
sql::Statement s(db->GetUniqueStatement(kTypeSQL));
s.BindCString(0, type);
EXPECT_TRUE(s.Step());
Expand All @@ -38,7 +39,8 @@ bool GetPageSize(sql::Database* db, int* page_size) {

// Get |name|'s root page number in the database.
bool GetRootPage(sql::Database* db, const char* name, int* page_number) {
const char kPageSql[] = "SELECT rootpage FROM sqlite_master WHERE name = ?";
static const char kPageSql[] =
"SELECT rootpage FROM sqlite_master WHERE name = ?";
sql::Statement s(db->GetUniqueStatement(kPageSql));
s.BindString(0, name);
if (!s.Step())
Expand Down Expand Up @@ -210,7 +212,7 @@ size_t CountTableColumns(sql::Database* db, const char* table) {
// TODO(shess): sql::Database::QuoteForSQL() would make sense.
std::string quoted_table;
{
const char kQuoteSQL[] = "SELECT quote(?)";
static const char kQuoteSQL[] = "SELECT quote(?)";
sql::Statement s(db->GetUniqueStatement(kQuoteSQL));
s.BindCString(0, table);
EXPECT_TRUE(s.Step());
Expand Down

0 comments on commit 35b72bf

Please sign in to comment.