Remove table creation and select from the table. Need to explore the SQLite object documentation to see how to find the recordset.
This commit is contained in:
parent
e1e9698a06
commit
41f00a5d58
@ -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();
|
||||
|
Reference in New Issue
Block a user