Files
codeql/javascript/ql/test/library-tests/frameworks/SQL/mysql2.js
2018-08-02 17:53:23 +01:00

16 lines
511 B
JavaScript

// Adapted from the documentation of https://github.com/mysqljs/mysql,
// which is licensed under the MIT license; see file mysqljs-License.
var mysql = require('mysql');
var pool = mysql.createPool({
connectionLimit : 10,
host : 'example.org',
user : 'bob',
password : 'secret',
database : 'my_db'
});
pool.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
if (error) throw error;
console.log('The solution is: ', rows[0].solution);
});