File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
java/net/sf/jsqlparser/schema
jjtree/net/sf/jsqlparser/parser Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 99 */
1010package net .sf .jsqlparser .schema ;
1111
12+ import java .util .regex .Matcher ;
1213import java .util .regex .Pattern ;
1314
1415public interface MultiPartName {
1516 Pattern LEADING_TRAILING_QUOTES_PATTERN = Pattern .compile ("^[\" \\ [`]+|[\" \\ ]`]+$" );
17+ Pattern BACKTICK_PATTERN = Pattern .compile ("`([^`]*)`" );
1618
1719 /**
1820 * Removes leading and trailing quotes from a SQL quoted identifier
@@ -33,4 +35,23 @@ static boolean isQuoted(String identifier) {
3335 String getFullyQualifiedName ();
3436
3537 String getUnquotedName ();
38+
39+ static String replaceBackticksWithDoubleQuotes (String input ) {
40+ if (input == null || input .isEmpty ()) {
41+ return input ;
42+ }
43+
44+ Matcher matcher = BACKTICK_PATTERN .matcher (input );
45+ StringBuilder sb = new StringBuilder ();
46+
47+ while (matcher .find ()) {
48+ // Replace each backtick-quoted part with double-quoted equivalent
49+ String content = matcher .group (1 );
50+ matcher .appendReplacement (sb , "\" " + Matcher .quoteReplacement (content ) + "\" " );
51+ }
52+ matcher .appendTail (sb );
53+
54+ return sb .toString ();
55+ }
56+
3657}
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ options {
1515 DEBUG_LOOKAHEAD = false;
1616 DEBUG_TOKEN_MANAGER = false;
1717 CACHE_TOKENS = false;
18+ SINGLE_TREE_FILE = false;
1819// FORCE_LA_CHECK = true;
1920 UNICODE_INPUT = true;
2021 JAVA_TEMPLATE_TYPE = "modern";
You can’t perform that action at this time.
0 commit comments