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

Side by Side Diff: sql/connection.cc

Issue 11112020: Allow multiple sql::Connection error delegates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sql/connection.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sql/connection.h" 5 #include "sql/connection.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 597
598 // The cache clear will get most statements. There may be still be references 598 // The cache clear will get most statements. There may be still be references
599 // to some statements that are held by others (including one-shot statements). 599 // to some statements that are held by others (including one-shot statements).
600 // This will deactivate them so they can't be used again. 600 // This will deactivate them so they can't be used again.
601 for (StatementRefSet::iterator i = open_statements_.begin(); 601 for (StatementRefSet::iterator i = open_statements_.begin();
602 i != open_statements_.end(); ++i) 602 i != open_statements_.end(); ++i)
603 (*i)->Close(); 603 (*i)->Close();
604 } 604 }
605 605
606 int Connection::OnSqliteError(int err, sql::Statement *stmt) { 606 int Connection::OnSqliteError(int err, sql::Statement *stmt) {
607 if (error_delegate_.get()) 607 if (!error_delegates_.empty()) {
608 return error_delegate_->OnError(err, this, stmt); 608 std::vector<scoped_refptr<ErrorDelegate> > delegates = error_delegates_;
609 for (size_t i = 0; err != SQLITE_OK && i < delegates.size(); ++i) {
610 err = delegates[i]->OnError(err, this, stmt);
611 }
612 return err;
613 }
609 // The default handling is to assert on debug and to ignore on release. 614 // The default handling is to assert on debug and to ignore on release.
610 DLOG(FATAL) << GetErrorMessage(); 615 DLOG(FATAL) << GetErrorMessage();
611 return err; 616 return err;
612 } 617 }
613 618
614 } // namespace sql 619 } // namespace sql
OLDNEW
« no previous file with comments | « sql/connection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698