@azhou/mysql-wrapper
v1.0.0
Published
MySQL simplified wrapper
Downloads
3
Readme
Usage
Initialize database
var db = require("@azhou/mysql-wrapper"); db.init("server", "database", "username", "password");
Run queries
Promise is returned as query gets executed
General query
db.query(sql).then(function (result) { // process results }.catch(function (error) { // process error });
Return single row
db.queryFirstRow("SELECT * FROM record WHERE id=?", id).then(...);
Return single value:
db.queryFirstField("SELECT COUNT(*) FROM record").then(...);