Chromium Code Reviews| Index: sql/connection.h |
| diff --git a/sql/connection.h b/sql/connection.h |
| index 8155a8fd72d1892b1fcc4cab27075ff2f6efb456..fe4e6d3a7cf7547a4ccf2018f87f00d314c860b2 100644 |
| --- a/sql/connection.h |
| +++ b/sql/connection.h |
| @@ -28,6 +28,7 @@ class FilePath; |
| namespace sql { |
| +class Recovery; |
| class Statement; |
| // Uniquely identifies a statement. There are two modes of operation: |
| @@ -160,6 +161,12 @@ class SQL_EXPORT Connection { |
| // empty. You can call this or Open. |
| bool OpenInMemory() WARN_UNUSED_RESULT; |
| + // Create a temporary on-disk database. The database will be |
| + // deleted after close. This kind of database is similar to |
| + // OpenInMemory() for small databases, but can page to disk if the |
| + // database becomes large. |
| + bool OpenTemporary() WARN_UNUSED_RESULT; |
| + |
| // Returns true if the database has been successfully opened. |
| bool is_open() const { return !!db_; } |
| @@ -218,13 +225,17 @@ class SQL_EXPORT Connection { |
| bool RazeWithTimout(base::TimeDelta timeout); |
| // Breaks all outstanding transactions (as initiated by |
| - // BeginTransaction()), calls Raze() to destroy the database, then |
| - // closes the database. After this is called, any operations |
| - // against the connections (or statements prepared by the |
| - // connection) should fail safely. |
| + // BeginTransaction()), closes the SQLite database, and poisons the |
| + // object so that all future operations against the Connection (or |
| + // its Statements) fail safely, without side effects. |
| // |
| - // The value from Raze() is returned, with Close() called in all |
| - // cases. |
| + // This is intended as an alternative to Close() in error callbacks. |
| + // Close() should still be called at some point. |
| + void Poison(); |
| + |
| + // Raze() the database and Poison() the handle. Returns the return |
| + // value from Raze(). |
| + // TODO(shess): Rename to RazeAndPoison(). |
| bool RazeAndClose(); |
| // Delete the underlying database files associated with |path|. |
| @@ -254,10 +265,27 @@ class SQL_EXPORT Connection { |
| void RollbackTransaction(); |
| bool CommitTransaction(); |
| + // Rollback all outstanding transactions. Use with care, there may |
| + // be scoped transactions on the stack. |
| + void RollbackAllTransactions(); |
| + |
| // Returns the current transaction nesting, which will be 0 if there are |
| // no open transactions. |
| int transaction_nesting() const { return transaction_nesting_; } |
| + // Attached databases--------------------------------------------------------- |
| + |
| + // SQLite supports attaching multiple database files to a single |
| + // handle. Attach the database in |other_db_path| to the current |
| + // handle under |attachment_point|. |attachment_point| should only |
| + // contain characters from [a-zA-Z0-9_]. |
| + // |
| + // Note that calling attach or detach with an open transaction is an |
| + // error. |
| + bool AttachDatabase(const base::FilePath& other_db_path, |
| + const char* attachment_point); |
| + bool DetachDatabase(const char* attachment_point); |
| + |
| // Statements ---------------------------------------------------------------- |
| // Executes the given SQL string, returning true on success. This is |
| @@ -350,6 +378,9 @@ class SQL_EXPORT Connection { |
| const char* GetErrorMessage() const; |
| private: |
| + // For recovery module. |
| + friend class Recovery; |
|
Scott Hess - ex-Googler
2013/07/15 21:10:34
Specifically for sqlite3_backup stuff. Given that
|
| + |
| // Allow test-support code to set/reset error ignorer. |
| friend class ScopedErrorIgnorer; |