public void testProcedureColumns() throws Exception {
  try {
    Statement stmt=con.createStatement();
    stmt.execute("CREATE PROC jtds_testparam @p1 int, @p2 int output as\r\n" + "BEGIN\r\n" + "  SELECT @p2 = @p1\r\n"+ "END");
    stmt.close();
    DatabaseMetaData dbmd=con.getMetaData();
    String[] columnPatterns=new String[]{null,"%"};
    for (int i=0; i < columnPatterns.length; i++) {
      ResultSet rs=dbmd.getProcedureColumns(null,null,"jtds_testparam",columnPatterns[i]);
      assertTrue(rs.next());
      Assert.assertEquals("@RETURN_VALUE",rs.getString("COLUMN_NAME"));
      Assert.assertEquals(DatabaseMetaData.procedureColumnReturn,rs.getInt("COLUMN_TYPE"));
      assertTrue(rs.next());
      Assert.assertEquals("@p1",rs.getString("COLUMN_NAME"));
      Assert.assertEquals(DatabaseMetaData.procedureColumnIn,rs.getInt("COLUMN_TYPE"));
      assertTrue(rs.next());
      Assert.assertEquals("@p2",rs.getString("COLUMN_NAME"));
      Assert.assertEquals(DatabaseMetaData.procedureColumnInOut,rs.getInt("COLUMN_TYPE"));
      rs.close();
    }
  }
  finally {
  }
}

public void testProcedureColumns ( ) throws Exception { try { Statement stmt = con . createStatement ( ) ; stmt . execute ( "CREATE PROC jtds_testparam @p1 int, @p2 int output as\r\n" + "BEGIN\r\n" + "  SELECT @p2 = @p1\r\n" + "END" ) ; stmt . close ( ) ; DatabaseMetaData dbmd = con . getMetaData ( ) ; String [ ] columnPatterns = new String [ ] { null , "%" } ; for ( int i = 0 ; i < columnPatterns . length ; i ++ ) { ResultSet rs = dbmd . getProcedureColumns ( null , null , "jtds_testparam" , columnPatterns [ i ] ) ; assertTrue ( rs . next ( ) ) ; Assert . assertEquals ( "@RETURN_VALUE" , rs . getString ( "COLUMN_NAME" ) ) ; Assert . assertEquals ( DatabaseMetaData . procedureColumnReturn , rs . getInt ( "COLUMN_TYPE" ) ) ; assertTrue ( rs . next ( ) ) ; Assert . assertEquals ( "@p1" , rs . getString ( "COLUMN_NAME" ) ) ; Assert . assertEquals ( DatabaseMetaData . procedureColumnIn , rs . getInt ( "COLUMN_TYPE" ) ) ; assertTrue ( rs . next ( ) ) ; Assert . assertEquals ( "@p2" , rs . getString ( "COLUMN_NAME" ) ) ; Assert . assertEquals ( DatabaseMetaData . procedureColumnInOut , rs . getInt ( "COLUMN_TYPE" ) ) ; rs . close ( ) ; } } finally { } }
test for bug [ 1184376 ] sybase getprocedurecolumns bug
