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

Unified Diff: app/sql/connection.cc

Issue 201099: Convert the sqlite cookie database and web database to use the new sqlite... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 | « app/sql/connection.h ('k') | app/sql/statement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/sql/connection.cc
===================================================================
--- app/sql/connection.cc (revision 26110)
+++ app/sql/connection.cc (working copy)
@@ -224,8 +224,10 @@
return new StatementRef(this, stmt);
}
-bool Connection::DoesTableExist(const char* table_name) {
- Statement statement(GetUniqueStatement(
+bool Connection::DoesTableExist(const char* table_name) const {
+ // GetUniqueStatement can't be const since statements may modify the
+ // database, but we know ours doesn't modify it, so the cast is safe.
+ Statement statement(const_cast<Connection*>(this)->GetUniqueStatement(
"SELECT name FROM sqlite_master "
"WHERE type='table' AND name=?"));
if (!statement)
@@ -235,12 +237,14 @@
}
bool Connection::DoesColumnExist(const char* table_name,
- const char* column_name) {
+ const char* column_name) const {
std::string sql("PRAGMA TABLE_INFO(");
sql.append(table_name);
sql.append(")");
- Statement statement(GetUniqueStatement(sql.c_str()));
+ // Our SQL is non-mutating, so this cast is OK.
+ Statement statement(const_cast<Connection*>(this)->GetUniqueStatement(
+ sql.c_str()));
if (!statement)
return false;
@@ -259,6 +263,14 @@
return sqlite3_last_insert_rowid(db_);
}
+int Connection::GetLastChangeCount() const {
+ if (!db_) {
+ NOTREACHED();
+ return 0;
+ }
+ return sqlite3_changes(db_);
+}
+
int Connection::GetErrorCode() const {
if (!db_)
return SQLITE_ERROR;
« no previous file with comments | « app/sql/connection.h ('k') | app/sql/statement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698