update connection DB

This commit is contained in:
llopis15 2021-04-15 11:35:47 +02:00
parent 2d2955a073
commit deb0d40788
2 changed files with 6 additions and 6 deletions

View File

@ -1,9 +1,7 @@
const con = require('./connect');
function insertDB(barcode, shelving, level) {
con.con.connect(function(err) {
if (err) throw err;
let sql = `IF EXISTS(SELECT * FROM vn.smartTag WHERE code='${barcode}')
let sql = `IF EXISTS(SELECT * FROM vn.smartTag WHERE code='${barcode}')
THEN
UPDATE vn.smartTag
SET shelvingFk = '${shelving}', level = ${level}
@ -13,9 +11,8 @@ function insertDB(barcode, shelving, level) {
INTO vn.smartTag (code, shelvingFk, level)
VALUES ('${barcode}', '${shelving}', ${level});
END IF;`;
con.con.query(sql, function(err, result) {
if (err) throw err;
});
con.con.query(sql, function(err, result) {
if (err) throw err;
});
}
exports.insertDB = insertDB;

View File

@ -2,10 +2,13 @@ const express = require('express');
const app = express();
const port = 9999;
const logIn = require('./methods/logIn');
const con = require('./db/connect');
const dataLogIn = logIn.info;
exports.dataLogIn = dataLogIn;
con.con.connect(function(err) {});
app.use('/getNumShelving', require('./methods/setCollection'));
app.use('/insertTicket', require('./methods/bindTicketShelving'));
app.use('/bindShelving', require('./methods/bindShelvingTag'));