private StringBuffer prepareOptimizedDeleteStatement(OneRowChange oneRowChange,String keyName){
  StringBuffer stmt=new StringBuffer();
  stmt.append("DELETE FROM ");
  stmt.append(conn.getDatabaseObjectName(oneRowChange.getSchemaName()) + "." + conn.getDatabaseObjectName(oneRowChange.getTableName()));
  stmt.append(" WHERE ");
  stmt.append(conn.getDatabaseObjectName(keyName));
  stmt.append(" IN (");
  ArrayList<ArrayList<ColumnVal>> values=oneRowChange.getKeyValues();
  ArrayList<ColumnSpec> keySpec=oneRowChange.getKeySpec();
  boolean firstRow=true;
  for (  ArrayList<ColumnVal> oneKeyValues : values) {
    if (firstRow)     firstRow=false;
 else     stmt.append(", ");
    printColumnSpec(stmt,keySpec,null,oneKeyValues,PrintMode.PLACE_HOLDER," , ");
  }
  stmt.append(")");
  return stmt;
}

private StringBuffer prepareOptimizedDeleteStatement ( OneRowChange oneRowChange , String keyName ) { StringBuffer stmt = new StringBuffer ( ) ; stmt . append ( "DELETE FROM " ) ; stmt . append ( conn . getDatabaseObjectName ( oneRowChange . getSchemaName ( ) ) + "." + conn . getDatabaseObjectName ( oneRowChange . getTableName ( ) ) ) ; stmt . append ( " WHERE " ) ; stmt . append ( conn . getDatabaseObjectName ( keyName ) ) ; stmt . append ( " IN (" ) ; ArrayList < ArrayList < ColumnVal > > values = oneRowChange . getKeyValues ( ) ; ArrayList < ColumnSpec > keySpec = oneRowChange . getKeySpec ( ) ; boolean firstRow = true ; for ( ArrayList < ColumnVal > oneKeyValues : values ) { if ( firstRow ) firstRow = false ; else stmt . append ( ", " ) ; printColumnSpec ( stmt , keySpec , null , oneKeyValues , PrintMode . PLACE_HOLDER , " , " ) ; } stmt . append ( ")" ) ; return stmt ; }
create statement for optimized delete .
