Skip to content

Commit

Permalink
Correctly set auto_vacuum pragma for script storage databases.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ventero committed Feb 23, 2014
1 parent 4e3b226 commit 2517af4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions modules/miscapis.js
Expand Up @@ -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;
});
Expand Down

0 comments on commit 2517af4

Please sign in to comment.