npm.io
1.0.2 • Published 10 years ago

mysql_promise

Licence
MIT
Version
1.0.2
Deps
1
Vulns
0
Weekly
0

mysql_promise

an extremely easy way to send query to mysql server based on promise

Installation

npm install mysql_promise --save

step 1: config

var query = mysql.config({
	host: "mydatabase.example.com",
    user: "myusername",
    password: "mypass",
    database: "DB1"
});

step 2: query

var min_age = 10;
var gender = 'Male';
query('SELECT * FROM USER WHERE age > ? AND sex = ?', [min_age, gender])
	.then(function(rows){
		console.log(rows);
	})
	.catch(function(err){
		console.log(err);
	});