views:

125

answers:

1

With this code:

var db = google.gears.factory.create('beta.database');
db.open('cominar');
db.execute('CREATE TABLE IF NOT EXISTS Ajax (AJAX_ID INTEGER PRIMARY KEY AUTOINCREMENT , MODULE TEXT, FUNCTION TEXT, CONTENT_JSON TEXT);');
db.execute('VACUUM;'); // nettoye la DB

I'm trying to clean the database (VACUUM) at each initialisation but I get this error:

Uncaught Error: Database operation failed. ERROR: authorization denied DETAILS: not authorized

The database was created by me (the same page).

Thank you!

+1  A: 

I think that this is not allowed operation, so Gears team did not allow users to use this feature of Sqlite. Not all operations are allowed from JavaScript. For example attaching database could be dangerous so it is not allowed.

qfel13
In Gears/Database documentation, `ATTACH and DETACH` are disabled but there is no word about VACUUM. But, `PRAGMA auto_vacuum = 1;` is set by default.
Sirber
At http://code.google.com/apis/gears/api_database.html in PRAGMA settings there is something like this:Over time database files can become filled with gaps where data has been deleted. These gaps can be recovered with the VACUUM command, but VACUUM can lock the database for extended periods of time, making it a challenge to integrate into interactive applications. auto_vacuum mode recovers these gaps incrementally as they are generated.
qfel13