Permalink
Browse files

db, feat: add multi-statements test case.

  • Loading branch information...
xicilion committed May 15, 2018
1 parent e67c485 commit eddeca98964f3e3632d002a66adebdb1e15ab8ae
Showing with 20 additions and 1 deletion.
  1. +20 −1 test/db_test.js
View
@@ -65,7 +65,7 @@ describe("db", () => {
it("create table", () => {
if (conn.type == 'mssql')
conn.execute('create table test(t1 int, t2 varchar(128), t3 VARBINARY(100), t4 datetime);');
conn.execute('create table test(t0 INT IDENTITY PRIMARY KEY, t1 int, t2 varchar(128), t3 VARBINARY(100), t4 datetime);');
else {
conn.execute('create table test(t0 INTEGER AUTO_INCREMENT PRIMARY KEY, t1 int, t2 varchar(128), t3 BLOB, t4 datetime);');
conn.execute('create table test_null(t1 int NULL, t2 varchar(128) NULL, t3 BLOB NULL, t4 datetime NULL);');
@@ -123,6 +123,25 @@ describe("db", () => {
}
});
it("multi sql", () => {
assert.deepEqual(conn.execute('select 100 as n'), [{
n: 100
}]);
assert.deepEqual(conn.execute('select 100 as n;select 200 as n'), [
[{
n: 100
}],
[{
n: 200
}]
]);
assert.deepEqual(conn.execute('select 100 as n; '), [{
n: 100
}]);
});
it("execute async", (done) => {
conn.execute("select * from test where t1=?", 1123, (e, rs) => {
if (e)

0 comments on commit eddeca9

Please sign in to comment.