Title: [197922] trunk/Source/WebCore
Revision
197922
Author
[email protected]
Date
2016-03-09 21:17:58 -0800 (Wed, 09 Mar 2016)

Log Message

WebKit should adopt journal_mode=wal for all SQLite databases.
https://bugs.webkit.org/show_bug.cgi?id=133496

Reviewed by Brady Eidson & Darin Adler.

The statement intended to enable WAL mode is always failing because it is missing a
prepare(). Fix this. We were also previously permitting SQLITE_OK results - this
was in error (we were only getting these because stepping the unprepared statement
returned SQLITE_OK). Also set the SQLITE_OPEN_AUTOPROXY flag when opening the
database - this will improve perfomance when the database is accessed via an AFP
mount.

* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open):
    - call prepareAndStep(), only check for SQLITE_ROW result.
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::openDatabase):
    - should set SQLITE_OPEN_AUTOPROXY flag when opening database.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (197921 => 197922)


--- trunk/Source/WebCore/ChangeLog	2016-03-10 04:43:14 UTC (rev 197921)
+++ trunk/Source/WebCore/ChangeLog	2016-03-10 05:17:58 UTC (rev 197922)
@@ -1,3 +1,24 @@
+2016-03-09  Gavin Barraclough  <[email protected]>
+
+        WebKit should adopt journal_mode=wal for all SQLite databases.
+        https://bugs.webkit.org/show_bug.cgi?id=133496
+
+        Reviewed by Brady Eidson & Darin Adler.
+
+        The statement intended to enable WAL mode is always failing because it is missing a
+        prepare(). Fix this. We were also previously permitting SQLITE_OK results - this
+        was in error (we were only getting these because stepping the unprepared statement
+        returned SQLITE_OK). Also set the SQLITE_OPEN_AUTOPROXY flag when opening the
+        database - this will improve perfomance when the database is accessed via an AFP
+        mount.
+
+        * platform/sql/SQLiteDatabase.cpp:
+        (WebCore::SQLiteDatabase::open):
+            - call prepareAndStep(), only check for SQLITE_ROW result.
+        * platform/sql/SQLiteFileSystem.cpp:
+        (WebCore::SQLiteFileSystem::openDatabase):
+            - should set SQLITE_OPEN_AUTOPROXY flag when opening database.
+
 2016-03-09  Ryosuke Niwa  <[email protected]>
 
         Add runtime flags for shadow DOM and custom elements

Modified: trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp (197921 => 197922)


--- trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp	2016-03-10 04:43:14 UTC (rev 197921)
+++ trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp	2016-03-10 05:17:58 UTC (rev 197922)
@@ -116,17 +116,14 @@
         LOG_ERROR("SQLite database could not set temp_store to memory");
 
     SQLiteStatement walStatement(*this, ASCIILiteral("PRAGMA journal_mode=WAL;"));
-    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());
-
+    if (walStatement.prepareAndStep() == SQLITE_ROW) {
 #ifndef NDEBUG
-    if (result == SQLITE_ROW) {
         String mode = walStatement.getColumnText(0);
         if (!equalLettersIgnoringASCIICase(mode, "wal"))
-            LOG_ERROR("journal_mode of database should be 'wal', but is '%s'", mode.utf8().data());
-    }
+            LOG_ERROR("journal_mode of database should be 'WAL', but is '%s'", mode.utf8().data());
 #endif
+    } else
+        LOG_ERROR("SQLite database failed to set journal_mode to WAL, error: %s", lastErrorMsg());
 
     return isOpen();
 }

Modified: trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp (197921 => 197922)


--- trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp	2016-03-10 04:43:14 UTC (rev 197921)
+++ trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp	2016-03-10 05:17:58 UTC (rev 197922)
@@ -50,7 +50,7 @@
 
 int SQLiteFileSystem::openDatabase(const String& filename, sqlite3** database, bool)
 {
-    return sqlite3_open(fileSystemRepresentation(filename).data(), database);
+    return sqlite3_open_v2(fileSystemRepresentation(filename).data(), database, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_AUTOPROXY, nullptr);
 }
 
 String SQLiteFileSystem::appendDatabaseFileNameToPath(const String& path, const String& fileName)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to