Skip to content
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

make setObject() handle TVP with schema rather than [odb], when TVP is used with stored procedure #47

Merged
merged 2 commits into from
Nov 30, 2016
Merged
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 @@ -895,4 +895,10 @@ public <T> T unwrap(Class<T> iface) throws SQLException
return false;
}
}

String getTVPSchemaFromStoredProcedure(int param) throws SQLServerException{
checkClosed();
verifyParameterPosition(param);
return rsProcedureMeta.getString("SS_TYPE_SCHEMA_NAME");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2091,9 +2091,17 @@ String getTVPNameIfNull (int n, String tvpName) throws SQLServerException
{
if(this instanceof SQLServerCallableStatement)
{
java.sql.ParameterMetaData pmd = this.getParameterMetaData();
SQLServerParameterMetaData pmd = (SQLServerParameterMetaData) this.getParameterMetaData();
try {
tvpName = pmd.getParameterTypeName(n);
String tvpNameWithoutSchema = pmd.getParameterTypeName(n);
String tvpSchema = pmd.getTVPSchemaFromStoredProcedure(n);

if (null != tvpSchema) {
tvpName = "[" + tvpSchema + "].[" + tvpNameWithoutSchema + "]";
}
else {
tvpName = tvpNameWithoutSchema;
}
} catch (SQLException e) {
throw new SQLServerException(SQLServerException.getErrString("R_metaDataErrorForParameter"), null, 0 , e);
}
Expand Down