[Pkg-mozext-commits] [greasemonkey] 09/15: Correctly set auto_vacuum pragma for script storage databases.

David Prévot taffit at moszumanska.debian.org
Mon Mar 31 21:59:09 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository greasemonkey.

commit 07bf3542376cb3b9ea29e6b168a49bcf7df9e6c6
Author: Ventero <ventero at ventero.de>
Date:   Sun Feb 23 03:08:05 2014 +0100

    Correctly set auto_vacuum pragma for script storage databases.
    
    Fixes #1879.
---
 modules/miscapis.js | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/miscapis.js b/modules/miscapis.js
index 2bfc0cf..927f455 100644
--- a/modules/miscapis.js
+++ b/modules/miscapis.js
@@ -34,15 +34,21 @@ function GM_ScriptStorage_getDb() {
   if (null == this._db) {
     this._db = Services.storage.openDatabase(this.dbFile);
 
+    // The auto_vacuum pragma has to be set before the table is created.
+    this._db.executeSimpleSQL('PRAGMA auto_vacuum = INCREMENTAL;');
+    this._db.executeSimpleSQL('PRAGMA incremental_vacuum(10);');
+    this._db.executeSimpleSQL('PRAGMA journal_mode = WAL;');
+
     this._db.executeSimpleSQL(
         'CREATE TABLE IF NOT EXISTS scriptvals ('
         + 'name TEXT PRIMARY KEY NOT NULL, '
         + 'value TEXT '
         + ')'
         );
-    this._db.executeSimpleSQL('PRAGMA auto_vaccum = INCREMENTAL;');
-    this._db.executeSimpleSQL('PRAGMA incremental_vacuum(10);');
-    this._db.executeSimpleSQL('PRAGMA journal_mode = WAL;');
+
+    // Run vacuum once manually to switch to the correct auto_vacuum mode for
+    // databases that were created with incorrect auto_vacuum. See #1879.
+    this._db.executeSimpleSQL('VACUUM;');
   }
   return this._db;
 });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git



More information about the Pkg-mozext-commits mailing list