gaugesEngine.js 698 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. *
  3. *
  4. */
  5. function MySQLBackendGaugesEngine() {
  6. var self = this;
  7. }
  8. /**
  9. *
  10. *
  11. */
  12. MySQLBackendGaugesEngine.prototype.buildQuerries = function(gauges, time_stamp) {
  13. var querries = [];
  14. // Iterate on each gauge
  15. for(var gaugeName in gauges) {
  16. var gaugeValue = gauges[gaugeName];
  17. console.log("Data: "+time_stamp+",'"+gaugeName+"',"+gaugeValue);
  18. querries.push("INSERT INTO `gauges_statistics` (`timestamp`, `name`, `value`) VALUES ("+time_stamp+", '"+gaugeName+"', "+gaugeValue+");");
  19. }
  20. return querries;
  21. }
  22. /**
  23. *
  24. *
  25. */
  26. exports.init = function() {
  27. var instance = new MySQLBackendGaugesEngine();
  28. return instance;
  29. };