| Index: sql/connection.cc
|
| ===================================================================
|
| --- sql/connection.cc (revision 144332)
|
| +++ sql/connection.cc (working copy)
|
| @@ -75,6 +75,7 @@
|
| }
|
|
|
| void Connection::StatementRef::Close() {
|
| + AssertIOAllowed();
|
| if (stmt_) {
|
| sqlite3_finalize(stmt_);
|
| stmt_ = NULL;
|
| @@ -88,7 +89,8 @@
|
| cache_size_(0),
|
| exclusive_locking_(false),
|
| transaction_nesting_(0),
|
| - needs_rollback_(false) {
|
| + needs_rollback_(false),
|
| + in_memory_(false) {
|
| }
|
|
|
| Connection::~Connection() {
|
| @@ -104,10 +106,13 @@
|
| }
|
|
|
| bool Connection::OpenInMemory() {
|
| + in_memory_ = true;
|
| return OpenInternal(":memory:");
|
| }
|
|
|
| void Connection::Close() {
|
| + AssertIOAllowed();
|
| +
|
| // TODO(shess): Calling "PRAGMA journal_mode = DELETE" at this point
|
| // will delete the -journal file. For ChromiumOS or other more
|
| // embedded systems, this is probably not appropriate, whereas on
|
| @@ -132,6 +137,8 @@
|
| }
|
|
|
| void Connection::Preload() {
|
| + AssertIOAllowed();
|
| +
|
| if (!db_) {
|
| DLOG(FATAL) << "Cannot preload null db";
|
| return;
|
| @@ -156,6 +163,8 @@
|
| // Create an in-memory database with the existing database's page
|
| // size, then backup that database over the existing database.
|
| bool Connection::Raze() {
|
| + AssertIOAllowed();
|
| +
|
| if (!db_) {
|
| DLOG(FATAL) << "Cannot raze null db";
|
| return false;
|
| @@ -292,6 +301,7 @@
|
| }
|
|
|
| int Connection::ExecuteAndReturnErrorCode(const char* sql) {
|
| + AssertIOAllowed();
|
| if (!db_)
|
| return false;
|
| return sqlite3_exec(db_, sql, NULL, NULL, NULL);
|
| @@ -342,6 +352,8 @@
|
|
|
| scoped_refptr<Connection::StatementRef> Connection::GetUniqueStatement(
|
| const char* sql) {
|
| + AssertIOAllowed();
|
| +
|
| if (!db_)
|
| return new StatementRef(this, NULL); // Return inactive statement.
|
|
|
| @@ -355,6 +367,7 @@
|
| }
|
|
|
| bool Connection::IsSQLValid(const char* sql) {
|
| + AssertIOAllowed();
|
| sqlite3_stmt* stmt = NULL;
|
| if (sqlite3_prepare_v2(db_, sql, -1, &stmt, NULL) != SQLITE_OK)
|
| return false;
|
| @@ -441,6 +454,8 @@
|
| }
|
|
|
| bool Connection::OpenInternal(const std::string& file_name) {
|
| + AssertIOAllowed();
|
| +
|
| if (db_) {
|
| DLOG(FATAL) << "sql::Connection is already open.";
|
| return false;
|
|
|