var DB = require("topsin.database");
var _e = require("topsin.error");
var moment = require("moment");

var DEMO_CONN = 'DEMO_CONN';
DB.addConnection({
  database_type: 'pg',
  database_host: '139.196.104.13:5433',
  database_name: 'TOPMESV6_DEV_V6',
  database_user: 'toplinker',
  database_pwd: 'TopLinker0510'
}, DEMO_CONN);

var query = DB.query(DEMO_CONN);
query.begin();
try {
  var r = query.insertRow({
    table: 'pub_conf',
    data: {
      'path': 'toppdt ' + moment().format("YYYY-MM-DD HH:mm:ss.zzz")
    }
  })
  query.commit();
} catch (e) {
  query.rollback();
  print(e);
}

DB.removeConnection(DEMO_CONN);