Socket
Book a DemoInstallSign in
Socket

shaeiltajs

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shaeiltajs

By Dor Shay (Poob)

latest
Source
npmnpm
Version
0.1.5
Version published
Maintainers
1
Created
Source

Shailta.JS

Node.js warper for mysql connection managing,singleton use of connection and query from files.

By Dor Shay (Poob)

Initalize:

  • sqlConfig : (Object) sql config data like in Connection options and optinal server name.
  • sqlFilesPath : (String) optinal default location for sql files.
  • isGlobal : (Boolean) optinal.
var shaeilta = require("shaeiltajs");

var sqlConfig = {
    "connectionLimit" : 5,
    "host" : "127.0.0.1",
	"user" : "root",
	"password" : "pwd",
	"database" : "blabla",
	"name" : "billingDB"
};
var sqlFilesPath = __dirname + '/sql';
var isGlobal = true;

var psql = shaeilta.addServer(sqlConfig,sqlFilesPath,isGlobal)

Unsing:

###query: Simpale query like normal mysql.

* psql.query('select 1 as test',function(err,data)
{
    if(err) throw err
    res.json(data)
})

###fileQuery :

  • Load sql from file, can be from givan path releative to path givin in addServer or start path with % will ignore default.
psql.fileQuery('loadTop20Custumers.sql',function(err,data)
{
    if(err) throw err
    res.json(data)
})

Using pool from another file

  • Need to add server naming to readme
var server = shaeilta.getSevrer('billingDB')
// Or get server defiend as global
var server = shaeilta.getGlobalSevrer()

dor@poob.me

Keywords

mysql

FAQs

Package last updated on 24 Dec 2016

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