Skip to content

Refine dialect specific escaping. - #2328

Open
schauder wants to merge 2 commits into
mainfrom
issue/2325
Open

Refine dialect specific escaping.#2328
schauder wants to merge 2 commits into
mainfrom
issue/2325

Conversation

@schauder

Copy link
Copy Markdown
Contributor

Closes #2325

* @return new instance of {@link Escaper}.
* @since 4.1
*/
public static Escaper of(char escapeCharacter, Set<String> toReplace) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Above deprecated since 4.2, and this method says it has been introduced with 4.1

@Test // GH-2325
public void doublesSingleQuoteWhenEscapeCharacterIsSingleQuote() {

Escaper escaper = Escaper.of('\'', Set.of("'"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Creation with multiple strings removes any semantic context if one isn't familiar with the parameter ordering, it's a bunch of chars and strings after all. We should look for a bit more expressiveness. Escaper.create(it -> it.escape("_", "%").with("\\")) or Escaper.of(Target.ofStrings("_", "%"), EscapeChar.of('\\'))

@schauder

Copy link
Copy Markdown
Contributor Author

I addressed the issue. Please have another look.

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.

Refine Dialect specific escaping

3 participants