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

Unified Diff: sql/connection.h

Issue 10736042: [sql] Refactor to remove use of const_cast<>. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Elaborate on GetUntrackedStatement() usage. Created 8 years, 5 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 | « no previous file | sql/connection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/connection.h
diff --git a/sql/connection.h b/sql/connection.h
index 1e3414f40ca72912b0b8e0b64af1fa37d5e78a1f..c51a28ca14596b5d3d36ea45bc7a555d5aa69436 100644
--- a/sql/connection.h
+++ b/sql/connection.h
@@ -339,6 +339,7 @@ class SQL_EXPORT Connection {
public:
// Default constructor initializes to an invalid statement.
StatementRef();
+ explicit StatementRef(sqlite3_stmt* stmt);
StatementRef(Connection* connection, sqlite3_stmt* stmt);
// When true, the statement can be used.
@@ -388,6 +389,14 @@ class SQL_EXPORT Connection {
bool ExecuteWithTimeout(const char* sql, base::TimeDelta ms_timeout)
WARN_UNUSED_RESULT;
+ // Internal helper for const functions. Like GetUniqueStatement(),
+ // except the statement is not entered into open_statements_,
+ // allowing this function to be const. Open statements can block
+ // closing the database, so only use in cases where the last ref is
+ // released before close could be called (which should always be the
+ // case for const functions).
+ scoped_refptr<StatementRef> GetUntrackedStatement(const char* sql) const;
+
// The actual sqlite database. Will be NULL before Init has been called or if
// Init resulted in an error.
sqlite3* db_;
« no previous file with comments | « no previous file | sql/connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698