From 41f00a5d58ecfb0d214614ed447e0b0bffe08b43 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Wed, 22 Mar 2023 08:13:36 -0500 Subject: [PATCH] Remove table creation and select from the table. Need to explore the SQLite object documentation to see how to find the recordset. --- src/server.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/server.js b/src/server.js index 49a1593..22e7161 100644 --- a/src/server.js +++ b/src/server.js @@ -45,24 +45,13 @@ async function main() { let db = await new sqlite3.Database(DIR+"/db/main"); console.log(db); try { - await db.run(` - CREATE TABLE journal ( - user_id INTEGER NOT NULL, - cal_date TEXT NOT NULL, - meal TEXT NOT NULL, - food TEXT NOT NULL, - caused_issue INTEGER NOT NULL, - comments TEXT - ) STRICT - `); - } catch (e) { - console.log("Table not created.") - } finally { - let r = await db.get(` + let r = await db.run(` SELECT count(*) FROM journal `); - console.log(r); + } catch (e) { + console.log("ERROR: The journal table could not be selected ", e); } + console.log("The journal table current contains", r, " records.") } main();