README
nodamysql ( nk-mysql )
A mostly simple, yet powerful C++ data integration toolset for nodakwaeri (nk) or other software(s) which would make use of it.
Licensed under Apache v2.0, nodamysql features the MySQL C++ Connector from Oracle - which is licensed according to the terms provided under the FOSS License Exception when used with nodakwaeri (nk) or other Free and Open Source Software sporting acceptable license types.
nodamysql (nk-mysql) is designed to use Prepared Statements - and to allow implicit asynchronous usage - in order to help keep your application secure and efficient.
#### Continuous Integration
nk-mysql v0.4.x (Stable)
nk-mysql v0.2.x (Stable; Deprecated)
nk-mysql development (Testing/Unstable)
Regular builds and testing provided by travis-ci.org.
#### News
- Binaries are not supplied to Windows users for Node.js v0.12.x , you must build this package at this time (Binaries will be provided at a later date). [1]
- If for any reason you have an issue when utilizing Node.js v0.10.x, beyond submitting a bug report; please try installing nk-mysql using the following:
npm install nk-mysql@node-v10
. [2] - MySQL Connector C++ is now at v1.1.5. Changes since v1.1.3 included a forced static binding to libmysql for the connector.
- nk-mysql may also be used with mysql-cluster.
- MySQL Cluster now supports both traditional interfacing, as well as noSQL. Oracle has been working on a Memcached entry point for MySQL Cluster, which boasts the speed and efficiency found with noSQL based database systems; yet for both traditional and noSQL based transactions.
- In other MMOD project; namely nk-mvc and nk-xrm - we are expanding upon the data tools to enable support for both developer and designer. Our aim is to introduce a truly innovative approach, not only to agile development via our original MESSSE Code Methodology - but also to product development in general.
Notes:
[1] Binaries are supplied to Windows users utilizing Node.js v0.10.x, and are enabled by default for Windows users who do not have build tools installed (i.e. node-gyp).
[2] Support for Node.js v0.12.x is now included for all platforms, and this singular package is backwards-compatible with Node.js v0.10.x as well.
## Installation
Full and complete installation documentation can be found at the nodakwaeri wiki @ Github
#### The Quick Version
There are a few prerequisites that need to be in place in order to properly build nodamysql. On Windows, a precompiled binary is usually available but not always at this point. If you are familiar with nodakwaeri, and are sure you meet the requirements to build then:
To install (installing is how we build too!); open a terminal/shell/command tools/prompt and browse to the root of your application. Run the following command:
path_to_application/> npm install nk-mysql
If you are building, you should have no problems (If you verified that all of the prerequisites are met) and other than some potential warnings everything will build properly.
If you're not building (meaning node-gyp and python are not installed), but meet the requirements for a precompiled add-on; a fall-back solution should be loaded for you.
## Usage
At this time, examples may be found in the nodakwaeri wiki @ Github and nodamysql repository @ Github, though I'll leave this documentation with a copy of the wiki content:
### Preparing our DBO
Including nodamysql into your project is relatively simple:
// Require our type
var nkmysql = require( 'nk-mysql' ),
driver = nkmysql.driver;
...
nodamysql supports the use of models when using prepared statements. Models help to automate select and insert clause statement creation, and are most commonly used with - and provided by - [nk-mvc](http://github.com/mmod/nk-mvc)'s model system. Models cannot be used with regular statements (unprepared), or with UPDATE, DELETE, CREATE, and advanced SELECT queries when using prepared statements.
/*
If you are opting to use a model, you would define one like the one below.
Models are not required at all. The purpose of specifying the type and whether
a column is a key or required, is to provide necessary information to some
advanced tools coming soon, such as the migration and code-first support tools
for nodamysql and nk-mvc.
*/
var fakeModel =
{
id: [ 'key', 'type', 'Record Id' ],
title: [ false, 'type', 'Record Title' ],
description: [ false,'type', 'Record Description' ]
};
// Create a config, which contains our connection details and/or model if needed
// (you can leave the model property out altogether).
var config =
{
host: 'localhost',
port: '3306',
database: 'nktest',
username: 'nktestadm',
password: '^NKTestPass777