Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ public class SQLServerConnection implements ISQLServerConnection, java.io.Serial

private Boolean isAzureDW = null;

private String schema = null;

static class CityHash128Key implements java.io.Serializable {

/**
Expand Down Expand Up @@ -5121,12 +5123,27 @@ public void setNetworkTimeout(Executor executor, int timeout) throws SQLExceptio
loggerExternal.exiting(getClassNameLogging(), "setNetworkTimeout");
}

/**
*
* @return If setSchema was used it'll use the value passed into setSchema or else it'll get the schema from Server.
* @throws SQLException
*/
@Override
public String getSchema() throws SQLException {
loggerExternal.entering(getClassNameLogging(), "getSchema");

checkClosed();

String schema = this.schema;
if (schema == null || schema.isBlank()) {
schema = getSchemaFromServer();
}

loggerExternal.exiting(getClassNameLogging(), "getSchema");
return schema;
}

private String getSchemaFromServer() throws SQLException {
SQLServerStatement stmt = null;
SQLServerResultSet resultSet = null;

Expand Down Expand Up @@ -5155,17 +5172,14 @@ public String getSchema() throws SQLException {
stmt.close();
}
}

loggerExternal.exiting(getClassNameLogging(), "getSchema");
return null;
}

@Override
public void setSchema(String schema) throws SQLException {
loggerExternal.entering(getClassNameLogging(), "setSchema", schema);
checkClosed();
addWarning(SQLServerException.getErrString("R_setSchemaWarning"));

this.schema = schema;
loggerExternal.exiting(getClassNameLogging(), "setSchema");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ protected Object[][] getContents() {
{"R_integratedAuthenticationFailed", "Integrated authentication failed."},
{"R_permissionDenied", "Security violation. Permission to target \"{0}\" denied."},
{"R_getSchemaError", "Error getting default schema name."},
{"R_setSchemaWarning", "Warning: setSchema is a no-op in this driver version."},
{"R_updateCountOutofRange", "The update count value is out of range."},
{"R_limitOffsetNotSupported", "OFFSET clause in limit escape sequence is not supported."},
{"R_limitEscapeSyntaxError", "Error in limit escape syntax. Failed to parse query."},
Expand Down