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

sql-summary

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sql-summary

Summarize any SQL query

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
249K
decreased by-21.93%
Maintainers
2
Weekly downloads
 
Created
Source

sql-summary

Summarize any SQL query.

This JavaScript module will analyse an SQL query and return a very brief summary string containing:

  • Main verb used (SELECT, INSERT, UPDATE etc.)
  • Potentially the type operated on (TABLE, DATABASE etc.)
  • The name of the primary table or database operated on

For example, if given the following SQL query:

SELECT col1, col2 FROM table_name WHERE id=1

The following summary string is produced:

SELECT FROM table_name

npm Build status js-standard-style

Installation

npm install sql-summary

Usage

var sqlSummary = require('sql-summary')

var query = 'UPDATE table_name SET col1=1, col2=2 WHERE id=1'

console.log('Running query:', sqlSummary(query)) // => 'Running query: UPDATE table_name'
db.query(query, function (err, result) {
  // ...
})

Use-cases

  • In a web-server log output the type of queries used without going into too much details about each query
  • Group similar queries operating on the same tables

License

MIT

Keywords

FAQs

Package last updated on 25 Jul 2018

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