-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnative.sqlite.js
More file actions
47 lines (39 loc) · 964 Bytes
/
native.sqlite.js
File metadata and controls
47 lines (39 loc) · 964 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* global __db, VM, vm, _sqlite */
var Sqlite = function () {
var T = this, A = arguments;
const api = _sqlite;
T.id = null;
T.open = function (f) {
T.id = api.open(f);
vm.release(function () {
T.close();
});
};
T.close = function () {
if (T.id > -1) {
T.id = -1;
return api.close(T.id);
}
};
T.query = function () {
var A = arguments;
if (A.length > 2) {
api.queryEx(A[0], A[1], function (r) {
A[2](r);
});
return;
}
var r = api.query(T.id, A[0]).toString().parse();
if (typeof A[1] === "undefined") {
return r;
}
A[1](r);
};
T.exec = function (sql) {
return parseInt(api.exec(T.id, sql));
};
if (A.length > 0) {
T.open(A[0]);
}
return T;
};