Title: [158906] trunk/Source/WebCore
Revision
158906
Author
beid...@apple.com
Date
2013-11-07 22:08:41 -0800 (Thu, 07 Nov 2013)

Log Message

Enhance SQL journal_mode setting code to be less likely to log an error.
<rdar://problem/15418577> and https://bugs.webkit.org/show_bug.cgi?id=124018

Reviewed by Anders Carlsson.

Even though the docs says SQLITE_ROW will always be returned, apparently SQLITE_OK is sometimes returned.
Change the code to handle that.

* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open): Save the statement result value, and accept SQLITE_OK as a non-error condition.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (158905 => 158906)


--- trunk/Source/WebCore/ChangeLog	2013-11-08 05:52:07 UTC (rev 158905)
+++ trunk/Source/WebCore/ChangeLog	2013-11-08 06:08:41 UTC (rev 158906)
@@ -1,5 +1,18 @@
 2013-11-07  Brady Eidson  <beid...@apple.com>
 
+        Enhance SQL journal_mode setting code to be less likely to log an error.
+        <rdar://problem/15418577> and https://bugs.webkit.org/show_bug.cgi?id=124018
+
+        Reviewed by Anders Carlsson.
+
+        Even though the docs says SQLITE_ROW will always be returned, apparently SQLITE_OK is sometimes returned.
+        Change the code to handle that.
+
+        * platform/sql/SQLiteDatabase.cpp:
+        (WebCore::SQLiteDatabase::open): Save the statement result value, and accept SQLITE_OK as a non-error condition.
+
+2013-11-07  Brady Eidson  <beid...@apple.com>
+
         Update an out-dated ASSERT in IconDatabase code.
         <rdar://problem/15171118> and https://bugs.webkit.org/show_bug.cgi?id=124030.
 

Modified: trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp (158905 => 158906)


--- trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp	2013-11-08 05:52:07 UTC (rev 158905)
+++ trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp	2013-11-08 06:08:41 UTC (rev 158906)
@@ -99,13 +99,16 @@
         LOG_ERROR("SQLite database could not set temp_store to memory");
 
     SQLiteStatement walStatement(*this, ASCIILiteral("PRAGMA journal_mode=WAL;"));
-    if (walStatement.step() != SQLITE_ROW)
+    int result = walStatement.step();
+    if (result != SQLITE_OK && result != SQLITE_ROW)
         LOG_ERROR("SQLite database failed to set journal_mode to WAL, error: %s",  lastErrorMsg());
 
 #ifndef NDEBUG
-    String mode = walStatement.getColumnText(0);
-    if (!equalIgnoringCase(mode, "wal"))
-        LOG_ERROR("journal_mode of database should be 'wal', but is '%s'", mode.utf8().data());
+    if (result == SQLITE_ROW) {
+        String mode = walStatement.getColumnText(0);
+        if (!equalIgnoringCase(mode, "wal"))
+            LOG_ERROR("journal_mode of database should be 'wal', but is '%s'", mode.utf8().data());
+    }
 #endif
 
     return isOpen();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to