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

Unified Diff: sql/statement.cc

Issue 12096073: Implement sql::Connection::RazeAndClose(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
« sql/connection.cc ('K') | « sql/connection_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/statement.cc
diff --git a/sql/statement.cc b/sql/statement.cc
index cd55bf710ff94ca4d3ea1def37f3ebed41815a3a..6e5cf3e0f2bbe70dbb7f02c97a8a881ba6fa532f 100644
--- a/sql/statement.cc
+++ b/sql/statement.cc
@@ -42,8 +42,10 @@ void Statement::Clear() {
}
bool Statement::CheckValid() const {
- if (!is_valid())
- DLOG(FATAL) << "Cannot call mutating statements on an invalid statement.";
+ // Allow operations to fail silently if a statement was invalidated
+ // because the database was closed by an error handler.
+ DLOG_IF(FATAL, !ref_->was_valid())
+ << "Cannot call mutating statements on an invalid statement.";
return is_valid();
}
@@ -306,7 +308,7 @@ bool Statement::CheckOk(int err) const {
int Statement::CheckError(int err) {
// Please don't add DCHECKs here, OnSqliteError() already has them.
succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE);
- if (!succeeded_ && is_valid() && ref_->connection())
+ if (!succeeded_ && ref_ && ref_->connection())
return ref_->connection()->OnSqliteError(err, this);
return err;
}
« sql/connection.cc ('K') | « sql/connection_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698