Skip to content

Added support of ADO.NET "ReservedWords" collection schema (used for … #558

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

Merged
merged 2 commits into from
Sep 13, 2018

Conversation

fedesasso
Copy link
Contributor

Hi there. Hi added support of "ReservedWords" ADO.NET collection schema (see issue #375 "Support more schema collections in GetSchema").
Since I didn't find much in the official docs, I gathering the full list from what returned by the ODBC provider.
I needed that to make MySqlConnector work with NHibernate.

@bgrainger
Copy link
Member

The hard-coded list of reserved words for MySQL 5.7 is here: https://dev.mysql.com/doc/refman/5.7/en/keywords.html

This list includes entries, such as ABSOLUTE and ADA that aren't on that list.

For MySQL 8.0, the INFORMATION_SCHEMA.KEYWORDS table could be used to load the list at runtime.

@bgrainger
Copy link
Member

I dumped the results of select word from information_schema.keywords where reserved = 1; on MySQL Server 8.0.12 in https://gist.github.com/bgrainger/54e7f3200772734855b08970792f0175.

This should be the most up-to-date list of reserved words that can be hard-coded in the connector.

@bgrainger
Copy link
Member

There's a bug (in 8.0.12 and earlier) that could make it impractical to query INFORMATION_SCHEMA.KEYWORDS at runtime: https://bugs.mysql.com/bug.php?id=90160

@fedesasso
Copy link
Contributor Author

Were it not for the annoying bug, I'd SELECT VERSION(); parse somehow the result string and if it were )> 8.0 I'd query the information_schema_keywords table, otherwise use a hard coded list.
Since the mysql bug there, the hard coded list seems the viable solution, regardless the db version (even if different versions would likely have different lists).

Do you want me to change the code to use the list you provided, and then make a new pull request, or do find it quicker to change the code on your own, since I guess you already are on it?
(sorry, I'm new to github workflows)

@bgrainger
Copy link
Member

I'd SELECT VERSION(); parse somehow the result string and if it were )> 8.0

The problem with that is that MariaDB 10.0 is only compatible with MySQL 5.6 (but has a higher version number).

Do you want me to change the code to use the list you provided, and then make a new pull request

Yes; just push a new commit to this PR (instead of opening a new PR).

@bgrainger bgrainger merged commit 817b4e6 into mysql-net:master Sep 13, 2018
@bgrainger
Copy link
Member

Shipped in 0.45.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants