-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathSQLite.js
More file actions
30 lines (26 loc) · 724 Bytes
/
SQLite.js
File metadata and controls
30 lines (26 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
SQLite module
© 2023 Dark Tornado, All rights reserved.
CCL BY-NC 4.0
*/
(function() {
const SQLiteDatabase = android.database.sqlite.SQLiteDatabase;
function SQLite() {
this.db = null;
}
SQLite.prototype = {};
SQLite.prototype.open = function(file) {
this.db = SQLiteDatabase.openDatabase(file, null, SQLiteDatabase.CREATE_IF_NECESSARY);
};
SQLite.prototype.query = function(sql) {
if (sql.trim().toLowerCase().startsWith('select')) {
return this.db.rawQuery(sql, null);
} else {
this.db.execSQL(sql);
}
};
SQLite.prototype.close = function() {
this.db.close();
};
module.exports = SQLite;
})();