var httpfunc = require('topsin.httpfunc');
var REQ = httpfunc.argv().request;
var RES = httpfunc.argv().response;
var SinEror = require('topsin.error');
var result = new(require('topsin.responsedata'))();
var DB = require('topsin.database');
var DBNAME = REQ.pathCapture('DBNAME');
var Crypto = require('topsin.crypto');
var _ = require('lodash');

try {
    var data = DB.query(DBNAME, function(q) {
        q.insertRow({
            table: "sys_user_conf",
            data: {
                user_id: 1,
                path: 'dirty',
                attr_data: {
                    a: 4.1234
                }
            }
        });
        if (q.lastError().isValid()) {
            throw q.lastError().text();
        }
    });

    RES.body(true);
} catch (err) {
    result.setErrText(_.toString(err));
    RES.body(result.toJson());
}