Skip to content

Commit 6d68036

Browse files
author
Max Schaefer
committed
JavaScript: Add test demonstrating more SQL flow.
1 parent 68b3ccd commit 6d68036

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

javascript/ql/test/library-tests/frameworks/SQL/Credentials.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
| mssql3.js:12:13:12:22 | 'password' | password |
55
| mysql1.js:6:14:6:17 | 'me' | user name |
66
| mysql1.js:7:14:7:21 | 'secret' | password |
7+
| mysql1a.js:10:9:10:12 | 'me' | user name |
8+
| mysql1a.js:11:13:11:20 | 'secret' | password |
79
| mysql2.js:7:21:7:25 | 'bob' | user name |
810
| mysql2.js:8:21:8:28 | 'secret' | password |
911
| mysql2tst.js:8:9:8:14 | 'root' | user name |

javascript/ql/test/library-tests/frameworks/SQL/SqlString.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
| mssql2.js:22:24:22:43 | 'select 1 as number' |
66
| mysql1.js:13:18:13:43 | 'SELECT ... lution' |
77
| mysql1.js:18:18:22:1 | {\\n s ... vid']\\n} |
8+
| mysql1a.js:17:18:17:43 | 'SELECT ... lution' |
89
| mysql2.js:12:12:12:37 | 'SELECT ... lution' |
910
| mysql2tst.js:14:3:14:62 | 'SELECT ... ` > 45' |
1011
| mysql2tst.js:23:3:23:56 | 'SELECT ... e` > ?' |
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Adapted from the documentation of https://github.com/mysqljs/mysql,
2+
// which is licensed under the MIT license; see file mysqljs-License.
3+
4+
function importMySql() {
5+
return require("mysql");
6+
}
7+
8+
var connection = importMySql().createConnection({
9+
host: 'localhost',
10+
user: 'me',
11+
password: 'secret',
12+
database: 'my_db'
13+
});
14+
15+
connection.connect();
16+
17+
connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
18+
if (error) throw error;
19+
console.log('The solution is: ', results[0].solution);
20+
});
21+
22+
connection.end();
23+
24+
exports.connection = connection;

0 commit comments

Comments
 (0)