Handling sessions, json response if not logged in

This commit is contained in:
MrFry 2020-04-06 21:34:33 +02:00
parent 52ae2828e5
commit 4c2c617b96
7 changed files with 110 additions and 23 deletions

View file

@ -5,7 +5,7 @@ module.exports = {
GetDB,
AddColumn,
TableInfo,
UpdateRecord,
Update,
Delete,
CreateTable,
SelectAll,
@ -83,7 +83,7 @@ function TableInfo (db, table) {
}
}
function UpdateRecord (db, table, newData, conditions) {
function Update (db, table, newData, conditions) {
try {
const s = `UPDATE ${table} SET ${GetSqlQuerry(newData)} WHERE ${GetSqlQuerry(conditions)}`
DebugLog(s)
@ -118,7 +118,8 @@ function CreateTable (db, name, columns) {
return acc
}, []).join(', ')
const s = `CREATE TABLE IF NOT EXISTS ${name}(${cols})`
// IF NOT EXISTS // TODO
const s = `CREATE TABLE ${name}(${cols})`
DebugLog(s)
const stmt = db.prepare(s)