Hi,

Predicates involving tuples are currently not supported by jOOQ. There
are some related pending feature requests on the roadmap with high
chances of being implemented in jOOQ 3.0 by the end of 2012:

https://github.com/jOOQ/jOOQ/issues/1058
https://github.com/jOOQ/jOOQ/issues/1583

I'm currently not sure how to best add tuple support in jOOQ. An idea
would be to follow suit with Scala, which has some native tuple
classes / traits up to the arity of 22. With the Scala compiler's
powerful type inferring capabilities, tuples are easier to handle
formally and nice to use in client code. The same accounts for C#,
which natively supports arities of up to 8:
http://msdn.microsoft.com/en-us/library/system.tuple.aspx

This would lead to jOOQ's typesafely using tuples as such:

    .select()
    .from(A)
    .where(tuple(A.A, A.B).in(tuple("a1", "b1"), tuple("a2", "b2")));

With

    Field<Tuple2<String, String>> left = tuple(A.A, A.B);
    Field<Tuple2<String, String>> right = tuple("a1", "b1");

"tuple" being a "heavily" overloaded Factory method:

    public static <T1> Field<Tuple1<T1>> tuple(T1 t1);
    public static <T1> Field<Tuple1<T1>> tuple(Field<T1> t1);
    public static <T1, T2> Field<Tuple2<T1, T2>> tuple(T1 t1, T2 t2);
    public static <T1, T2> Field<Tuple2<T1, T2>> tuple(Field<T1> t1,
Field<T2> t2);
    public static <T1, T2, T3> Field<Tuple3<T1, T2, T3>> tuple(T1 t1,
T2 t2, T3 t3);
    public static <T1, T2, T3> Field<Tuple3<T1, T2, T3>>
tuple(Field<T1> t1, Field<T2> t2, Field<T3> t3);

This looks like the way to go, so far. What I'm currently uncertain
about is the fact whether Tuple1, Tuple2, Tuple3, ... TupleN types
should influence the Record type

Any other ideas?

Reply via email to