浏览代码

Update gaugesEngine.js

Maximiliano 8 年之前
父节点
当前提交
7cd3558924
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      engines/gaugesEngine.js

+ 3 - 2
engines/gaugesEngine.js

@@ -32,7 +32,8 @@ MySQLBackendGaugesEngine.prototype.buildQuerries = function(gauges, time_stamp)
           // If it is different, we insert a new line.
           // If gaugeName does not exist in the table, we insert a new line
           // The -678 value, is totally arbitrary, I just assumed that there was never gonna be a gauge with a -678 value. You can change it to any value not used by your gauges ;)
-        querries.push("insert into `gauges_statistics` select "+time_stamp+", '"+gaugeName+"', "+gaugeValue+" from dual where (select if(max(value),max(value),-678) from `gauges_statistics` where name = '"+gaugeName+"') = -678 OR (select value from `gauges_statistics` where name = '"+gaugeName+"' order by timestamp desc limit 0,1) <> "+gaugeValue+";")
+	querries.push("INSERT INTO `gauges_statistics` (`timestamp`, `name`, `value`) VALUES ("+time_stamp+", '"+gaugeName+"', "+gaugeValue+");");
+        // querries.push("insert into `gauges_statistics` select "+time_stamp+", '"+gaugeName+"', "+gaugeValue+" from dual where (select if(max(value),max(value),-678) from `gauges_statistics` where name = '"+gaugeName+"') = -678 OR (select value from `gauges_statistics` where name = '"+gaugeName+"' order by timestamp desc limit 0,1) <> "+gaugeValue+";")
 
       }
     }
@@ -48,4 +49,4 @@ MySQLBackendGaugesEngine.prototype.buildQuerries = function(gauges, time_stamp)
 exports.init = function() {
 	var instance = new MySQLBackendGaugesEngine();
   return instance;
-};
+};