diff --git a/python/pycomm.log b/python/pycomm.log new file mode 100644 index 0000000..d83c3a7 --- /dev/null +++ b/python/pycomm.log @@ -0,0 +1 @@ +pycomm.ab_comm.clx WARNING 2016-01-25 14:45:25,488 (5, 'forward_close returned False') diff --git a/python/tagserver_SQLite.py b/python/tagserver_SQLite.py index 82c3074..a646c75 100644 --- a/python/tagserver_SQLite.py +++ b/python/tagserver_SQLite.py @@ -6,13 +6,13 @@ Created on Dec 8, 2015 @author: Patrick McDonagh ''' -from random import randint import time import sqlite3 as lite from pycomm.ab_comm.clx import Driver as ClxDriver import logging -con = lite.connect("/usr/db/data.db") +# con = lite.connect("/usr/db/data.db") +con = lite.connect('/Users/patrickjmcd/data.db') def readTag(addr, tag): diff --git a/www/functions_SQLite.js b/www/functions_SQLite.js index 240ff4e..d094d96 100644 --- a/www/functions_SQLite.js +++ b/www/functions_SQLite.js @@ -1,4 +1,5 @@ -var dbFile = "/usr/db/data.db" +// var dbFile = "/usr/db/data.db" +var dbFile = '/Users/patrickjmcd/data.db'; // app.get('/json/add/:tag', fns.addTag); // Adds a tag to the scan list // app.get('/json/remove/:tag', fns.removeTag); // Removes a tag from the scan list // app.get('/json/val/:tag', fns.latestTagValue); // Gets the latest value of a single tag @@ -134,10 +135,9 @@ exports.seriesTagValues = function(req, res){ var db = new sqlite3.Database(dbFile); db.serialize(function(){ - var query = "SELECT * FROM vals WHERE tagID = ? AND dateAdded > DATETIME('now', '-? HOUR')"; + var query = "SELECT * FROM vals WHERE tagID = ? AND dateAdded > DATETIME('now', '-24 HOUR')"; var prepQuery = db.prepare(query); - // prepQuery.all(parseInt(req.params.tag), 6, function(err, rows){ - db.get(query, [parseInt(req.params.tag), 6], function(err, rows){ + prepQuery.all(parseInt(req.params.tag), function(err, rows){ prepQuery.finalize(); db.close(); if (err){