Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
mockingbird-sql
Advanced tools
SQL statement builder
mockingbird-sql - A simple SQL statement builder
const sql = require('mockingbird-sql');
let s = sql.select().columns([
'ColA',
'ColB',
'ColC',
]).from('tableA')
.leftOuterJoin('tableB', 'tableA.ColB = tableB.ColB', 'aliasB')
.where(
sql.and(
'tableA.ColA like \'%value%\'',
sql.lt('aliasb.ColX', 27)
)
).orderBy('ColA');
let query = sql.mysql.MySql.toSql(s);
// query.sql => SQL statement
// query.values => list of arguments
This module exports several kinds of functions useful for building complex SQL queries programmatically.
The major class are constructors for SQL statement objects. Another is functions for building SQL expressions. The third is classes for converting the statement objects into SQL suitable for passing to database drivers in order to execute the query.
Currently, two statements are supported: SELECT and UNION. Others can be added as necessary.
Constructor: module.select(): SELECT statement object
Methods:
All methods return the this object, to allow chaining.
s.columns( columns )
s.distinct( bool )
s.from( table, alias )
s.join( table, on, _alias )
s.where( expression )
s.whereAnd( expression )
s.whereOr( expression )
s.groupBy( column )
s.orderBy( column, direction )
s.limit( rows )
s.offset( _rows )
s.window( offset, limit )
Constructor: module.union(): UNION statement object
Methods:
u.add( statements )
u.orderBy( column, direction )
u.limit( rows )
u.offset( _rows )
u.window( offset, limit )
module.and( expression, expression )
module.or( expression, expression )
module.not( expression, expression )
module.isNull( expression )
module.isNotNull( expression )
Operators are:
module.between( column, left-value, right-value )
module.notBetween( column, left-value, right-value )
The Case object has a number of methods:
c.when( expression, result = null )
If result is null, use the then
method below to specifiy the result of
the branch.
c.then( result )
c.else( result )
This module is intended to support any (semi-) standardized SQL. Currently, it supports MySQL. The currently supported options are:
Conversion of a generated statement to MySQL is handled by the mysql.MySQL
object. Methods on this object are:
mysql.MySQL.toSql( statement )
This method returns an object containing two keys:
Conversion to Oracle SQL is handled by oracle.Oracle
object. The methods are
the same as MySQL above.
FAQs
SQL statement builder
The npm package mockingbird-sql receives a total of 0 weekly downloads. As such, mockingbird-sql popularity was classified as not popular.
We found that mockingbird-sql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.