Skip to content

Commit

Permalink
SNOW-974129: Add new connection property enablePatternSearch to flag …
Browse files Browse the repository at this point in the history
…if pattern searches for some DatabaseMetaData methods are allowed (#1639)
  • Loading branch information
sfc-gh-ext-simba-jf authored Feb 19, 2024
1 parent 1a993a8 commit 8226c34
Show file tree
Hide file tree
Showing 5 changed files with 806 additions and 72 deletions.
13 changes: 13 additions & 0 deletions src/main/java/net/snowflake/client/core/SFBaseSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ public abstract class SFBaseSession {
// Connection string setting
private boolean enablePutGet = true;

// Enables the use of pattern searches for certain DatabaseMetaData methods
// which do not by definition allow the use of patterns, but
// we need to allow for it to maintain backwards compatibility.
private boolean enablePatternSearch = true;

private Map<String, Object> commonParameters;

protected SFBaseSession(SFConnectionHandler sfConnectionHandler) {
Expand Down Expand Up @@ -713,6 +718,14 @@ public boolean setEnablePutGet(boolean enablePutGet) {
return this.enablePutGet = enablePutGet;
}

public boolean getEnablePatternSearch() {
return enablePatternSearch;
}

public void setEnablePatternSearch(boolean enablePatternSearch) {
this.enablePatternSearch = enablePatternSearch;
}

public int getClientResultChunkSize() {
return clientResultChunkSize;
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/net/snowflake/client/core/SFSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,12 @@ public void addSFSessionProperty(String propertyName, Object propertyValue) thro
}
break;

case ENABLE_PATTERN_SEARCH:
if (propertyValue != null) {
setEnablePatternSearch(getBooleanValue(propertyValue));
}
break;

default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ public enum SFSessionProperty {

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

RETRY_TIMEOUT("retryTimeout", false, Integer.class);
RETRY_TIMEOUT("retryTimeout", false, Integer.class),

ENABLE_PATTERN_SEARCH("enablePatternSearch", false, Boolean.class);

// property key in string
private String propertyKey;
Expand Down
Loading

0 comments on commit 8226c34

Please sign in to comment.