Skip to content

Commit 429f13c

Browse files
committed
add test
1 parent 6323060 commit 429f13c

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

bindings.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ Module['exec'] = function(db, sql, callback) {
3535
}
3636
}
3737

38+
this['SQL'] = Module;
39+

test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// js -m -n -e "load('sql.js')" test.js
2+
3+
var db = SQL.open(":memory:");
4+
5+
SQL.exec(db, "CREATE TABLE my_table(a INTEGER, b INTEGER, c VARCHAR(100));");
6+
SQL.exec(db, "INSERT INTO my_table VALUES(1,13153,'thirteen thousand one hundred fifty three');");
7+
SQL.exec(db, "INSERT INTO my_table VALUES(1,987,'some other number');");
8+
9+
function report(data) {
10+
print(JSON.stringify(data, null, ' ');
11+
}
12+
13+
SQL.exec(db, "SELECT count(*) FROM my_table;", report);
14+
SQL.exec(db, "SELECT a, b, c FROM my_table;", report);
15+

0 commit comments

Comments
 (0)