Commit a40cd99a authored by Zhai Zirun's avatar Zhai Zirun

mapped out remaining changes to code required for querying database

parent d4bf9f50
......@@ -16,14 +16,20 @@ const client = new Client({
});
client.connect();
function checkAllergens() { //TODO: insert argument NAME OF OBJECT
//TODO: change to correct query
client.query('SELECT table_schema,table_name FROM information_schema.tables;', (err, res) => {
if (err) throw err;
for (let row of res.rows) {
console.log(JSON.stringify(row));
}
//TODO: if any of the allergen columns are true then return true (can you do that in javascript??)
client.end();
});
}
client.query('SELECT table_schema,table_name FROM information_schema.tables;', (err, res) => {
if (err) throw err;
for (let row of res.rows) {
console.log(JSON.stringify(row));
}
client.end();
});
//https://www.w3schools.com/nodejs/nodejs_mysql_select.asp
......@@ -33,8 +39,8 @@ client.query('SELECT table_schema,table_name FROM information_schema.tables;', (
// Mouse listener for any move event on the current document.
document.addEventListener('mousemove', function (e) {
let srcElement = e.srcElement;
// Lets check if our underlying element is a IMG.
if (srcElement.nodeName == 'IMG') {
// Lets check if our underlying element contains any allergens.
if (srcElement.nodeName == 'IMG') {//TODO: EDIT this according to function checkAllergens above
//if (srcElement.nodeName == 'DIV' && srcElement.className == "content___1O9rr") {
//prevDOM != srcElement &&
srcName = srcElement.alt;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment