{"size": 1539, "ext": "js", "max_stars_repo_path": "src/common/api/db/db.js", "max_stars_repo_name": "lqxlcc/hua", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/common/api/db/db.js", "max_issues_repo_name": "lqxlcc/hua", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/common/api/db/db.js", "max_forks_repo_name": "lqxlcc/hua", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.9818181818, "max_line_length": 67, "alphanum_fraction": 0.4951267057}
var mysql = require('mysql');

var db = mysql.createPool({
    connectionLimit: 10,
    host: "10.3.136.43",
    user: 'root',
    password: '',
    database: 'flower',
    multipleStatements: true
})

module.exports = {
    select: function(_sql, _callback){
        db.query(_sql, function(error, results, fields){
            if(error){
                _callback({status: false, error: error})
            } else {
                _callback({status: true, data: {results, fields}});
            }

        })
    },
    insert: function(_addSql,_callback){
        db.query(_addSql,function (error, results,fields) {
            if(error){
                _callback({status: false, error: error})
                 return;
            }else{
                _callback({status: true, data: {results, fields}});
            }
        });
    },
    update: function(_modsql,_callback){
        db.query(_modsql,function (error,results,fields) {
            console.log(error,results,fields);
            if(error){
                _callback({status: false, error: error})
                return;
            }else{
                _callback({status: true, data: {results, fields}});
            }
        })
    },
    delete: function(_delsql,_callback){
        db.query(_delsql,function (error,results,fields) {
            if(error){
                _callback({status: false, error: error})
                return;
            }else{
                _callback({status: true, data: {results, fields}});
            }

        })
    }
}