From 8f1a6fdc91ac8124dd064851768a7d99de49c39a Mon Sep 17 00:00:00 2001 From: Chirag Bhatia Date: Fri, 10 Apr 2015 13:16:00 +0200 Subject: [PATCH] Bug 1067054 - Remove generic SQLITE_ERROR warning & suppress warning if transaction exists. r=mak --HG-- extra : rebase_source : 126e1918f828eef3374968cde8ca394a0f856376 --- storage/src/mozStorageAsyncStatementExecution.cpp | 2 +- storage/src/mozStorageConnection.h | 3 +-- storage/src/mozStoragePrivateHelpers.cpp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/storage/src/mozStorageAsyncStatementExecution.cpp b/storage/src/mozStorageAsyncStatementExecution.cpp index ee8228accdaf..277b566fb800 100644 --- a/storage/src/mozStorageAsyncStatementExecution.cpp +++ b/storage/src/mozStorageAsyncStatementExecution.cpp @@ -586,7 +586,7 @@ AsyncExecuteStatements::Run() if (mState == CANCELED) return notifyComplete(); - if (statementsNeedTransaction()) { + if (statementsNeedTransaction() && mConnection->getAutocommit()) { if (NS_SUCCEEDED(mConnection->beginTransactionInternal(mNativeConnection, mozIStorageConnection::TRANSACTION_IMMEDIATE))) { mHasTransaction = true; diff --git a/storage/src/mozStorageConnection.h b/storage/src/mozStorageConnection.h index a86ec796f08f..598646f017be 100644 --- a/storage/src/mozStorageConnection.h +++ b/storage/src/mozStorageConnection.h @@ -124,8 +124,7 @@ public: * Gets autocommit status. */ bool getAutocommit() { - MOZ_ASSERT(mDBConn, "A connection must exist at this point"); - return static_cast(::sqlite3_get_autocommit(mDBConn)); + return mDBConn && static_cast(::sqlite3_get_autocommit(mDBConn)); }; /** diff --git a/storage/src/mozStoragePrivateHelpers.cpp b/storage/src/mozStoragePrivateHelpers.cpp index 7bd44183f0ac..682ae42ff9c9 100644 --- a/storage/src/mozStoragePrivateHelpers.cpp +++ b/storage/src/mozStoragePrivateHelpers.cpp @@ -75,7 +75,7 @@ convertResultCode(int aSQLiteResultCode) message.AppendLiteral("SQLite returned error code "); message.AppendInt(rc); message.AppendLiteral(" , Storage will convert it to NS_ERROR_FAILURE"); - NS_WARNING(message.get()); + NS_WARN_IF_FALSE(rc == SQLITE_ERROR, message.get()); #endif return NS_ERROR_FAILURE; }