123456789101112131415161718192021222324252627282930313233343536 |
- var db = {};
- var mysql = require('mysql');
- // var pool = mysql.createPool({
- // connectionLimit : 10,
- // host : '115.231.62.138',
- // user : 'vehicle',
- // password : 'vehicle',
- // database : 'guncontrol'
- // });
- var pool = mysql.createPool({
- connectionLimit : 10,
- host : '192.168.8.90',
- user : 'zwsy',
- password : 'zwsy@123',
- database : 'zwsy',
- supportBigNumbers: true//处理BigInt
- });
- db.query = function(sql, callback){
- if (!sql) {
- callback();
- return;
- }
- pool.query(sql, function(err, rows, fields) {
- if (err) {
- console.log(err);
- callback(err, null);
- return;
- };
- callback(null, rows, fields);
- });
- }
- module.exports = db;
|