From 31ab993699bf35586c9e5e3cd41b7ee082ced1ee Mon Sep 17 00:00:00 2001 From: jsrobson10 Date: Fri, 12 Apr 2019 17:09:24 +1000 Subject: [PATCH] Added basic chat, message, and user structure --- main.js | 125 ++++++++++++++++++++++++++++++++++++-------------- settings.json | 3 +- 2 files changed, 93 insertions(+), 35 deletions(-) diff --git a/main.js b/main.js index b66cd86..bca3834 100644 --- a/main.js +++ b/main.js @@ -50,42 +50,56 @@ function sqlite3_getData(name, callback) db.all('SELECT rowid AS id, data FROM '+name, callback); } -// Load the users -var users = {}; - -// Create a new table -sqlite3_createTable("users", function() +function getrows_sqlite3(name, callback) { - // Load the table - sqlite3_getData("users", function(err, rows) + // Create the table + sqlite3_createTable(name, function() { - // Throw an error if there is one - if(err) throw err; - - // Loop over the rows - for(var i=0;i