Index: sql/connection.cc |
=================================================================== |
--- sql/connection.cc (revision 142033) |
+++ sql/connection.cc (working copy) |
@@ -76,6 +76,7 @@ |
void Connection::StatementRef::Close() { |
if (stmt_) { |
+ AssertIOAllowed(); |
Scott Hess - ex-Googler
2012/06/26 16:39:47
In cases like this, I would prefer the assert move
|
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,6 +106,7 @@ |
} |
bool Connection::OpenInMemory() { |
+ in_memory_ = true; |
return OpenInternal(":memory:"); |
} |
@@ -125,6 +128,7 @@ |
ClearCache(); |
if (db_) { |
+ AssertIOAllowed(); |
// TODO(shess): Histogram for failure. |
sqlite3_close(db_); |
db_ = NULL; |
@@ -147,6 +151,7 @@ |
return; |
#if !defined(USE_SYSTEM_SQLITE) |
+ AssertIOAllowed(); |
// This function is only defined in Chromium's version of sqlite. |
// Do not call it when using system sqlite. |
sqlite3_preload(db_); |
@@ -191,6 +196,7 @@ |
if (!null_db.Execute("PRAGMA schema_version = 1")) |
return false; |
+ AssertIOAllowed(); |
sqlite3_backup* backup = sqlite3_backup_init(db_, "main", |
null_db.db_, "main"); |
if (!backup) { |
@@ -294,6 +300,7 @@ |
int Connection::ExecuteAndReturnErrorCode(const char* sql) { |
if (!db_) |
return false; |
+ AssertIOAllowed(); |
return sqlite3_exec(db_, sql, NULL, NULL, NULL); |
} |
@@ -345,6 +352,7 @@ |
if (!db_) |
return new StatementRef(this, NULL); // Return inactive statement. |
+ AssertIOAllowed(); |
sqlite3_stmt* stmt = NULL; |
if (sqlite3_prepare_v2(db_, sql, -1, &stmt, NULL) != SQLITE_OK) { |
// This is evidence of a syntax error in the incoming SQL. |
@@ -355,6 +363,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; |
@@ -446,6 +455,7 @@ |
return false; |
} |
+ AssertIOAllowed(); |
int err = sqlite3_open(file_name.c_str(), &db_); |
if (err != SQLITE_OK) { |
OnSqliteError(err, NULL); |