X-Git-Url: https://git.rvb.name/weathermon.git/blobdiff_plain/428b776c5748cdfe60245fba4336c01b4f62064b..fad63ef17f825df2d1a58cc64be8bb19fb8e561f:/bin/weathermon?ds=inline diff --git a/bin/weathermon b/bin/weathermon index 2c5419c..c789bea 100755 --- a/bin/weathermon +++ b/bin/weathermon @@ -114,9 +114,7 @@ function submitValue(type,id,param,val) if code ~= 200 and backlogdb then printLog("writing record to backlog...") local backlog_con = assert(env:connect(backlogdb)) - backlog_con:execute('BEGIN TRANSACTION') - backlog_con:execute(string.format("INSERT INTO queue(time_stamp,sensor_id,sensor,param,value) VALUES (datetime('now','localtime'),'%s','%s','%s',%f)",id,type,param,val)) - local n,err = backlog_con:execute('COMMIT TRANSACTION') + local n,err = backlog_con:execute(string.format("INSERT INTO queue(time_stamp,sensor_id,sensor,param,value) VALUES (datetime('now','localtime'),'%s','%s','%s',%f)",id,type,param,val)) backlog_con:close() if err == "LuaSQL: database is locked" then @@ -130,13 +128,9 @@ function submitValue(type,id,param,val) if logdb then print(logdb) local log_con = assert(env:connect(logdb)) - log_con:execute('BEGIN TRANSACTION') - log_con:execute(string.format("INSERT INTO log(time_stamp,sensor_id,sensor,param,value) VALUES (datetime('now','localtime'),'%s','%s','%s',%f)",id,type,param,val)) - local n,err = log_con:execute('COMMIT TRANSACTION') + local n,err = log_con:execute(string.format("INSERT INTO log(time_stamp,sensor_id,sensor,param,value) VALUES (datetime('now','localtime'),'%s','%s','%s',%f)",id,type,param,val)) log_con:close() - print(n,err) - if err == "LuaSQL: database is locked" then unlock_db(logdb); end