New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mysql-advanced-query

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mysql-advanced-query

mysql query module allowing more than just where = comparisions

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

nodejs-mysql-advanced-query

nodejs mysql query module that supports advanced ('where') queries

usage example:

usage schema

generator.find(tableName, { columnName: {comparisionAction: value}, columnName2: { comparisionAction: value } });

create handler and call function

app.get('/someUrl', function(req, res){
    var QueryGenerator = require('mysql-query-generator');
    var generator = new QueryGenerator();
    var table = 'users';
    var query = generator.find(table, { columnName: {is: 'bla'}, columnName2: { greater: 4 } });
});

returned query

select * from users where columnName = 'bla' and columnName2 > 4;

supported comparision actions:

###general:

  • is => "=" -- where column = value
  • isNot => "!=" -- where column != value

###strings only

  • contains => "like" -- where column like '%value%'
  • containsNot => "not like" -- where column not like '%value%'
  • startsWith => "like value%" -- where column like 'value%'
  • endsWith => "like %value" -- where column like '%value'

###numbers only:

  • less => "<"
    • where column < value
  • lessOrEqual => "<="
    • where column <= value
  • greater => ">"
    • where column > value
  • greaterOrEqual => ">="
    • where column >= value

illegal (those that are not supported) modifiers will be ignored

Security

Injections

To prevent sql injections certain characters and keywords are not allowed like:

  • quotes
  • whitespaces

License

MIT

Keywords

FAQs

Package last updated on 13 Aug 2014

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