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

queryize

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

queryize

A no-frills chainable/fluent interface for constructing mutable MySQL queries with data binding/escapement.

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-86.21%
Maintainers
1
Weekly downloads
 
Created
Source

#queryize.js

A no-frills chainable/fluent interface for constructing mutable MySQL queries with data binding/escapement.

NPM version Licensed MIT Nodejs 0.10+ Downloads Build Status Coverage Status Gittip

##Installation

NPM: npm install queryize

##Usage

In Node or another CommonJS environment:

var queryize = require('queryize');
var query = queryize().select();
var select = require('queryize').select;
var query = select();

Visit queryizejs.com for documentation.

##Examples

var select = require('queryize').select;
var q = select()
    .from('users', 'u')
    .innerJoin('passwords', {alias: 'p', on: {'u.id':'p.user_id'}})
    .where({'u.email': 'user@example.com'})
    .columns('u.id', 'p.hash')
    .compile();

//q.query contains SELECT u.id, p.hash FROM users u INNER JOIN passwords p ON (u.id = p.user_id) WHERE u.email = ?
//q.data contains  ['user@example.com']
var queryize = require('queryize');
var q = queryize()
    .insert().into('users')
    .set({name: 'John Doe', email: 'user@example.com'})
    .compile();

//q.query contains INSERT INTO users SET u.name = ?, u.email = ?
//q.data contains  ['John Doe', 'user@example.com']
var queryize = require('queryize');
var q = queryize()
    .update().table('users')
    .set({name: 'John Doe', email: 'user@example.com'})
    .where({'u.id':1})
    .compile();

//q.query contains UPDATE users SET u.name = ?, u.email = ? WHERE u.id = ?
//q.data contains  ['John Doe', 'user@example.com', 1]
var queryize = require('queryize');
var q = queryize()
    .deleteFrom('users')
    .where({'u.id':1})
    .compile();

//q.query contains DELETE FROM users WHERE u.id = ?
//q.data contains  ['John Doe', 'user@example.com', 1]

##Running Unit Tests

From inside the repository root, run npm install to install the NodeUnit dependency.

Run npm test to execute the complete test suite.

Keywords

FAQs

Package last updated on 10 Oct 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