-
Notifications
You must be signed in to change notification settings - Fork 82
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
CQL2 Escaping #717
Comments
|
Meeting 2022-07-22: What does SQL do? Also to search for a newline in a string? @pvretano will check implementations. |
Meeting 2022-08-01:
We want more feedback on this (@aaime - any experience from your use of CQL for feature queries?). We plan to make a decision in the next meeting on August 15. |
Meeting 2022-08-15: There was no feedback, but we really need feedback to make such a decision at this stage. We will leave this issue open for a few more weeks (likely until after the Code Sprint September 14-16) and then make a decision. |
Meeting 2022-11-21: @pvretano will create a PR to close this issue. If anyone has an opinion, please add a comment now. |
Meeting 2023-01-30: We will leave the escaping as it is (single quote within a string, |
I checked and the inclusion on the sequence So, if we allow Do we really want to do this? If yes, do we want to handle all the control sequences of just new line and tab? Do people really compare strings with new lines and tabs in them? In my experience that capability is reserved for TEXT SEARCH capabilities not string comparisons. Anyone interested please chime in ASAP so that I can create and merge a PR for this before the TC meeting. |
That is a valid point. In addition, there are all the different rules depending on the OS (e.g., "\n" vs. "\r" vs. "\r\n"). Adding special rules about control characters is probably unnecessary. If we would add them, we should support all of them. |
@cportele given that you can encode the control characters directly into a UNICODE character sequence I don't think it is necessary to mess with handling "special" character sequences that represent control characters. I think my vote is to just leave it out. |
@pvretano - Yes, I agree. |
@cportele OK, lets leave this for now and we can discuss closing either a the TC or the next SWG meeting. OK? |
Yes, sounds good to me. If anyone has a good argument for special rules for control characters, please add a comment. |
The use case I suggested really is about the ability to express new lines / tabs in CQL2 expressions.
@pvretano While technically this could be done for cql2-text, some form of escaping would need to be defined for cql2-json, otherwise you can encode a new line that will break JSON syntax, which has no built-in way to encode multi-line strings. A main use case of cql2-text being the ability to include in URL queries, possibly one could use % escape codes, but if an escaping is defined in cql2-json it might make sense to support the same escaping mechanism as well (e.g., I think it would also make sense to have a separate rule |
@jerstlouis new line and tab are control characters according to the UNCODE code blocks ... they are "C0 control codes". JSON has its own escaping mechanism and I believe it is to use the backslash to escape double quotes. We use the same mechanism when necessary in cql2-text. Specifically in one special case, when a character string is used in a LIKE expression an escape mechanism is required to escape the wildcards. The requirement for LIKE specifically allocates the backslash for that purpose ... but only in this one case. I guess the question here is whether we need special escape sequences for new line, tab, etc. for general strings? My feeling is this ...
If you need to compare URLs then you do The only place the |
https://www.json.org/json-en.html does say:
So in CQL2-JSON, newline and double quotes would be escaped with a In CQL2-TEXT, I guess we can assume it to be the raw values, and the transport mechanism can potentially define another mechanism if it does not support the raw values (e.g., the % encodes in a URL). |
@jerstlouis, yes, in JSON you escape with the If we had an XML encoding of a CQL filter, then newlines would be embeded in strings using Anyway, lets let others chime in too. I'm not that religious about my current position so if the will of the group is to use the JSON-mechanism in the text encoding then I'm OK with that. In the mean time I will separate out the whitespaces into a |
Meeting 2023-02-27:
@pvretano will create a PR or add this to an existing one. |
I will create a new issue to implement the "whitespace" rule. There are a lot of outstanding PRs right now against CQL2. Lets merge them all then then I can break out the whitespace rule ... that is mostly an editorial change just for the sake of clarity. Otherwise we may plunge into merge conflict purgatory! ;) |
Regarding escaping characters, currently CQL2 says:
'
are repeated to escape them within string literals\
is used to escape_
and%
inLIKE
patternsComments / Questions:
'
vs. using\
is somewhat inconsistent -- should\'
also work for escaping single quote?\n
) or tabs (\t
) in string literals?"
within double-quoted identifiers (\"
) following The alpha productions in the BNF is based on a deprecated section of the XML specification ... #707 changes?The text was updated successfully, but these errors were encountered: