question: public List < Object [ ] > readAllSubkeyed ( Connection connection , Object [ ] keys ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( "select " ) ; String delimiter = "" ; for ( String keyField : keyFieldNames ) { builder . append ( delimiter ) ; builder . append ( keyField ) ; delimiter = "," ; } for ( String valueField : valueFieldNames ) { builder . append ( delimiter ) ; builder . append ( valueField ) ; delimiter = "," ; } builder . append ( " from " ) ; builder . append ( tableName ) ; builder . append ( " where " ) ; delimiter = "" ; for ( int i = 0 ; i < keys . length ; i ++ ) { builder . append ( delimiter ) ; builder . append ( keyFieldNames [ i ] ) ; builder . append ( "=?" ) ; delimiter = " and " ; } String query = builder . toString ( ) ; PreparedStatement statement = null ; try { if ( ( ExecutionPathDebugLog . isDebugEnabled ) && ( log . isDebugEnabled ( ) ) ) { log . debug ( "Executing query '" + query + "' for keys '" + print ( keys ) + "'" ) ; } statement = connection . prepareStatement ( query ) ; for ( int i = 0 ; i < keys . length ; i ++ ) { statement . setObject ( i + 1 , keys [ i ] ) ; } ResultSet rs = statement . executeQuery ( ) ; if ( ! rs . next ( ) ) { return Collections . EMPTY_LIST ; } List < Object [ ] > result = new ArrayList < Object [ ] > ( ) ; do { Object [ ] row = new Object [ keyFieldNames . length + valueFieldNames . length ] ; int index = 0 ; for ( int i = 0 ; i < keyFieldNames . length ; i ++ ) { row [ index ] = DBUtil . getValue ( rs , index + 1 , keyTypes [ i ] ) ; index ++ ; } for ( int i = 0 ; i < valueFieldNames . length ; i ++ ) { row [ index ] = DBUtil . getValue ( rs , index + 1 , valueTypes [ i ] ) ; index ++ ; } result . add ( row ) ; } while ( rs . next ( ) ) ; return result ; } catch ( SQLException ex ) { String message = "Failed to invoke : " + query + " :" + ex . getMessage ( ) ; log . error ( message , ex ) ; storeExceptionHandler . handle ( message , ex ) ; throw new StoreExceptionDBRel ( message , ex ) ; } finally { try { if ( statement != null ) statement . close ( ) ; } catch ( SQLException e ) { } } }
target:  Read all rows starting with the key values supplied, key value must start at the first and can between the 1st and last key.