@Test public void testDBCommand() { MockDB mock = new MockDB(); mock.open(new MockDriver(), null); List<DBColumn> list = new ArrayList<DBColumn>(); DBCommand command = mock.createCommand(); command.select(list); assertNull(command.getSelectExprList()); List<DBColumnExpr> list2 = new ArrayList<DBColumnExpr>(); list2.add(mock.TABLE.COL1); list2.add(mock.TABLE.COL3); DBCommand command2 = mock.createCommand(); command2.select(list2); assertEquals(2, command2.getSelectExprList().length); DBCommand command3 = mock.createCommand(); command3.select (mock.TABLE.getColumns()); command3.groupBy(mock.TABLE.COL1, mock.TABLE.COL2, mock.TABLE.COL2); assertEquals(3, command3.getSelectExprList().length); assertEquals(2, command3.groupBy.size()); }
protected DBCommand(DBDatabase db) { this.db = db; }
DBCommand extends DBCommandExpr implements Cloneable { protected DBCommand(DBDatabase db) { this.db = db; } }
DBCommand extends DBCommandExpr implements Cloneable { protected DBCommand(DBDatabase db) { this.db = db; } protected  DBCommand(DBDatabase db); }
DBCommand extends DBCommandExpr implements Cloneable { protected DBCommand(DBDatabase db) { this.db = db; } protected  DBCommand(DBDatabase db); @Override DBCommand clone(); @Override DBDatabase getDatabase(); @Override boolean isValid(); boolean isValidQuery(); boolean isValidUpdate(); void selectDistinct(); boolean isSelectDistinct(); void select(DBColumnExpr expr); final void select(DBColumnExpr... exprs); final void select(Collection<? extends DBColumnExpr> columns); void selectQualified(DBColumn... columns); final void selectQualified(Collection<? extends DBColumn> columns); void set(DBSetExpr expr); final void set(DBSetExpr... exprs); DBCmdParam addParam(DataType type, Object value); final DBCmdParam addParam(DBColumnExpr colExpr, Object value); final DBCmdParam addParam(Object value); final DBCmdParam addParam(); void join(DBJoinExpr join); final DBCrossJoinExpr join(DBRowSet left, DBRowSet right); final DBColumnJoinExpr join(DBColumnExpr left, DBColumnExpr right, DBJoinType joinType); final DBColumnJoinExpr join(DBColumnExpr left, DBColumn right); final DBCompareJoinExpr join(DBRowSet rowset, DBCompareExpr cmp, DBJoinType joinType); final DBCompareJoinExpr join(DBRowSet rowset, DBCompareExpr cmp); void addJoins(List<DBJoinExpr> joinExprList); boolean hasJoinOn(DBRowSet rowset); boolean hasConstraintOn(DBRowSet rowset); boolean hasJoinOn(DBColumn column); boolean removeJoinsOn(DBRowSet rowset); boolean removeJoinsOn(DBColumn column); void where(DBCompareExpr expr); final void where(DBCompareExpr... exprs); boolean hasWhereConstraints(); List<DBCompareExpr> getWhereConstraints(); void removeWhereConstraintOn(DBColumnExpr col); List<DBJoinExpr> getJoins(); void addWhereConstraints(List<DBCompareExpr> constraints); void having(DBCompareExpr expr); boolean hasHavingConstraints(); List<DBCompareExpr> getHavingConstraints(); void removeHavingConstraintOn(DBColumnExpr col); void groupBy(DBColumnExpr...exprs); final void groupBy(Collection<? extends DBColumnExpr> columns); boolean hasSelectExpr(); @Override synchronized void getSelect(StringBuilder buf); @Override DBColumnExpr[] getSelectExprList(); void clearSelectDistinct(); void clearSelect(); void clearSet(); void clearJoin(); void clearWhere(); void clearHaving(); void clearGroupBy(); void clear(); @Override void addReferencedColumns(Set<DBColumn> list); @Override Object[] getParamValues(); synchronized String getUpdate(); synchronized String getInsert(); synchronized String getDelete(DBTable table); }
DBCommand extends DBCommandExpr implements Cloneable { protected DBCommand(DBDatabase db) { this.db = db; } protected  DBCommand(DBDatabase db); @Override DBCommand clone(); @Override DBDatabase getDatabase(); @Override boolean isValid(); boolean isValidQuery(); boolean isValidUpdate(); void selectDistinct(); boolean isSelectDistinct(); void select(DBColumnExpr expr); final void select(DBColumnExpr... exprs); final void select(Collection<? extends DBColumnExpr> columns); void selectQualified(DBColumn... columns); final void selectQualified(Collection<? extends DBColumn> columns); void set(DBSetExpr expr); final void set(DBSetExpr... exprs); DBCmdParam addParam(DataType type, Object value); final DBCmdParam addParam(DBColumnExpr colExpr, Object value); final DBCmdParam addParam(Object value); final DBCmdParam addParam(); void join(DBJoinExpr join); final DBCrossJoinExpr join(DBRowSet left, DBRowSet right); final DBColumnJoinExpr join(DBColumnExpr left, DBColumnExpr right, DBJoinType joinType); final DBColumnJoinExpr join(DBColumnExpr left, DBColumn right); final DBCompareJoinExpr join(DBRowSet rowset, DBCompareExpr cmp, DBJoinType joinType); final DBCompareJoinExpr join(DBRowSet rowset, DBCompareExpr cmp); void addJoins(List<DBJoinExpr> joinExprList); boolean hasJoinOn(DBRowSet rowset); boolean hasConstraintOn(DBRowSet rowset); boolean hasJoinOn(DBColumn column); boolean removeJoinsOn(DBRowSet rowset); boolean removeJoinsOn(DBColumn column); void where(DBCompareExpr expr); final void where(DBCompareExpr... exprs); boolean hasWhereConstraints(); List<DBCompareExpr> getWhereConstraints(); void removeWhereConstraintOn(DBColumnExpr col); List<DBJoinExpr> getJoins(); void addWhereConstraints(List<DBCompareExpr> constraints); void having(DBCompareExpr expr); boolean hasHavingConstraints(); List<DBCompareExpr> getHavingConstraints(); void removeHavingConstraintOn(DBColumnExpr col); void groupBy(DBColumnExpr...exprs); final void groupBy(Collection<? extends DBColumnExpr> columns); boolean hasSelectExpr(); @Override synchronized void getSelect(StringBuilder buf); @Override DBColumnExpr[] getSelectExprList(); void clearSelectDistinct(); void clearSelect(); void clearSet(); void clearJoin(); void clearWhere(); void clearHaving(); void clearGroupBy(); void clear(); @Override void addReferencedColumns(Set<DBColumn> list); @Override Object[] getParamValues(); synchronized String getUpdate(); synchronized String getInsert(); synchronized String getDelete(DBTable table);  }