Socket
Socket
Sign inDemoInstall

@verycrazydog/mysql-parser

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @verycrazydog/mysql-parser

Parser for MySQL statements


Version published
Weekly downloads
82
decreased by-11.83%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

[1.0.0] - 2020-04-05

Added

  • First release with .split() API.

Readme

Source

@verycrazydog/mysql-parser

A parser for MySQL statements. The current goal is to solve the missing DELIMITER syntax support in Node.js module mysql.

Usage

Split into an array of MySQL statement, one statement per array item

const splitResult = mysqlParser.split(`
  SELECT 1;
  SELECT 2;
  DELIMITER ;;
  SELECT 3;;
  DELIMITER $$
  SELECT 4$$
  DELIMITER ;
  SELECT 5;
  SELECT 6;
`)
// Print [ 'SELECT 1', 'SELECT 2', 'SELECT 3', 'SELECT 4', 'SELECT 5', 'SELECT 6' ]
console.log(splitResult)

Split into an array of MySQL statement, allow multiple statements per array item

const splitResult = mysqlParser.split(`
  SELECT 1;
  SELECT 2;
  DELIMITER ;;
  SELECT 3;;
  DELIMITER $$
  SELECT 4$$
  DELIMITER ;
  SELECT 5;
  SELECT 6;
`, { multipleStatements: true })
// Print [ "SELECT 1;\nSELECT 2;", "SELECT 3", "SELECT 4", "SELECT 5;\nSELECT 6;" ]
console.log(JSON.stringify(splitResult))

License

This module is licensed under the MIT License.

Acknowledge

This module was built by referencing the following materials:

Keywords

FAQs

Last updated on 05 Apr 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc