Код:
public void execute( Setup setup, ConnectionSet connectionSet )
throws Exception
{
print("Start");
Connection con = connectionSet.getConnection();
//
ContractRemover cr = new ContractRemover( setup, con, null );
long timeStart = System.currentTimeMillis();
// удаление ранее загруженных договоров
String query = "SELECT id FROM contract WHERE gr & (1<<?) != 0";
PreparedStatement ps = con.prepareStatement( query );
ps.setInt( 1, LOADED_GROUP );
ResultSet rs = ps.executeQuery();
int count = 0;
while ( rs.next() )
{
cr.deleteContract( rs.getInt( 1 ) );
++count;
}
ps.close();
print( "Removed " + count + " contracts..." );
long timeEnd = System.currentTimeMillis();
print( "Process time: " + (timeEnd - timeStart)/1000 + " s." );
}