ps.setInt(2, 1);
ps.setNull(3, java.sql.Types.INTEGER);
ps.setBigDecimal(4,new BigDecimal("1"));
ps.setNull(5, java.sql.Types.DATE);
ParameterMetaData paramMetaData = ps.getParameterMetaData();
assertEquals("Unexpected parameter count", 5, paramMetaData.getParameterCount());
//expected values to be stored in a 2dim. array
String [][] parameterMetaDataArray0 = {
//isNullable, isSigned, getPrecision, getScale, getParameterType, getParameterTypeName, getParameterClassName, getParameterMode
{"PARAMETER_NULLABLE", "false", "5", "0", "1", "CHAR", "java.lang.String", "PARAMETER_MODE_IN"},
{"PARAMETER_NULLABLE", "true", "10", "0", "4", "INTEGER", "java.lang.Integer", "PARAMETER_MODE_IN"},
{"PARAMETER_NULLABLE", "true", "10", "0", "4", "INTEGER", "java.lang.Integer", "PARAMETER_MODE_IN"},
{"PARAMETER_NULLABLE", "true", "5", "0", "3", "DECIMAL", "java.math.BigDecimal", "PARAMETER_MODE_IN"},
{"PARAMETER_NULLABLE", "false", "10", "0", "91", "DATE", "java.sql.Date", "PARAMETER_MODE_IN"}};
testParameterMetaData(paramMetaData, parameterMetaDataArray0);
/*
* JCC seems to report these parameters as MODE_UNKNOWN, where as Derby uses MODE_IN
* JCC behaviour with network server matches its behaviour with DB2
* getPrecision() returns 0 for CHAR/DATE/BIT types for Derby. JCC shows maxlen
*/
ps.execute();
/*
* bug 4533 - associated parameters should not be included in the parameter meta data list
* Following statement systab will generate 4 associated parameters for the 2
* user parameters. This results in total 6 parameters for the prepared statement
* internally. But we should only show 2 user visible parameters through
* getParameterMetaData().
*/
ps = prepareStatement("select * from sys.systables where " +
" CAST(tablename AS VARCHAR(128)) like ? and CAST(tableID AS CHAR(36)) like ?");
ps.setString (1, "SYS%");
ps.setString (2, "8000001%");
paramMetaData = ps.getParameterMetaData();
assertEquals("Unexpected parameter count", 2, paramMetaData.getParameterCount());
//expected values to be stored in a 2dim. array
String parameterMetaDataArray1 [][] = {
//isNullable, isSigned, getPrecision, getScale, getParameterType, getParameterTypeName, getParameterClassName, getParameterMode
{"PARAMETER_NULLABLE", "false", "128", "0", "12", "VARCHAR", "java.lang.String", "PARAMETER_MODE_IN"},