}
/*
** Get the row and set the parameters based on that
*/
ParameterValueSet params = lcc.getLanguageFactory().newParameterValueSet(
lcc.getLanguageConnectionFactory().getClassFactory().getClassInspector(), types.length, false);
DataValueDescriptor[] rowArray = row.getRowArray();
// Check at compile time that the using clause has the correct number of parameters.
if (rowArray.length != types.length) {
throw StandardException.newException(SQLState.LANG_NUM_PARAMS_INCORRECT,
Integer.toString(rowArray.length), Integer.toString(types.length));
}
for (int i = 0; i < types.length; i++)
{
TypeId typeId = types[i].getTypeId();
params.setStorableDataValue(
typeId.getNull(),
i, typeId.getJDBCTypeId(), typeId.getCorrespondingJavaTypeName());
params.getParameterForSet(i).setValue(rowArray[i]);
}
/*
** If there are any other rows, then throw an
** exception
*/
if (rs.getNextRow() != null)
{
throw StandardException.newException(SQLState.LANG_USING_CARDINALITY_VIOLATION);
}
//bug 4552 - "exec statement using" will return no parameters through parametermetadata
params.setUsingParameterValueSet();
/*
** Stash the parameters in the compiler context
*/
getCompilerContext().setParams(params);