public QueryParameters update ( int index , QueryParameters params ) throws SQLException { AssertUtils . assertNotNull ( params , "Element cannot be null, but values inside of it - can" ) ; if ( this . type == Type . READ_ONLY_FORWARD || this . type == Type . READ_ONLY_SCROLL ) { throw new MjdbcSQLException ( "This Lazy query output cache is initialized as read-only - therefore cannot be updated." ) ; } QueryParameters result = get ( index ) ; if ( this . type == Type . UPDATE_FORWARD ) { if ( this . currentIndex == index ) { updateResultSetCurrentLine ( getCurrentResultSet ( ) , params ) ; } else if ( this . currentIndex + 1 == index ) { updateResultSetRow ( ( index + 1 ) - generatedCacheMap . size ( ) , params ) ; } else { throw new MjdbcRuntimeException ( "Only current/next element can be updated!" ) ; } getCurrentResultSet ( ) . updateRow ( ) ; this . currentIndex = index ; } else if ( this . type == Type . UPDATE_SCROLL ) { updateResultSetRow ( ( index + 1 ) - generatedCacheMap . size ( ) , params ) ; getCurrentResultSet ( ) . updateRow ( ) ; } else { throw new MjdbcSQLException ( "This Lazy query output cache was initialized with unknown type" ) ; } return result ; }
Updates specified row in ResultSet