> So, basic tuple support has high chances of making it into jOOQ 2.6.0 I have played around with tuple support in jOOQ and committed an initial version to GitHub: https://github.com/jOOQ/jOOQ/commit/69a23ecb0da94cf2711b54e44000358462626a03
It includes - Formal specifications for Tuple1<T1>, Tuple2<T1, T2>, ..., Tuple8<T1, ..., T8> and TupleN (without generics). A type-checked arity of 8 should be sufficient for most use-cases. Higher arities are still supported, without type-checking. This aligns well with what .NET does for C#, C++, F# and VB - Various overloaded Condition constructors in all tuple types, e.g. Tuple2.equal(T1, T2), Tuple3.notEqual(Tuple3<T1, T2, T3>). These methods mimick their equivalent counterparts in org.jooq.Field - Factory constructors for tuples Initial integration test case: https://github.com/jOOQ/jOOQ/blob/69a23ecb0da94cf2711b54e44000358462626a03/jOOQ-test/src/org/jooq/test/_/testcases/TupleTests.java A sample Tuple of arity 3: https://github.com/jOOQ/jOOQ/blob/69a23ecb0da94cf2711b54e44000358462626a03/jOOQ/src/main/java/org/jooq/Tuple3.java Tuple[X] types are incompatible with Field types. This will lead to a cleaner and more expressive API that can express dedicated and specific behaviour for tuples. For instance, it makes no sense to calculate sin(), tan() atan2() values for tuples. Instead, the simulation of tuple predicates can be implemented, if a database does not support tuples. For example: (A, B) = (1, 2) (A, B) IN ((1, 2), (3, 4)) Can be expressed as A = 1 AND B = 2 (A = 1 AND B = 2) OR (A = 3 AND B = 4) More sophisticated tuple expressions such as (A, B) <= (1, 2), or (SELECT A, B FROM DUAL) = (SELECT 1, 2 FROM DUAL) will be explored later on. Also, the API of UPDATE and MERGE statements will be enhanced to support tuple expressions. Additionally, arity-specific relational operators, such as the OVERLAPS operator can be supported specifically for Tuple2 types (as supported by Postgres): (start1, end1) OVERLAPS (start2, end2) (start1, length1) OVERLAPS (start2, length2) The above can be simulated as start2 <= end1 AND start1 <= end2 start2 <= start1 + length1 AND start1 <= start2 + length2 Stay tuned for an exciting jOOQ 2.6.0!
