Reputation: 43
I have a big problem with the command VACUUM to free the memory from delete´s SQL sentences.
Im making a Cordova Android APP, and i know when i use a DELETE SQL sentence the space of the app don't down,... the space persist like a fragment HardDisk.
Then, i see that VACUUM can compact my DB, but i have a problem!
I use SQLite3, and VACUUM in all sites say that can´t execute in a transaction, like this:
var db = window.sqlitePlugin.openDatabase({name:"maintenance", location:'default'});
db.transaction(function (tx) {
tx.executeSql('VACUUM', [], function (tx, results) {
alert('done');
}, function (tx, error) {
alert('error');
alert(error.message);
});
});
Ok, well, then, if i can't do in a transaction, could u tell me how can i execute a vacuum or auto-vacuum or something similar to compact the BD without write a line command? (remember that its a mobile app)
Upvotes: 0
Views: 350
Reputation: 26599
According to the GitHub Page, you should be able to execute SQL outside of a transaction with db.executeSql
:
db.executeSql("VACUUM", [], function(rs) {
// ok
}, function(err) {
// handle error
});
Upvotes: 1