Skip to content

Commit 8226c34

Browse files
SNOW-974129: Add new connection property enablePatternSearch to flag if pattern searches for some DatabaseMetaData methods are allowed (#1639)
1 parent 1a993a8 commit 8226c34

File tree

5 files changed

+806
-72
lines changed

5 files changed

+806
-72
lines changed

src/main/java/net/snowflake/client/core/SFBaseSession.java

+13
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ public abstract class SFBaseSession {
132132
// Connection string setting
133133
private boolean enablePutGet = true;
134134

135+
// Enables the use of pattern searches for certain DatabaseMetaData methods
136+
// which do not by definition allow the use of patterns, but
137+
// we need to allow for it to maintain backwards compatibility.
138+
private boolean enablePatternSearch = true;
139+
135140
private Map<String, Object> commonParameters;
136141

137142
protected SFBaseSession(SFConnectionHandler sfConnectionHandler) {
@@ -713,6 +718,14 @@ public boolean setEnablePutGet(boolean enablePutGet) {
713718
return this.enablePutGet = enablePutGet;
714719
}
715720

721+
public boolean getEnablePatternSearch() {
722+
return enablePatternSearch;
723+
}
724+
725+
public void setEnablePatternSearch(boolean enablePatternSearch) {
726+
this.enablePatternSearch = enablePatternSearch;
727+
}
728+
716729
public int getClientResultChunkSize() {
717730
return clientResultChunkSize;
718731
}

src/main/java/net/snowflake/client/core/SFSession.java

+6
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,12 @@ public void addSFSessionProperty(String propertyName, Object propertyValue) thro
464464
}
465465
break;
466466

467+
case ENABLE_PATTERN_SEARCH:
468+
if (propertyValue != null) {
469+
setEnablePatternSearch(getBooleanValue(propertyValue));
470+
}
471+
break;
472+
467473
default:
468474
break;
469475
}

src/main/java/net/snowflake/client/core/SFSessionProperty.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ public enum SFSessionProperty {
7676

7777
PUT_GET_MAX_RETRIES("putGetMaxRetries", false, Integer.class),
7878

79-
RETRY_TIMEOUT("retryTimeout", false, Integer.class);
79+
RETRY_TIMEOUT("retryTimeout", false, Integer.class),
80+
81+
ENABLE_PATTERN_SEARCH("enablePatternSearch", false, Boolean.class);
8082

8183
// property key in string
8284
private String propertyKey;

0 commit comments

Comments
 (0)