Skip to content
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

Add FULLTEXT support for MySQL and Generic dialects #702

Merged
merged 1 commit into from Nov 11, 2022
Merged

Add FULLTEXT support for MySQL and Generic dialects #702

merged 1 commit into from Nov 11, 2022

Conversation

AugustoFKL
Copy link
Contributor

feat: add FULLTEXT (1), (2), option on create table for MySQL and Generic dialects.

[1] : https://dev.mysql.com/doc/refman/8.0/en/create-table.html
[2] : https://dev.mysql.com/doc/refman/8.0/en/fulltext-natural-language.html

@coveralls
Copy link

coveralls commented Nov 6, 2022

Pull Request Test Coverage Report for Build 3424850968

  • 53 of 61 (86.89%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.003%) to 86.178%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser.rs 18 20 90.0%
src/ast/ddl.rs 17 23 73.91%
Totals Coverage Status
Change from base Build 3413823174: 0.003%
Covered Lines: 11622
Relevant Lines: 13486

💛 - Coveralls

src/ast/ddl.rs Outdated
Comment on lines 288 to 290
/// Whether the type is followed by the keyword `KEY` (Some(true)), `INDEX` (Some(false)),
/// or no keyword at all (None).
opt_key: Option<bool>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe an enum would be easier to use here

enum SpatialKey {
  Key,
  Index,
  None,
}

🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do it asap!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alamb done!

Copy link
Collaborator

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- thanks @AugustoFKL

Comment on lines +367 to +369
if !matches!(index_type_display, KeyOrIndexDisplay::None) {
write!(f, " {}", index_type_display)?;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since KeyOrIndexDisplay::None is displayed as "" I suspect you don't even have to have this test

Suggested change
if !matches!(index_type_display, KeyOrIndexDisplay::None) {
write!(f, " {}", index_type_display)?;
}
write!(f, " {}", index_type_display)?;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alamb the problem is that i'd have an additional space compared to the input string. Although it isn't incorrect, IMHO would be weird to print something like:

CREATE TABLE tb (c1 TEXT, FULLTEXT  (c1, c2);

@alamb alamb merged commit cdf4447 into sqlparser-rs:main Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants