![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
rw-sql-parser
Advanced tools
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.
Added - in LITERAL Regex
The package is distributed on NPM and can be installed with...
npm install sql-parser
To build from source you'll need to run the following from the root of the project...
npm install
cake build
Tests are written using Mocha and can be run with...
npm test
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.
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'
This repo is a for of Forward's SQL Parser, kudos to them for most of the work.
A lot of the boilerplate and compilation code in this project is borrowed from the CoffeeScript project as it was the best example of a project using JISON that I could find. Thanks.
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.
FAQs
Lexer and Parser for SQL Syntax - Resource Watch edition
The npm package rw-sql-parser receives a total of 3 weekly downloads. As such, rw-sql-parser popularity was classified as not popular.
We found that rw-sql-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.