Jaxer.DB.MySQL

MySQL database connection interface.

Constructor

var conn = new Jaxer.DB.MySQL.Connection(params);
var params = {
	HOST: '127.0.0.1',
	USER: 'root',
	PASS: 'raspberry',
	NAME: 'test',
	PORT: 3306
};

The MySQL connection instance takes a single object argument that contains the parameters for connection to a MySQL database. These parameters inclue the host, username, password, name of the database and port.

Properties

Unknown or not documented yet

Methods

  • Jaxer.DB.MySQL.prototype.close();
  • none

    null

    Closes the connection.

  • Jaxer.DB.MySQL.prototype.execute(sql, args);
    • <String>sql - The SQL string to be executed
    • <Array>args - The values to be escaped by the database instance

    Jaxer.DB.ResultSet

    Executes an SQL statement to a given MySQL connection. Arguments to insert or query can be substituted with '?' question marks to be automatically be espaced by the connection instance. An example is as provided:

    var params = {
    	HOST: '127.0.0.1',
    	USER: 'root',
    	PASS: 'raspberry',
    	NAME: 'test',
    	PORT: 3306
    };
    
    var conn = new Jaxer.DB.MySQL.Connection(params);
    conn.open();
    
    var sql = "INSERT INTO cars (color, type) VALUES (?, ?)";
    var args = [ "red", "sedan" ];
    var results = conn.execute(sql, args);
    
    conn.close();
    
  • Jaxer.DB.MySQL.prototype.open();
  • none

    null

    Opens the connection.