public static List < IdName > getRuntimeParameterValues ( Connection con , QueryParameter qp , Map < String , QueryParameter > map , Map < String , Object > vals ) throws Exception { List < IdName > values = new ArrayList < IdName > ( ) ; if ( qp . isManualSource ( ) ) { QueryExecutor executor = null ; try { Query query = new Query ( qp . getSource ( ) ) ; executor = new QueryExecutor ( query , map , vals , con , false , false , false ) ; executor . setTimeout ( 10000 ) ; executor . setMaxRows ( 0 ) ; QueryResult qr = executor . execute ( ) ; // int count = qr.getRowCount(); // one or two columns in manual select source // for (int i = 0; i < count; i++) { while ( qr . hasNext ( ) ) { IdName in = new IdName ( ) ; in . setId ( ( Serializable ) qr . nextValue ( 0 ) ) ; if ( qr . getColumnCount ( ) == 1 ) { in . setName ( ( Serializable ) qr . nextValue ( 0 ) ) ; } else { in . setName ( ( Serializable ) qr . nextValue ( 1 ) ) ; } values . add ( in ) ; } } catch ( Exception ex ) { ex . printStackTrace ( ) ; throw new Exception ( ex ) ; } finally { if ( executor != null ) { executor . close ( ) ; } } } else { String source = qp . getSource ( ) ; int index = source . indexOf ( "." ) ; int index2 = source . lastIndexOf ( "." ) ; String tableName = source . substring ( 0 , index ) ; String columnName ; String shownColumnName = null ; if ( index == index2 ) { columnName = source . substring ( index + 1 ) ; } else { columnName = source . substring ( index + 1 , index2 ) ; shownColumnName = source . substring ( index2 + 1 ) ; } values = getColumnValues ( con , qp . getSchema ( ) , tableName , columnName , shownColumnName , qp . getOrderBy ( ) ) ; } return values ; }
Get values for a parameter sql at runtime All parent parameters must have the values in the map .