incubator-empire-db-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francis De Brabandere <franci...@gmail.com>
Subject Re: DBCommand.select()
Date Tue, 24 Feb 2009 21:38:31 GMT
and an other one:

Can't all the following methods and more be covered as public void
select(DBColumnExpr...expr) ?

    /**
     * Adds a DBColumnExpr object to the Vector: 'select'.
     *
     * @param expr the DBColumnExpr object
     */
    public void select(DBColumnExpr expr)
    { // Select this column
        if (select == null)
            select = new ArrayList<DBColumnExpr>();
        if (expr != null && select.contains(expr) == false)
            select.add(expr);
    }

    /**
     * This helper function adds two DBColumnExpr objects
     * to the Vector: 'select'
     *
     * @param expr1 the first DBColumnExpr object
     * @param expr2 the second DBColumnExpr object
     */
    public void select(DBColumnExpr expr1, DBColumnExpr expr2)
    {
        select(expr1);
        select(expr2);
    }

    /**
     * This helper function adds three DBColumnExpr objects to the
Vector: 'select'.
     */
    public void select(DBColumnExpr expr1, DBColumnExpr expr2,
DBColumnExpr expr3)
    {
        select(expr1);
        select(expr2);
        select(expr3);
    }

    /**
     * This helper function adds four DBColumnExpr objects to the
Vector: 'select'.
     */
    public void select(DBColumnExpr expr1, DBColumnExpr expr2,
DBColumnExpr expr3, DBColumnExpr expr4)
    {
        select(expr1);
        select(expr2);
        select(expr3);
        select(expr4);
    }

    /**
     * This helper function adds five DBColumnExpr objects
     * to the Vector: 'select'.
     */
    public void select(DBColumnExpr expr1, DBColumnExpr expr2,
DBColumnExpr expr3, DBColumnExpr expr4, DBColumnExpr expr5)
    {
        select(expr1);
        select(expr2);
        select(expr3);
        select(expr4);
        select(expr5);
    }

    /**
     * This helper function adds an array of DBColumnExpr
     * objects to list of select-columns.
     */
    public void select(DBColumnExpr[] exprList)
    {
        for (int i=0; i<exprList.length; i++)
        {
            select(exprList[i]);
        }
    }

On Tue, Feb 24, 2009 at 10:34 PM, Francis De Brabandere
<francisdb@gmail.com> wrote:
> DBCommand has this:
>
>    /**
>     * Adds a list of column expression to the select clause
>     *
>     * @param columns the column expressions to add
>     */
>    public void select(Collection<DBColumnExpr> columns)
>    {
>        for (DBColumnExpr expr : columns)
>            select(expr);
>    }
>
>    /**
>     * Adds a list of column expression to the select clause
>     *
>     * @param columns the column expressions to add
>     */
>    public void select(List<DBColumn> columns)
>    {
>        for (int i = 0; i < columns.size(); i++)
>            select(columns.get(i));
>    }
>
> Why the second select method if the first one is able to handle both?
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
>



-- 
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

Mime
View raw message