summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-21 23:18:49 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-21 23:18:49 +0000
commit767718e56d9952608e58c8e65568877f95820baa (patch)
tree6f93a4628a9d2f048945379ea11c961f883ee205 /app
parentc18a221971e1fd197cc79f2cc02336c73e6193cf (diff)
downloadchromium_src-767718e56d9952608e58c8e65568877f95820baa.zip
chromium_src-767718e56d9952608e58c8e65568877f95820baa.tar.gz
chromium_src-767718e56d9952608e58c8e65568877f95820baa.tar.bz2
Track down errno for SQLITE_IOERR_WRITE is happening.
Adds a log line to try to track down an SQLite error happening on the waterfall. Should only be emitted in case of a bad thing happening, like file-descriptors closing out from under us, so I can't think of why this would ever be hit for real. BUG=56427 TEST=no effect Attempt to test extended error codes. Fail. Review URL: http://codereview.chromium.org/3433016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60125 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/sql/connection.cc11
-rw-r--r--app/sql/connection.h4
-rw-r--r--app/sql/diagnostic_error_delegate.h5
3 files changed, 18 insertions, 2 deletions
diff --git a/app/sql/connection.cc b/app/sql/connection.cc
index 0b9021f..d227468 100644
--- a/app/sql/connection.cc
+++ b/app/sql/connection.cc
@@ -258,6 +258,17 @@ int Connection::GetErrorCode() const {
return sqlite3_errcode(db_);
}
+int Connection::GetLastErrno() const {
+ if (!db_)
+ return -1;
+
+ int err = 0;
+ if (SQLITE_OK != sqlite3_file_control(db_, NULL, SQLITE_LAST_ERRNO, &err))
+ return -2;
+
+ return err;
+}
+
const char* Connection::GetErrorMessage() const {
if (!db_)
return "sql::Connection has no connection.";
diff --git a/app/sql/connection.h b/app/sql/connection.h
index b89fb1a..0bd28ca 100644
--- a/app/sql/connection.h
+++ b/app/sql/connection.h
@@ -261,6 +261,10 @@ class Connection {
// Returns the error code associated with the last sqlite operation.
int GetErrorCode() const;
+ // Returns the errno associated with GetErrorCode(). See
+ // SQLITE_LAST_ERRNO in SQLite documentation.
+ int GetLastErrno() const;
+
// Returns a pointer to a statically allocated string associated with the
// last sqlite operation.
const char* GetErrorMessage() const;
diff --git a/app/sql/diagnostic_error_delegate.h b/app/sql/diagnostic_error_delegate.h
index c9de8ee..1c2d6e9 100644
--- a/app/sql/diagnostic_error_delegate.h
+++ b/app/sql/diagnostic_error_delegate.h
@@ -27,8 +27,9 @@ class DiagnosticErrorDelegate : public ErrorDelegate {
virtual int OnError(int error, Connection* connection,
Statement* stmt) {
- NOTREACHED() << "sqlite error " << error << ": " <<
- connection->GetErrorMessage();
+ NOTREACHED() << "sqlite error " << error
+ << ", errno " << connection->GetLastErrno()
+ << ": " << connection->GetErrorMessage();
RecordErrorInHistogram(error);
return error;
}