-
Notifications
You must be signed in to change notification settings - Fork 1
/
TEST.js
52 lines (37 loc) · 918 Bytes
/
TEST.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const { notStrictEqual } = require('assert');
const mysql = require('mysql');
function DBconnection()
{
var con = mysql.createConnection({
host: "localhost",
user: "adonis",
password: "password",
database: "streaming_server"
});
return con;
}
function query(DB)
{
DB.query("SELECT * FROM ROOMS WHERE ID = 1", function (err, result, fields) {
if (err) throw err;
DB.end();
var r = JSON.parse(JSON.stringify(result));
console.log(r);
console.log("ROOM ID: " + r[0].ID + " R: " + r[0].READER_ID + " S: " + r[0].SPEAKER_ID);
});
}
function SEL()
{
var DB = DBconnection();
DB.connect( (error) =>
{
if(error)
{
DB.end();
console.log(error);
r = {"STATUS":error};
}
});
query(DB);
DB.end();
}