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

Unified Diff: sql/connection.h

Issue 9768006: Implement sql::Connection::Raze() in terms of sqlite3_backup API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gbillock comments. Created 8 years, 9 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') | sql/connection.cc » ('J')
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 9b81804bc1fafb68bac8bfb9a63dff4c6887305c..1e3414f40ca72912b0b8e0b64af1fa37d5e78a1f 100644
--- a/sql/connection.h
+++ b/sql/connection.h
@@ -181,6 +181,26 @@ class SQL_EXPORT Connection {
// generally exist either.
void Preload();
+ // Raze the database to the ground. This approximates creating a
+ // fresh database from scratch, within the constraints of SQLite's
+ // locking protocol (locks and open handles can make doing this with
+ // filesystem operations problematic). Returns true if the database
+ // was razed.
+ //
+ // false is returned if the database is locked by some other
+ // process. RazeWithTimeout() may be used if appropriate.
+ //
+ // NOTE(shess): Raze() will DCHECK in the following situations:
+ // - database is not open.
+ // - the connection has a transaction open.
+ // - a SQLite issue occurs which is structural in nature (like the
+ // statements used are broken).
+ // Since Raze() is expected to be called in unexpected situations,
+ // these all return false, since it is unlikely that the caller
+ // could fix them.
+ bool Raze();
+ bool RazeWithTimout(base::TimeDelta timeout);
+
// Transactions --------------------------------------------------------------
// Transaction management. We maintain a virtual transaction stack to emulate
« no previous file with comments | « no previous file | sql/connection.cc » ('j') | sql/connection.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698