Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1737)

Unified Diff: storage/browser/database/databases_table.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « storage/browser/database/databases_table.h ('k') | storage/browser/database/vfs_backend.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/database/databases_table.cc
diff --git a/webkit/browser/database/databases_table.cc b/storage/browser/database/databases_table.cc
similarity index 78%
rename from webkit/browser/database/databases_table.cc
rename to storage/browser/database/databases_table.cc
index 747de1f5b11fa847f2356e569c30f373e5608323..838b0f1daca8ce18ab978ec31b19c5694291d238 100644
--- a/webkit/browser/database/databases_table.cc
+++ b/storage/browser/database/databases_table.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/browser/database/databases_table.h"
+#include "storage/browser/database/databases_table.h"
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
@@ -10,9 +10,11 @@
namespace webkit_database {
-DatabaseDetails::DatabaseDetails() : estimated_size(0) { }
+DatabaseDetails::DatabaseDetails() : estimated_size(0) {
+}
-DatabaseDetails::~DatabaseDetails() {}
+DatabaseDetails::~DatabaseDetails() {
+}
bool DatabasesTable::Init() {
// 'Databases' schema:
@@ -24,17 +26,16 @@ bool DatabasesTable::Init() {
// description A short description of the database.
// estimated_size The estimated size of the database.
return db_->DoesTableExist("Databases") ||
- (db_->Execute(
- "CREATE TABLE Databases ("
- "id INTEGER PRIMARY KEY AUTOINCREMENT, "
- "origin TEXT NOT NULL, "
- "name TEXT NOT NULL, "
- "description TEXT NOT NULL, "
- "estimated_size INTEGER NOT NULL)") &&
- db_->Execute(
- "CREATE INDEX origin_index ON Databases (origin)") &&
- db_->Execute(
- "CREATE UNIQUE INDEX unique_index ON Databases (origin, name)"));
+ (db_->Execute(
+ "CREATE TABLE Databases ("
+ "id INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "origin TEXT NOT NULL, "
+ "name TEXT NOT NULL, "
+ "description TEXT NOT NULL, "
+ "estimated_size INTEGER NOT NULL)") &&
+ db_->Execute("CREATE INDEX origin_index ON Databases (origin)") &&
+ db_->Execute(
+ "CREATE UNIQUE INDEX unique_index ON Databases (origin, name)"));
}
int64 DatabasesTable::GetDatabaseID(const std::string& origin_identifier,
@@ -56,8 +57,9 @@ bool DatabasesTable::GetDatabaseDetails(const std::string& origin_identifier,
DatabaseDetails* details) {
DCHECK(details);
sql::Statement select_statement(db_->GetCachedStatement(
- SQL_FROM_HERE, "SELECT description, estimated_size FROM Databases "
- "WHERE origin = ? AND name = ?"));
+ SQL_FROM_HERE,
+ "SELECT description, estimated_size FROM Databases "
+ "WHERE origin = ? AND name = ?"));
select_statement.BindString(0, origin_identifier);
select_statement.BindString16(1, database_name);
@@ -74,8 +76,9 @@ bool DatabasesTable::GetDatabaseDetails(const std::string& origin_identifier,
bool DatabasesTable::InsertDatabaseDetails(const DatabaseDetails& details) {
sql::Statement insert_statement(db_->GetCachedStatement(
- SQL_FROM_HERE, "INSERT INTO Databases (origin, name, description, "
- "estimated_size) VALUES (?, ?, ?, ?)"));
+ SQL_FROM_HERE,
+ "INSERT INTO Databases (origin, name, description, "
+ "estimated_size) VALUES (?, ?, ?, ?)"));
insert_statement.BindString(0, details.origin_identifier);
insert_statement.BindString16(1, details.database_name);
insert_statement.BindString16(2, details.description);
@@ -86,8 +89,9 @@ bool DatabasesTable::InsertDatabaseDetails(const DatabaseDetails& details) {
bool DatabasesTable::UpdateDatabaseDetails(const DatabaseDetails& details) {
sql::Statement update_statement(db_->GetCachedStatement(
- SQL_FROM_HERE, "UPDATE Databases SET description = ?, "
- "estimated_size = ? WHERE origin = ? AND name = ?"));
+ SQL_FROM_HERE,
+ "UPDATE Databases SET description = ?, "
+ "estimated_size = ? WHERE origin = ? AND name = ?"));
update_statement.BindString16(0, details.description);
update_statement.BindInt64(1, details.estimated_size);
update_statement.BindString(2, details.origin_identifier);
@@ -121,9 +125,10 @@ bool DatabasesTable::GetAllOriginIdentifiers(
bool DatabasesTable::GetAllDatabaseDetailsForOriginIdentifier(
const std::string& origin_identifier,
std::vector<DatabaseDetails>* details_vector) {
- sql::Statement statement(db_->GetCachedStatement(
- SQL_FROM_HERE, "SELECT name, description, estimated_size "
- "FROM Databases WHERE origin = ? ORDER BY name"));
+ sql::Statement statement(
+ db_->GetCachedStatement(SQL_FROM_HERE,
+ "SELECT name, description, estimated_size "
+ "FROM Databases WHERE origin = ? ORDER BY name"));
statement.BindString(0, origin_identifier);
while (statement.Step()) {
« no previous file with comments | « storage/browser/database/databases_table.h ('k') | storage/browser/database/vfs_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698