Reviewed by Darin
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Dec 2007 02:49:48 +0000 (02:49 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Dec 2007 02:49:48 +0000 (02:49 +0000)
        Fixed a glaring bug that would prevent a statement from getting run a second time

        * storage/SQLStatement.cpp:
        (WebCore::SQLStatement::execute): Clear failure due to quota *before* we check the error
          and return early
        (WebCore::SQLStatement::clearFailureDueToQuota): Only clear the error if it was a quota error

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28508 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/storage/SQLStatement.cpp

index b8cda69..2e2a73c 100644 (file)
@@ -1,3 +1,14 @@
+2007-12-06  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by Darin
+
+        Fixed a glaring bug that would prevent a statement from getting run a second time
+
+        * storage/SQLStatement.cpp:
+        (WebCore::SQLStatement::execute): Clear failure due to quota *before* we check the error
+          and return early
+        (WebCore::SQLStatement::clearFailureDueToQuota): Only clear the error if it was a quota error
+
 2007-12-06  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Oliver Hunt.
 2007-12-06  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Oliver Hunt.
index fc45b05..28d14b7 100644 (file)
@@ -53,14 +53,15 @@ SQLStatement::SQLStatement(const String& statement, const Vector<SQLValue>& argu
 bool SQLStatement::execute(Database* db)
 {
     ASSERT(!m_resultSet);
 bool SQLStatement::execute(Database* db)
 {
     ASSERT(!m_resultSet);
+        
+    // If we're re-running this statement after a quota violation, we need to clear that error now
+    clearFailureDueToQuota();
 
 
-    // This transaction might have been marked bad while it was being set up on the main thread
+    // This transaction might have been marked bad while it was being set up on the main thread, 
+    // so if there is still an error, return false.
     if (m_error)
         return false;
         
     if (m_error)
         return false;
         
-    // If we're re-running this statement after a quota violation, we need to clear that error now
-    clearFailureDueToQuota();
-    
     SQLiteDatabase* database = &db->m_sqliteDatabase;
     
     SQLiteStatement statement(*database, m_statement);
     SQLiteDatabase* database = &db->m_sqliteDatabase;
     
     SQLiteStatement statement(*database, m_statement);
@@ -171,8 +172,8 @@ void SQLStatement::setFailureDueToQuota()
 
 void SQLStatement::clearFailureDueToQuota()
 {
 
 void SQLStatement::clearFailureDueToQuota()
 {
-    ASSERT(!m_error || m_error->code() == 4);
-    m_error = 0;
+    if (lastExecutionFailedDueToQuota())
+        m_error = 0;
 }
 
 bool SQLStatement::lastExecutionFailedDueToQuota() const 
 }
 
 bool SQLStatement::lastExecutionFailedDueToQuota() const