Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mysql = require('mysql');
- var pool = mysql.createPool({
- connectionLimit: 100,
- host: 'localhost',
- user: 'root',
- password: 'root',
- database: 'nomedaBD',
- debug: false,
- charset: 'utf8_unicode_ci'
- });
- function query (query, data, callback) {
- if (typeof data == 'function') {
- callback = data;
- data = [];
- }
- pool.getConnection(function (err, connection) {
- if (err) return onError(connection, err, callback);
- connection.query(query, data || [], function (err, rows, fields) {
- if (err) return onError(connection, err, callback);
- connection.release();
- callback.call(this, null, rows, fields);
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement