Comments (4)
Yes, this group of nodes has a lot of inconsistency: IF EXISTS
and IF NOT EXISTS
.
I have reworked to be a little more consistent across the different places these can appear:
- Use
expression
node incondition
forIF NOT EXISTS
.NOT EXISTS
, andEXISTS
modifiers instead of a string value
create table if not exists foo(id int)
CREATE TABLE Statement AST
{
"type": "statement",
"name": {
"type": "identifier",
"variant": "table",
"name": "foo"
},
"variant": "create",
"format": "table",
"definition": [
{
"type": "definition",
"variant": "column",
"name": "id",
"definition": [],
"datatype": {
"type": "datatype",
"variant": "int",
"affinity": "integer"
}
}
],
"condition": [
{
"type": "condition",
"variant": "if",
"condition": {
"type": "expression",
"variant": "exists",
"operator": "not exists"
}
}
]
}
drop table if exists foo
DROP TABLE Statement AST
{
"type": "statement",
"target": {
"type": "identifier",
"variant": "table",
"name": "foo"
},
"variant": "drop",
"format": "table",
"condition": [
{
"type": "condition",
"variant": "if",
"condition": {
"type": "expression",
"variant": "exists",
"operator": "exists"
}
}
]
}
select a
where not exists (select b)
NOT EXISTS Expression AST
{
"type": "statement",
"variant": "select",
"result": [
{
"type": "identifier",
"variant": "column",
"name": "a"
}
],
"where": [
{
"type": "expression",
"format": "unary",
"variant": "exists",
"expression": {
"type": "statement",
"variant": "select",
"result": [
{
"type": "identifier",
"variant": "column",
"name": "b"
}
]
},
"operator": "not exists"
}
]
}
Tagged the wrong issue in the commit, but the proposed changes are in this commit.
from sqlite-parser.
Included in latest sqlite-parser@beta
release v1.0.0-rc2.
from sqlite-parser.
Sorry about the original issue. It sounded a bit blunt
New nodes are working perfect. Almost no work on my part to fit them into the generator.
from sqlite-parser.
@jdrew1303 Awesome, I think we are getting pretty close now. Have you found any other issues since the last round of changes? This might be last call for changes before I release v1.0.0.
from sqlite-parser.
Related Issues (20)
- Node Structure Change: Change format in condition type node to variant HOT 4
- Node Structure Change: Add variant to module node of create virtual table statement. HOT 1
- "too much recursion" in browserified version HOT 7
- Trailing spaces in table or column names deleted
- Get full text of expression HOT 2
- operator precedence of AND/OR in where HOT 3
- use from browser without nodejs HOT 1
- Issue with Object.assign is not a function HOT 3
- Allow for / in the table names HOT 1
- Each expression is evaluated 4 times
- Why are invalid statements parsed without errors? HOT 1
- Incorrect AST when using "LIKE" expression HOT 2
- Support for Interval HOT 2
- Feature Request: add stringify method HOT 1
- Confusion about parsing of "not" operator HOT 1
- BUG: Named constraints lose names if other constraints are present
- split into multiple statements
- Do you have the AST definition document? HOT 1
- OVER clause incorrect validation
- Syntax error when use tokenizer arguments
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlite-parser.