Commit graph

35 commits

Author SHA1 Message Date
Andrew Lamb
4ab3ab9147
Update comments / docs for Spanned (#1549)
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
2024-11-30 08:08:55 -05:00
Andrew Lamb
9934f3d931
Update to ASF header / add when missing (#1437) 2024-09-21 06:23:28 -04:00
Thomas Kluyver
e027b3cad2
Document that comments aren't preserved for round trip (#1060) 2023-12-19 15:43:10 -05:00
Andrew Lamb
64eccdbba2
Document round trip ability (#1052) 2023-11-27 12:29:59 -05:00
Andrew Lamb
5ecf633e31
Add dialect_from_str and improve Dialect documentation (#848)
* Add `dialect_from_str` and improve `Dialect` documentation

* cleanup

* fix compilation with nostd
2023-04-27 11:37:11 -04:00
Andrew Lamb
751046de7d
Improve Readme (#774) 2022-12-28 10:49:51 -05:00
Raphael Taylor-Davies
dec3c2b818
Add derive based AST visitor (#765)
* Add derive based AST visitor

* Fix BigDecimal

* Fix no visitor feature

* Add test

* Rename visit_table to visit_relation

* Review feedback

* Add pre and post visit

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-12-28 10:07:12 -05:00
Andrew Lamb
79d0baad73
Add configurable recursion limit to parser, to protect against stack overflows (#764) 2022-12-28 08:29:51 -05:00
Markus Westerlind
34fedf311d
fix: Handle double quotes inside quoted identifiers correctly (#411)
* fix: Handle double quotes inside quoted identifiers correctly

This fixes #410 for standard SQL, however I don't know enough about other dialects to know if they
handle this differently. May need more extensive testing as well.

* refactor: Make quoted identifier parsing a seperate function

* test: Check that quoted identifier tokenization works

Added `pretty_assertions` so that the `assert_eq!` in the tokenization is readable

* test: Check that quoted identifiers work in mysql

* chore: cargo clippy
2022-02-07 10:05:17 -05:00
Qinxuan Chen
c9f8a44b55
Move the keywords module (#352)
* Move the keywords mod from dialect mod into the root of library

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* re-export keywords from dialect for backwards compatiblity

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2021-09-26 07:59:39 -04:00
Qinxuan Chen
5bc109a7ad
Support no_std (#332)
* Support `no_std`

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Fix typo

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2021-08-21 10:15:43 +02:00
BohuTANG
56e50dccd4
[parser] Return error instead of panic (#316)
* [parser] return error instead of panic

* Fix clippy warning

* Fix cargo fmt warning
2021-06-22 07:05:43 +02:00
Nickolay Ponomarev
4128dfe1db Introduce tests/test_utils/mod.rs and use it consistently
To share helper macros between various tests/* we added a new module
(tests/macros/mod.rs). This made the prologue to be used in tests quite
long and a little weird:
```
#[macro_use]
#[path = "macros/mod.rs"]
mod macros;
use sqlparser::test_utils::*;
```

This simplifies it to:
```
#[macro_use]
mod test_utils;
use test_utils::*;
```
- and switches all existing tests to the new prologue simultaneously...

...while fixing a few other inconsistencies and adding a few comments
about the way `test_utils` work.
2020-10-12 06:52:00 +03:00
eyalleshem
1b46e82eec
Enable dialect specific behaviours in the parser (#254)
* Change `Parser { ... }` to store the dialect used:
    `Parser<'a> { ... dialect: &'a dyn Dialect }`

    Thanks to @c7hm4r for the initial version of this submitted as
    part of https://github.com/ballista-compute/sqlparser-rs/pull/170

* Introduce `dialect_of!(parser is SQLiteDialect |  GenericDialect)` helper
    to branch on the dialect's type

* Use the new functionality to make `AUTO_INCREMENT` and `AUTOINCREMENT`
  parsing dialect-dependent.


Co-authored-by: Christoph Müller <pmzqxfmn@runbox.com>
Co-authored-by: Nickolay Ponomarev <asqueella@gmail.com>
2020-08-10 16:51:59 +03:00
Daniël Heres
d32df527e6
Accept &str in Parse::parse_sql (#182)
It is more generic to accept a `&str` than a `String` in an API,
and avoids having to convert a string to a `String` when not
needed, avoiding a copy.
2020-06-03 23:31:41 +03:00
Nickolay Ponomarev
7d4b488336 Update comments after the renaming done in PR #105 2019-07-01 04:45:08 +03:00
Nikhil Benesch
ac555d7e86
Remove "SQL" prefix from types
The rationale here is the same as the last commit: since this crate
exclusively parses SQL, there's no need to restate that in every type
name. (The prefix seems to be an artifact of this crate's history as a
submodule of Datafusion, where it was useful to explicitly call out
which types were related to SQL parsing.)

This commit has the additional benefit of making all type names
consistent; over type we'd added some types which were not prefixed with
"SQL".
2019-06-25 13:11:11 -04:00
Nikhil Benesch
cf655ad1a6
Remove "sql" prefix from module names
Since this crate only deals with SQL parsing, the modules are understood
to refer to SQL and don't need to restate that explicitly.
2019-06-24 12:56:26 -04: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
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
098d1c4a17 Enable clippy lints by default in RLS 2019-04-21 04:46:19 +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
Jovansonlee Cesar
639f01d4e7 Make Uuid a datatype in PostgreSQL dialect 2018-09-29 13:50:33 +08:00
Jovansonlee Cesar
9ab5c1358d Modularize SQLValue into an enum
Add capability of parsing dates
2018-09-25 15:54:29 +08:00
Jovansonlee Cesar
2007995938 Improve the create statement parser that uses create statements from pg database dump
Added PostgreSQL style casting
2018-09-24 03:34:40 +08:00
Andy Grove
06a8870bd7 Introduce concept of dialects 2018-09-08 08:39:32 -06:00
Andy Grove
cc725791de cargo fmt 2018-09-08 08:10:05 -06:00
Andy Grove
9cc4bc3423 Adding rustdoc comments 2018-09-08 07:24:00 -06:00
Andy Grove
0c23392adb replace with code from datafusion 2018-09-03 09:56:39 -06:00
Andy Grove
eed0261297 create module for ansi tokenizer/parser 2018-09-01 07:34:41 -06:00
Andy Grove
f56846098e simple example of custom tokenizer 2018-02-09 06:53:49 -07:00
Andy Grove
fcf6b1150e save 2018-02-09 05:58:14 -07:00
Andy Grove
b16396aef3 roughing out classic pratt parser 2018-02-08 07:49:24 -07:00
Andy Grove
1e5686c793 Save 2018-02-07 08:53:09 -07:00
Andy Grove
3caeb58d22 roughing out new version 2018-02-07 08:48:49 -07:00