MySQL simplified wrapper


1.0.07 years ago7 years agoMinified + gzip package size for @azhou/mysql-wrapper in KB



  1. Initialize database

    var db = require("@azhou/mysql-wrapper");
    db.init("server", "database", "username", "password");
  2. 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(...);

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.