public static void delete ( CallInfo callInfo , DataSet data ) { Table table = asTable ( data . getSource ( ) ) ; List < String > keyColumns = table . getKeyColumns ( ) ; if ( keyColumns . isEmpty ( ) ) { throw new InvalidOperationException ( "No key columns defined." ) ; } List < String > tableColumns = table . getColumns ( ) ; int param = 0 ; int [ ] paramIdx = new int [ tableColumns . size ( ) ] ; Iterator < String > itr = keyColumns . iterator ( ) ; StringBuilder sql = new StringBuilder ( ) ; String kcol = itr . next ( ) ; paramIdx [ tableColumns . indexOf ( kcol ) ] = ++ param ; sql . append ( DELETE_FROM_ ) . append ( table . getName ( ) ) . append ( WHERE_ ) . append ( kcol ) . append ( "=?" ) ; while ( itr . hasNext ( ) ) { kcol = itr . next ( ) ; paramIdx [ tableColumns . indexOf ( kcol ) ] = ++ param ; sql . append ( AND_ ) . append ( kcol ) . append ( "=?" ) ; } table . setDirtyStatus ( true ) ; dataSetOperation ( callInfo , table , data , sql . toString ( ) , paramIdx ) ; }
Delete rows from data set .