forked from kaizhu256/sql.js.redirect
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #128
- Loading branch information
Showing
10 changed files
with
212 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
exports.test = function(sql, assert) { | ||
// Create a database | ||
var db = new sql.Database(); | ||
|
||
db.run("CREATE TABLE test (data TEXT);"); | ||
|
||
db.exec("SELECT * FROM test;"); | ||
assert.deepEqual(db.getRowsModified(), 0, "getRowsModified returns 0 at first"); | ||
|
||
db.exec("INSERT INTO test VALUES ('Hello1');"); | ||
db.exec("INSERT INTO test VALUES ('Hello');"); | ||
db.exec("INSERT INTO test VALUES ('Hello');"); | ||
db.exec("INSERT INTO test VALUES ('World4');"); | ||
assert.deepEqual(db.getRowsModified(), 1, "getRowsModified works for inserts"); | ||
|
||
db.exec("UPDATE test SET data = 'World4' where data = 'Hello';"); | ||
assert.deepEqual(db.getRowsModified(), 2, "getRowsModified works for updates"); | ||
|
||
db.exec("DELETE FROM test;"); | ||
assert.deepEqual(db.getRowsModified(), 4, "getRowsModified works for deletes"); | ||
|
||
db.exec("SELECT * FROM test;"); | ||
assert.deepEqual(db.getRowsModified(), 4, "getRowsModified unmodified by queries"); | ||
|
||
}; | ||
|
||
if (module == require.main) { | ||
var sql = require('../js/sql.js'); | ||
var assert = require('assert'); | ||
exports.test(sql, assert); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.