Title: [242307] trunk/Source/WebCore
Revision
242307
Author
[email protected]
Date
2019-03-01 19:44:52 -0800 (Fri, 01 Mar 2019)

Log Message

Do not attempt to set WAL Journal mode on a readonly SQLite database
https://bugs.webkit.org/show_bug.cgi?id=195237

Reviewed by Simon Fraser.

This avoids logging errors when opening the database.

* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open):
(WebCore::SQLiteDatabase::useWALJournalMode):
* platform/sql/SQLiteDatabase.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (242306 => 242307)


--- trunk/Source/WebCore/ChangeLog	2019-03-02 03:27:56 UTC (rev 242306)
+++ trunk/Source/WebCore/ChangeLog	2019-03-02 03:44:52 UTC (rev 242307)
@@ -1,3 +1,17 @@
+2019-03-01  Chris Dumez  <[email protected]>
+
+        Do not attempt to set WAL Journal mode on a readonly SQLite database
+        https://bugs.webkit.org/show_bug.cgi?id=195237
+
+        Reviewed by Simon Fraser.
+
+        This avoids logging errors when opening the database.
+
+        * platform/sql/SQLiteDatabase.cpp:
+        (WebCore::SQLiteDatabase::open):
+        (WebCore::SQLiteDatabase::useWALJournalMode):
+        * platform/sql/SQLiteDatabase.h:
+
 2019-03-01  Antoine Quint  <[email protected]>
 
         [iOS] Turn mouse event simulation on by default

Modified: trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp (242306 => 242307)


--- trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp	2019-03-02 03:27:56 UTC (rev 242306)
+++ trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp	2019-03-02 03:44:52 UTC (rev 242307)
@@ -125,6 +125,14 @@
     if (!SQLiteStatement(*this, "PRAGMA temp_store = MEMORY;"_s).executeCommand())
         LOG_ERROR("SQLite database could not set temp_store to memory");
 
+    if (openMode != OpenMode::ReadOnly)
+        useWALJournalMode();
+
+    return isOpen();
+}
+
+void SQLiteDatabase::useWALJournalMode()
+{
     {
         SQLiteStatement walStatement(*this, "PRAGMA journal_mode=WAL;"_s);
         if (walStatement.prepareAndStep() == SQLITE_ROW) {
@@ -145,8 +153,6 @@
         } else
             LOG_ERROR("SQLite database failed to checkpoint: %s", lastErrorMsg());
     }
-
-    return isOpen();
 }
 
 void SQLiteDatabase::close()

Modified: trunk/Source/WebCore/platform/sql/SQLiteDatabase.h (242306 => 242307)


--- trunk/Source/WebCore/platform/sql/SQLiteDatabase.h	2019-03-02 03:27:56 UTC (rev 242306)
+++ trunk/Source/WebCore/platform/sql/SQLiteDatabase.h	2019-03-02 03:44:52 UTC (rev 242307)
@@ -142,7 +142,8 @@
     static int authorizerFunction(void*, int, const char*, const char*, const char*, const char*);
 
     void enableAuthorizer(bool enable);
-    
+    void useWALJournalMode();
+
     int pageSize();
 
     void overrideUnauthorizedFunctions();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to