"use strict";(function(){var e=0;"use strict";var t=require("util");var r=require("events");var a=require("moment");function i(e){r.EventEmitter.call(this);if(false===this instanceof i){return new i(e)}this.setUpDb(e);this.db=e}t.inherits(i,r.EventEmitter);i.prototype.setUpDb=function(e){var t="CREATE TABLE IF NOT EXISTS operate_table(id INTEGER PRIMARY KEY AUTOINCREMENT, deviceName VARCHAR(32),time DATETIME, path VARCHAR(60));";this.db=e;this.db.run(t)};i.prototype.InsertIntoOperateTable=function(e,t){var r=this;var i=a().format("YYYY-MM-DD HH:mm:ss");r.db.run("INSERT INTO operate_table(deviceName, time, path) "+"VALUES (?,?,?);",[e.deviceName,i,e.path])};i.prototype.queryOperateTableByName=function(e,t){var r=this;r.db.all("SELECT * FROM operate_table where deviceName = ?;",[e],function(e,r){t(e,r)})};i.prototype.queryOperateTable=function(e){var t=this;t.db.all("SELECT * FROM operate_table;",function(t,r){e(t,r)})};i.prototype.deleteFromOperateTableByPath=function(e,t){var r=this;var a="(";for(var i=0;i<e.length;i++){a+="'"+e[i]+"'"+","}a=a.substring(0,a.length-1);a+=")";console.log(a);r.db.all("DELETE FROM operate_table where path in "+a,function(e){t(e)})};module.exports=i})();