I want to make a small Add-on for Thunderbird that uses an SQLite database. I've created my database with "SQLite Manager". The problem is that when I access the database, I get the message that it is empty. But it isn't!
Database:
----------------------------
| table1 | table2 | table3 |
----------------------------
| ... | ... | ... |
| ... | ... | ... |
----------------------------
Here is the JavaScript code. It should return the name of tables, but I get 0.
Components.utils.import("resource://gre/modules/Sqlite.jsm");
Components.utils.import("resource://gre/modules/Task.jsm");
Task.spawn(function() {
let db;
let result;
try {
db = yield Sqlite.openConnection({ path: "db.sqlite" });
result = yield db.execute("SELECT name FROM sqlite_master WHERE type='table'");
alert(result.length);
} catch (ex) {
alert("error: " + ex);
} finally {
if (db) yield db.close();
}
});
Can one tell me what I'm doing wrong?
Is it possible to import and then to read an already existing database in Thunderbird?
Thanks!