Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

batchsql

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

batchsql

Batch sql generator for MySQL and MariaDB

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by400%
Maintainers
1
Weekly downloads
 
Created
Source

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!

  1. BatchSQL allows you to run easy SQL queries.
  2. 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:

//require batchsql
var conn=require("batchsql");

//select database to use
conn.db('website',function(connection){
		

	//here is some data to insert
	var data={
		url:'https://www.npmjs.com/package/batchsql',
		domain:'npmjs.org',
		desc:'NodeJs packages'
	};

	//insert some data into 'urls' table
	conn.insert('urls',data, function(err,affected) {
		if(err){throw err}
		//print out affected rows
		console.log(affected);

		//now query the table
		var query="SELECT * FROM urls";	
		//NOTE the table is stated in query SQL so no need to pass it to method
		conn.query(query, function(err, results,rows) {
			//Viola! We have some results
			console.log(results,rows);
		});	

	},true); //note this last argument (ignore) tells batchSQL to perform an "INSERT IGNORE" query 

});

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!

Keywords

FAQs

Package last updated on 10 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc