Commit graph

22 commits

Author SHA1 Message Date
Andrew Lamb
6739d377bd
Add docstrings for Dialects, update README (#1016) 2023-10-23 18:09:02 -04:00
Jeremy Dyer
2296de2bc4
Add fn support_group_by_expr to Dialect trait (#896) 2023-06-15 09:10:56 -04:00
Maciej Skrzypkowski
a1b7341b87
Non-Latin characters support (#840)
* Non latin characters

---------

Co-authored-by: Maciej Skrzypkowski <maciej.skrzypkowski@satoricyber.com>

* Test for mysql

---------

Co-authored-by: Maciej Skrzypkowski <maciej.skrzypkowski@satoricyber.com>
2023-03-23 07:07:17 -04:00
sam
a8a8e65b7c
PostgreSQL: GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY and GENERATED ALWAYS AS ( generation_expr ) support (#832)
* GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( sequence_options ) basic impl - test are failing.

* PostgreSQL GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( sequence_options ) and GENERATED ALWAYS AS ( generation_expr ) STORED implementation.
2023-03-16 05:54:00 -04:00
pawel.leszczynski
4ff3aeb040
support IF EXISTS in COMMENT statements (#831)
* support IF EXISTS in COMMENT statements

Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>

* Update src/ast/mod.rs

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

---------

Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-03-09 08:06:39 -05:00
Ankur Goyal
813f4a2eff
Introduce location tracking in the tokenizer and parser (#710)
* Add locations

* Add PartialEq

* Add PartialEq

* Add some tests

* Fix rebase conflicts

* Fix clippy

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-12-05 14:47:42 -05:00
Andy Grove
303f80f168
Add support for aggregate expressions with filters (#585) 2022-09-08 13:08:45 -06:00
Andy Grove
72559e9b62
Add ability for dialects to override prefix, infix, and statement parsing (#581) 2022-08-19 05:44:14 -06:00
joshwd36
17f8eb9c5a
Fix clippy lints (#287) 2021-01-07 18:30:12 +01:00
Nikhil Benesch
e78cf0483e
Standardize license headers
Standardize the license header, removing the Grove Enterprise copyright
notice where it exists per #58. Also add a CI check to ensure that files
without license headers don't get merged.

Fix #58.
2019-06-04 10:54:12 -04:00
Nickolay Ponomarev
304710d59a Add MSSQL dialect and fix up the postgres' identifier rules
The `@@version` test is MS' dialect of SQL, it seems, so test it with
its own dialect.

Update the rules for identifiers in Postresql dialect per documentation,
while we're at it. The current identifier rules in Postgresql dialect
were introduced in this commit - as a copy of generic rules, it seems:
810cd8e6cf (diff-2808df0fba0aed85f9d35c167bd6a5f1L138)
2019-05-04 01:00:13 +03:00
Nickolay Ponomarev
478dbe940d Factor test helpers into a common module
Also run "generic" tests with all dialects (`parse_select_version`
doesn't work with ANSI dialect, so I moved it to the postgres file
temporarily)
2019-05-04 01:00:13 +03:00
Nickolay Ponomarev
b12a19e197 Switch to the Rust 2018 edition
This requires Rust 1.31 (from last year) to build, but is otherwise
compatible with the 2015-edition code.
2019-04-21 04:41:11 +03:00
Nickolay Ponomarev
f87230553e Remove dialect-specific keyword lists (2/8)
Now populating SQLWord.keyword based on the list of globally supported
keywords.
2019-01-31 03:57:16 +03:00
Nickolay Ponomarev
9a8b6a8e64 Rework keyword/identifier parsing (1/8)
Fold Token::{Keyword, Identifier, DoubleQuotedString} into one
Token::SQLWord, which has the necessary information (was it a
known keyword and/or was it quoted).

This lets the parser easily accept DoubleQuotedString (a quoted
identifier) everywhere it expects an Identifier in the same match
arm. (To complete support of quoted identifiers, or "delimited
identifiers" as the spec calls them, a TODO in parse_tablename()
ought to be addressed.)

    As an aside, per <https://en.wikibooks.org/wiki/SQL_Dialects_Reference/Data_structure_definition/Delimited_identifiers>
    sqlite seems to be the only one supporting 'identifier'
    (which is rather hairy, since it can also be a string
    literal), and `identifier` seems only to be supported by
    MySQL. I didn't implement either one.

This also allows the use of `parse`/`expect_keyword` machinery
for non-reserved keywords: previously they relied on the keyword
being a Token::Keyword, which wasn't a Token::Identifier, and so
wasn't accepted as one.

Now whether a keyword can be used as an identifier can be decided
by the parser. (I didn't add a blacklist of "reserved" keywords,
so that any keyword which doesn't have a special meaning in the
parser could be used as an identifier. The list of keywords in
the dialect could be re-used for that purpose at a later stage.)
2019-01-31 03:57:16 +03:00
Nickolay Ponomarev
dce09f8054 Fix a mistake in merge conflict resolution earlier 2019-01-13 00:56:51 +03:00
Andy Grove
f8c6fa96f4 fix regression 2019-01-12 11:11:18 -07:00
Fredrik Roos
72024661a9 More tests and some small bugfixes 2018-11-18 00:53:39 +01:00
Nickolay Ponomarev
5a396bb9b4 Support "searched" CASE expressions (#15)
https://jakewheat.github.io/sql-overview/sql-2011-foundation-grammar.html#searched-case
2018-10-14 20:45:32 +03:00
Andy Grove
722ea7a91b ran cargo fmt 2018-10-06 09:39:26 -06:00
Jovansonlee Cesar
24153aee53 keywords are now generated via macro to avoid misspellings, dialects should lookup to these list of keywords to avoid mispellings 2018-10-01 00:58:20 +08:00
Jovansonlee Cesar
d66e4848bd modularize dialects into their own submodules
remove assertion in copy sql, conversion to_string is unfinished
2018-09-30 13:35:24 +08:00