Package Exports
- mysqldb.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mysqldb.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
MySqlDB
The MySqlDB Class Library is a high level wrapper around the MySql.
Node.js (Install)
Requirements:
- Node.js
- npm (Node.js package manager)
npm install mysqldb.js
Usage
Including all libraries, for access to extra methods:
var MySqlConnection = require('mysqldb.js');
var server = "localhost";
var port = 3306;
var database = "mydb";
var username = "root";
var password = "";
//var mysql = new MySqlConnection(connectionString);
var mysql = new MySqlConnection(server, port, database, username, password);
var sql = "SELECT name, surname, email FROM posts ORDER BY name;";
// if connection is successful
mysql.sql_query(sql, function (err, result, fields) {
// if any error while executing above query, throw error
if (err) throw err;
// if there is no error, you have the result
console.log([result]);
});