src/com/holub/database/DistinctSelect.java
/**
	 * add distinct selecting from parent's result table
	 * @return Table
	 */
add distinct selecting from parent's result table
@return Table
add distinct selecting from parent ' s result table @return Table
@Override
	public Table doSelect() {
		Table table = super.selectAlgorithm.doSelect();
		String[] columnNames = null;
		columnNames = new String[table.rows().columnCount()];
		for(int i = 0; i < table.rows().columnCount(); i++) 
			columnNames[i] = table.rows().columnName(i);
		Table resultTable = new ConcreteTable(null, columnNames);
		Set<String> rowSet = new HashSet<>();
		Cursor current = table.rows();
		while (current.advance()) {
			Object[] values = new Object[columnNames.length];
			StringBuilder sb = new StringBuilder();
			for(int i = 0; i < columnNames.length; i++) {
				Object item = current.column(columnNames[i]);				
				values[i] = item;
				sb.append(String.valueOf(item));
			}
			if(!rowSet.contains(sb.toString())) {
				rowSet.add(sb.toString());
				resultTable.insert(values);
			}
		}
		return new UnmodifiableTable(resultTable);
	}
@ Override public Table doSelect ( ) { Table table = super . selectAlgorithm . doSelect ( ) ; String [ ] columnNames = null ; columnNames = new String [ table . rows ( ) . columnCount ( ) ] ; for ( int i = 0 ; i < table . rows ( ) . columnCount ( ) ; i ++ ) columnNames [ i ] = table . rows ( ) . columnName ( i ) ; Table resultTable = new ConcreteTable ( null , columnNames ) ; Set < String > rowSet = new HashSet < > ( ) ; Cursor current = table . rows ( ) ; while ( current . advance ( ) ) { Object [ ] values = new Object [ columnNames . length ] ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < columnNames . length ; i ++ ) { Object item = current . column ( columnNames [ i ] ) ; values [ i ] = item ; sb . append ( String . valueOf ( item ) ) ; } if ( ! rowSet . contains ( sb . toString ( ) ) ) { rowSet . add ( sb . toString ( ) ) ; resultTable . insert ( values ) ; } } return new UnmodifiableTable ( resultTable ) ; }
add distinct selecting from parent's result table
 @return Table
add distinct selecting from parent ' s result table @return Table
// TODO Auto-generated method stub