batchsql v1.0.0
Sometimes you just need to run easy SQL commands. Sometimes you wanna batch them up and be sure execution will be smooth.
BatchSQL: No Frills!
- BatchSQL allows you to run easy SQL queries.
- Submit object arrays and Batch SQL is composed and executed on the fly!
##Installation
Using npm:
$ {sudo -H} npm i -g npm
$ npm i --save batchsql
In Node.js/io.js:
var conn=require("batchsql");
conn.db('website',function(connection){
var data={
url:'https://www.npmjs.com/package/batchsql',
domain:'npmjs.org',
desc:'NodeJs packages'
};
conn.insert('urls',data, function(err,affected) {
if(err){throw err}
console.log(affected);
var query="SELECT * FROM urls";
conn.query(query, function(err, results,rows) {
console.log(results,rows);
});
},true);
});
API
BatchSQL exposes the following methods.
##Query(query, callback) ##
Takes and executes a valid SQL query and returns results.
update(table,updateObj,condition,callback,upDateEntireTable)
insert(table,insertObj,callback,ignore)
upsert(table,insertObj,updateObj,callback,ignore)
#Be Carefurl! Not yet ready!
BatchSQL is still in early alpha and may not be appropriate fro production!