This repository has been archived on 2024-10-02. You can view files and clone it, but cannot push or open issues or pull requests.
smart-tag/db/insertDB.js

18 lines
634 B
JavaScript

const con = require('./connect');
function insertDB(barcode, shelving, level) {
let sql = `IF EXISTS(SELECT * FROM vn.smartTag WHERE code='${barcode}')
THEN
UPDATE vn.smartTag
SET shelvingFk = '${shelving}', level = ${level}
WHERE code='${barcode}';
ELSE
INSERT
INTO vn.smartTag (code, shelvingFk, level)
VALUES ('${barcode}', '${shelving}', ${level});
END IF;`;
con.con.query(sql, function(err, result) {
});
}
exports.insertDB = insertDB;