-
Notifications
You must be signed in to change notification settings - Fork 171
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
SNOW-1619625: Add exact search for schema #2012
base: master
Are you sure you want to change the base?
Conversation
bf139a8
to
27b4e8b
Compare
114c4e8
to
fff1aaf
Compare
src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java
Outdated
Show resolved
Hide resolved
fff1aaf
to
a305db8
Compare
src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java
Outdated
Show resolved
Hide resolved
a305db8
to
6b4abb6
Compare
if (schemaPattern != null | ||
if (isExactSchema) { | ||
String escapedSchema = | ||
schemaPattern.replaceAll("_", "\\\\\\\\_").replaceAll("%", "\\\\\\\\%"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you help me understand this?
Why so many backslashes?
Would it make sense to introduce an escape function, similarly to escapeSingleQuoteForLikeCommand
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to escape _
or %
with \\
for like
parameter and 8x \
in result replacement is the way to achieve that:
String schemaPattern = "test_bla%123";
String escapedSchema = schemaPattern.replaceAll("_", "\\\\\\\\_").replaceAll("%", "\\\\\\\\%");
System.out.println(escapedSchema);
results in test\\_bla\\%123
the operation is used once so extract function is not necessary
src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataLatestIT.java
Outdated
Show resolved
Hide resolved
6b4abb6
to
db59f44
Compare
db59f44
to
95c06ca
Compare
Overview
SNOW-1619625
Pre-review self checklist
master
branchmvn -P check-style validate
)mvn verify
and inspecttarget/japicmp/japicmp.html
)SNOW-XXXX: