sql-parser-mistic

WebJar for sql-parser-mistic

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

sql-parser-mistic
Последняя версия

Последняя версия

1.2.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

sql-parser-mistic
WebJar for sql-parser-mistic
Ссылка на сайт

Ссылка на сайт

https://www.webjars.org
Система контроля версий

Система контроля версий

https://github.com/mistic100/sql-parser

Скачать sql-parser-mistic

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/sql-parser-mistic/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>sql-parser-mistic</artifactId>
    <version>1.2.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/sql-parser-mistic/
implementation 'org.webjars.npm:sql-parser-mistic:1.2.3'
// https://jarcasting.com/artifacts/org.webjars.npm/sql-parser-mistic/
implementation ("org.webjars.npm:sql-parser-mistic:1.2.3")
'org.webjars.npm:sql-parser-mistic:jar:1.2.3'
<dependency org="org.webjars.npm" name="sql-parser-mistic" rev="1.2.3">
  <artifact name="sql-parser-mistic" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='sql-parser-mistic', version='1.2.3')
)
libraryDependencies += "org.webjars.npm" % "sql-parser-mistic" % "1.2.3"
[org.webjars.npm/sql-parser-mistic "1.2.3"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

SQL Parser

NPM version jsDelivr CDN Build Status

SQL Parser is a lexer, grammar and parser for SQL written in JS. Currently it is only capable of parsing fairly basic SELECT queries but full SQL support will hopefully come in time. See the specs for examples of currently supported queries.

Installation

The package is distributed on NPM and can be installed with...

npm install sql-parser-mistic

To build from source you'll need to run the following from the root of the project...

npm install
npm run compile

Tests are written using Mocha and can be run with...

npm test

Lexer

The lexer takes a SQL query string as input and returns a stream of tokens in the format

['NAME', 'value', lineNumber]

Here is a simple example...

lexer.tokenize('select * from my_table')

[
  ['SELECT','select',1],
  ['STAR','*',1],
  ['FROM','from',1],
  ['LITERAL','my_table',1]
]

The tokenized output is in a format compatible with JISON.

Parser

The parser only currently supports SELECT queries but is able to produce a Select object with properties for where, group, order, limit. See lib/nodes.coffee for more info of the returned object structure. Calling .toString() on a Select object should give you back a well formatted version of the original SQL input.

tokens = lexer.tokenize("select * from my_table where foo = 'bar'")
parser.parse(tokens).toString()

SELECT *
  FROM `my_table`
  WHERE `foo` = 'bar'

Contributions

Contributions in the form of pull requests that add syntax support are very welcome but should be supported by both Lexer and Parser level tests.

Версии библиотеки

Версия
1.2.3