incubator-empire-db-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Döbele <doeb...@esteam.de>
Subject AW: DBCommand.select()
Date Wed, 25 Feb 2009 08:57:49 GMT
Hi Franics,

correct. This is old code that was originally writte for Java 1.2. Some methods have been
altered for Java 5, others haven't.

For the second case:
List<DBColumn> cannot be automatically casted into a Collection<DBColumnExpr>.
So although the implementation is the same it is necessary to have both function signatures.
Although I am not sure whether we could replace List<DBColumn> with Collection<DBColumn>.

If you want you can rewrite the variable args function - or do you prefer me to do it?

Regards
Rainer


Francis De Brabandere
> Re: DBCommand.select()
> 
> 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