Skip to content
Commit 15cd5944 authored by Grégory Mantelet's avatar Grégory Mantelet
Browse files

[ADQL] Add to the parser a function attempting to quickly fix an ADQL query.

This new function - ADQLParser.tryQuickFix(...) - fixes the most common issues
with ADQL queries:

- replace Unicode confusable characters by their ASCII/UTF-8 version,
- double-quote SQL reserved words/terms (e.g. `public`, `year`, `date`),
- double-quote ADQL function names used a column name/alias (e.g. `distance`,
  `min`, `avg`),
- double-quote invalid regular identifiers (e.g. `_RAJ2000`, `2mass`).

The last point is far from being perfect but should work at least for
identifiers starting with a digit or an underscore, or an identifier including
one of the following character: `?`, `!`, `$`, `@`, `#`, `{`, `}`, `[`, `]`,
`~`, `^` and '`'.

It should also been noted that double-quoting a column/table name will make it
case-sensitive. Then, it is possible that the query does not pass even after the
double-quote operation ; the case would have to be checked by the user.

Finally, there is no attempt to fix column and table names (i.e. case
sensitivity and/or typos) using tables/columns list/metadata. That could be a
possible evolution of this function or an additional feature to implement in the
parent 03d4dc14
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment