Commit graph

501 commits

Author SHA1 Message Date
Nickolay Ponomarev
05a29212ff Update comments (follow-up to PR #155)
https://github.com/andygrove/sqlparser-rs/pull/155
2020-04-20 04:58:24 +03:00
Nickolay Ponomarev
33303b244f
Merge pull request #155 from eyalleshem/master
Accept non-standard `Select * from (a)` queries, where the table name is inside parentheses.
2020-04-20 04:57:12 +03:00
Nickolay Ponomarev
b9f1ff685a
Merge pull request #159 to fix Travis CI 2020-04-20 03:02:54 +03:00
Nickolay Ponomarev
dcc624c561 Make CI handle missing rustfmt in the nightly 2020-04-14 19:48:15 +03:00
Nickolay Ponomarev
4ce0eb11ae Fix a new clippy lint (.nth(0)) to unbreak CI
"iter.next() is equivalent to iter.nth(0), as they both consume the
next element, but is more readable."

https://rust-lang.github.io/rust-clippy/master/index.html#iter_nth_zero
2020-04-14 17:09:48 +03:00
Eyal Leshem
3255fd3ea8 Add support to to table_name inside parenthesis 2020-04-12 20:31:09 +03:00
Alex Kyllo
172ba42001 Add support for MSSQL's SELECT TOP N syntax (#150)
Add support for MSSQL SELECT TOP (N) [PERCENT] [WITH TIES] syntax.
2020-01-12 23:20:48 -05:00
Nikhil Benesch
4cdd6e2f84
Merge pull request #143 from apparebit/quote-id-quote
Support quoted identifiers in AST as well
2019-10-20 00:20:44 -04:00
Robert Grimm
b1cbc55128
Turn type Ident into struct Ident
The Ident type was previously an alias for a String. Turn it into a full
fledged struct, so that the parser can preserve the distinction between
identifier value and quote style already made by the tokenizer's Word
structure.
2019-10-20 00:16:41 -04:00
Andy Grove
9b2287f14c
Merge pull request #142 from andygrove/github-action
Add Github Action
2019-10-17 20:50:46 -06:00
Andy Grove
a2613f9dd1 format 2019-10-17 20:41:49 -06:00
Andy Grove
0687d3aca8 stable rust 2019-10-17 20:38:22 -06:00
Andy Grove
7730e5762a use stable rust 2019-10-17 20:35:09 -06:00
Nickolay Ponomarev
8c88294966
Merge pull request #141 from andygrove/changelog-0.5.0
Update CHANGELOG.md for 0.5.0
2019-10-17 23:50:51 +03:00
Andy Grove
41eda23ede test 2019-10-17 04:26:00 -06:00
Andy Grove
60448382c2 experimenting with github actions 2019-10-17 04:21:49 -06:00
Andy Grove
9b49db35ff
Add github action 2019-10-17 04:12:11 -06:00
Nickolay Ponomarev
489f157f17
Update CHANGELOG.md for 0.5.0 2019-10-11 00:18:35 +03:00
Andy Grove
adeb3f1f52 version bump 2019-10-10 08:09:26 -06:00
Andy Grove
8757a33013 version bump 2019-10-10 08:08:22 -06:00
Nikhil Benesch
c7021ed145
Merge pull request #139 from gaffneyk/master
Allow semicolon after start transaction
2019-09-14 00:25:44 -04:00
gaffneyk
2bb38c9b27
Parse START TRANSACTION when followed by a semicolon
Co-authored-by: Nikhil Benesch <nikhil.benesch@gmail.com>
2019-09-13 22:54:21 -04:00
Nikhil Benesch
abf68c6af6
Merge pull request #138 from andygrove/fix-skew
Fix merge skew with number literals
2019-09-02 09:48:57 -04:00
Nikhil Benesch
b8fe800da5
Fix merge skew with number literals 2019-09-02 09:37:38 -04:00
Nikhil Benesch
e9c5567b04
Merge pull request #135 from andygrove/show-columns
Support MySQL `SHOW COLUMNS` statement
2019-09-02 07:40:57 -04:00
Nikhil Benesch
f4df34074c
Merge pull request #130 from andygrove/decimal
Don't lose precision when parsing decimal fractions
2019-09-02 07:40:31 -04:00
Nikhil Benesch
a0aca824e8
Optionally parse numbers into BigDecimals
With `--features bigdecimal`, parse numbers into BigDecimals instead of
leaving them as strings.
2019-09-01 13:21:49 -04:00
Nikhil Benesch
b5621c0fe8
Don't lose precision when parsing decimal fractions
The SQL standard requires that numeric literals with a decimal point,
like 1.23, are represented exactly, up to some precision. That means
that parsing these literals into f64s is invalid, as it is impossible
to represent many decimal numbers exactly in binary floating point (for
example, 0.3).

This commit parses all numeric literals into a new `Value` variant
`Number(String)`, removing the old `Long(u64)` and `Double(f64)`
variants. This is slightly less convenient for downstream consumers, but
far more flexible, as numbers that do not fit into a u64 and f64 are now
representable.
2019-09-01 13:21:30 -04:00
Nikhil Benesch
e1ded184f8
Support SHOW <var> and SET <var> 2019-09-01 13:20:37 -04:00
Nikhil Benesch
2bef9ec30a
Merge pull request #121 from andygrove/ci-fmt
Check that CI enforces rustfmt
2019-08-27 18:15:43 -04:00
Brandon W Maister
f64928e994
Support MySQL SHOW COLUMNS statement
Co-authored-by: Nikhil Benesch <nikhil.benesch@gmail.com>
2019-08-14 15:13:05 -04:00
Nikhil Benesch
35a20091ea
Merge pull request #134 from umanwizard/expect_keywords
add `expect_keywords` function
2019-08-13 16:00:38 -04:00
Brennan Vincent
41d4ea480f
Add and use expect_keywords function
The code for parsing chains of expected keywords is more readable with
this helper function.

Co-authored-by: Nikhil Benesch <nikhil.benesch@gmail.com>
2019-08-13 15:42:14 -04:00
Nikhil Benesch
070d0192bf
Add missing license header 2019-08-13 15:04:42 -04:00
Nikhil Benesch
bc97543df3
Actually check rustfmt in CI
The previous incantation was simply *never* running rustfmt in CI,
rather than only running rustfmt on the nightly build.
2019-08-13 15:03:00 -04:00
Nickolay Ponomarev
391a54b5a3
Merge pull request #131 from nickolay/pr/refactoring
Assorted code simplification and doc improvements
2019-07-11 02:19:43 +03:00
Nickolay Ponomarev
086ba1281c Amend WindowFrame docs
The note about WindowFrameBound::Following being only valid "in
WindowFrame::end_bound" was both

- confusing, as it was based on the ANSI SQL syntax the parser doesn't
  adhere to -- though it sounded like a promise about the AST one could
  expect to get from the parser
- and incomplete, as the reality is that the bounds validation the SQL
  engine might want to perform is more complex. For example Postgres
  documentation says <https://www.postgresql.org/docs/11/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS>:

> Restrictions are that frame_start cannot be UNBOUNDED FOLLOWING,
> frame_end cannot be UNBOUNDED PRECEDING, and the frame_end choice
> cannot appear earlier in the above list of frame_start and frame_end
> options than the frame_start choice does — for example RANGE BETWEEN
> CURRENT ROW AND offset PRECEDING is not allowed. But, for example,
> ROWS BETWEEN 7 PRECEDING AND 8 PRECEDING is allowed, even though it
> would never select any rows.
2019-07-09 03:27:20 +03:00
Nickolay Ponomarev
f31636d339 Simplify parse_window_frame
It used to consume the `RParen` closing the encompassing `OVER (`, even
when no window frame was parsed, which confused me a bit, even though
I wrote it initially.

After fixing that, I took the opportunity to reduce nesting and
duplication a bit.
2019-07-09 03:27:20 +03:00
Nickolay Ponomarev
9314371d3b Remove parse_expr_list, as it's now trivial 2019-07-09 03:27:20 +03:00
Nickolay Ponomarev
03efcf6fa6 Add parse_comma_separated to simplify the parser
To use the new helper effectively, a few related changes were required:

- Each of the parse_..._list functions (`parse_cte_list`,
  `parse_order_by_expr_list`, `parse_select_list`) was replaced with a
  version that parses a single element of the list (e.g. `parse_cte`),
  with their callers now using
  `self.parse_comma_separated(Parser::parse_<one_element>)?`

- `parse_with_options` now parses the WITH keyword and a separate
  `parse_sql_option` function (named after the struct it produces) was
  added to parse a single k=v option.

- `parse_list_of_ids` is gone, with the '.'-separated parsing moved to
  `parse_object_name`.


Custom comma-separated parsing is still used in:
- parse_transaction_modes (where the comma separator is optional)
- parse_columns (allows optional trailing comma, before the closing ')')
2019-07-09 03:27:20 +03:00
Nickolay Ponomarev
f11d74a64d Update Statement::Drop doc comment 2019-07-09 03:27:20 +03:00
Nickolay Ponomarev
64e7be0c68 Move ObjectName closer to Ident in mod.rs 2019-07-09 03:27:20 +03:00
Nickolay Ponomarev
ac8ba107e3 Simplify Display implementations introduced in #124 2019-07-09 01:38:49 +03:00
Nickolay Ponomarev
1b31f03732 Change write! to write_str for better rustfmt formatting 2019-07-09 01:38:49 +03:00
Nickolay Ponomarev
275e6b13c9
Merge pull request #129 from nickolay/pr/changelog
Add a changelog
2019-07-09 01:17:00 +03:00
Nickolay Ponomarev
7c153e1ab0 Add changelog 2019-07-06 03:47:24 +03:00
Nikhil Benesch
8cd64e7b94
Merge pull request #128 from andygrove/readme
README: update for recent improvements
2019-07-03 10:30:35 -04:00
Nikhil Benesch
4172b68319
README: update for recent improvements
Remove outdated bits that claim shoddy SQL support and code
structure--we're much better on those fronts now! Also add a few
paragraphs about the current state of SQL compliance, why it's hard to
say anything detailed about SQL compliance, and what our long-term goals
are.
2019-07-03 01:39:14 -04:00
Andy Grove
7a4eb505b3 (cargo-release) start next development iteration 0.4.0 2019-07-01 18:19:02 -06:00
Andy Grove
4f805d6c96 (cargo-release) version 0.4.0 2019-07-01 18:17:47 -06:00