mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
25 lines
573 B
JavaScript
25 lines
573 B
JavaScript
// Adapted from the documentation of https://github.com/mysqljs/mysql,
|
|
// which is licensed under the MIT license; see file mysqljs-License.
|
|
|
|
function importMySql() {
|
|
return require("mysql");
|
|
}
|
|
|
|
var connection = importMySql().createConnection({
|
|
host: 'localhost',
|
|
user: 'me',
|
|
password: 'secret',
|
|
database: 'my_db'
|
|
});
|
|
|
|
connection.connect();
|
|
|
|
connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
|
|
if (error) throw error;
|
|
console.log('The solution is: ', results[0].solution);
|
|
});
|
|
|
|
connection.end();
|
|
|
|
exports.connection = connection;
|