1.2.13 • Published 1 year ago

floral-sql-parser v1.2.13

Weekly downloads
265
License
GPL-2.0
Repository
-
Last release
1 year ago

Flora SQL Parser

npm.io NPM version NPM downloads

Parse simple SQL statements into an abstract syntax tree (AST) and convert it back to SQL.

Usage

Create AST for SQL statement

const { Parser } = require('flora-sql-parser');
const parser = new Parser();
const ast = parser.parse('SELECT * FROM t');

console.log(ast);

Convert AST back to SQL

const { Parser } = require('flora-sql-parser');
const ast = (new Parser()).parse('SELECT * FROM t');
const toSQL = require('flora-sql-parser').util.astToSQL;

console.log(toSQL(ast));

The generated SQL is ANSI SQL compliant. To run those queries on MySQL, make sure you set correct SQL mode

SET SESSION sql_mode = 'ANSI';

before running any query.

Acknowledgement

This project is based on the SQL parser extracted from Alibaba's nquery module.

License

GPL-2.0

1.2.13

1 year ago

1.2.12

1 year ago

1.2.10

1 year ago

1.2.11

1 year ago

1.2.8

2 years ago

1.2.9

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.0

2 years ago

1.1.9

2 years ago

1.2.1

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.9.9

3 years ago

0.9.8

3 years ago

0.9.7

3 years ago

0.9.6

3 years ago

0.9.5

3 years ago

0.9.4

3 years ago