Bug 1067054 - Remove generic SQLITE_ERROR warning & suppress warning if transaction exists. r=mak

--HG--
extra : rebase_source : 126e1918f828eef3374968cde8ca394a0f856376
This commit is contained in:
Chirag Bhatia 2015-04-10 13:16:00 +02:00
parent 6e98a99ffd
commit 8f1a6fdc91
3 changed files with 3 additions and 4 deletions

View File

@ -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;

View File

@ -124,8 +124,7 @@ public:
* Gets autocommit status.
*/
bool getAutocommit() {
MOZ_ASSERT(mDBConn, "A connection must exist at this point");
return static_cast<bool>(::sqlite3_get_autocommit(mDBConn));
return mDBConn && static_cast<bool>(::sqlite3_get_autocommit(mDBConn));
};
/**

View File

@ -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;
}