db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Vandahl ...@apache.org>
Subject Re: Criterions which do not reference a column
Date Tue, 03 Apr 2012 19:08:27 GMT
Am 03.04.2012 05:29, schrieb Thomas Fox:
> I have the following ideas to implement this:
> 1)  Change the criteria.Criteria interface from
>    and(String column, Object value)
>    and(Column column, Object value)
>    and(String column, Object value, SqlEnum comparison)
>    and(Column column, Object value, SqlEnum comparison)
> to
>    and (Object lhs, Object rhs)
>    and (Object lhs, Object rhs, SqlEnum comparison)

I like this idea for it is simple and intuitive. What I don't like are 
methods that take objects because they have no compile-time type 
checking. My suggestion would be to consider generics like so:

public <L, R> and(L lhs, R rhs)

I didn't think this through completely but do you think this could work?

> P.S. to care for other such cases which are not covered by the above, I
> intend to add the methods
>    andCustom(String query, Object[] preparedStatementReplacements)
> and
>    orCustom(String query, Object[] preparedStatementReplacements)
> so one can also create custom criterions which use prepared statement
> replacement. Any objections on this ?

Looks reasonable to me, go ahead.

Bye, Thomas.

To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message