-
Notifications
You must be signed in to change notification settings - Fork 612
feat: Add support for MSSQL table options #1414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pull Request Test Coverage Report for Build 10800832175Details
💛 - Coveralls |
- Rename T-SQL to MSSQL in docs - Add examples and links to all `SqlOption` - Remove duplicate `parse_options` function - Avoid nested if/else chains - Rename field of `SqlOption::KeyValue` to `key` - Extend testing with function calls, negative tests and using `verified_stmt` - Move parsing of `ASC`|`DESC` to function
src/parser/mod.rs
Outdated
let asc = if self.parse_keyword(Keyword::ASC) { | ||
/// Parsae ASC or DESC, returns an Option with true if ASC, false of DESC or `None` if none of | ||
/// them. | ||
pub fn parse_asc(&mut self) -> Option<bool> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this can be more generic in naming like parse_asc_desc
or parse_sort_direction
etc? thinking since asc itself isnt the only thing being parsed as the name currently suggests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it was used to only represent if asc (true/false) I wanted to use something like is_asc
but I found zero examples of is_
prefixed methods so stuck to parse
. I think parse_asc_desc
is fine but it's a bit confusing that it doesn't return an enum or either of them but a boolean. Hopefully the description is good enough, I opted to use parse_asc_desc
!
2a8f17c
to
ed632e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! cc @alamb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much @bombsimon and @iffyio -- this looks really nice.
It is so great to get pinged on a PR that is just ready to go. 🚀
Currently table options only supports key value-pairs where the key is an
Ident
and the value is anExpr
. In MSSQL theWITH
options can be more complex than that, configuring storage, partitioning and more.This implements the SQL Server
CREATE TABLE
syntax extendingSqlOptions
to be an enum with more complex values.