From 549eb19ef4f55a7d9d0dd7f44bf20f8f1eb148c8 Mon Sep 17 00:00:00 2001
From: Lukas Eder
Date: Thu, 30 Aug 2012 20:14:51 +0200
Subject: [PATCH] Documented tuples in the manual
---
.../src/main/resources/manual-2.6.xml | 40 +++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/jOOQ-website/src/main/resources/manual-2.6.xml b/jOOQ-website/src/main/resources/manual-2.6.xml
index 89b96981ff..1690dbddd1 100644
--- a/jOOQ-website/src/main/resources/manual-2.6.xml
+++ b/jOOQ-website/src/main/resources/manual-2.6.xml
@@ -2808,6 +2808,11 @@ new Factory(SQLDialect.SYBASE ).selectOne().getSQL();]]>
Column expressions
+
+ Column expressions can be used in various SQL clauses in order to refer to one or several columns. This chapter explains how to form various types of column expressions with jOOQ. A particular type of column expression is given in the section about , where an expression may have a degree of more than one.
+
+
+ Using column expressions in jOOQ
jOOQ allows you to freely create arbitrary column expressions using a fluent expression construction API. Many expressions can be formed as functions from , other expressions can be formed based on a pre-existing column expression. For example:
@@ -3820,6 +3825,36 @@ create.insertInto(AUTHOR, AUTHOR.ID, AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME)
+
+
+ Tuples or row value expressions
+
+
+ According to the SQL standard, row value expressions can have a degree of more than one. This is commonly used in the , where the VALUES row value constructor allows for providing a row value expression as a source for INSERT data. Row value expressions can appear in various other places, though. They are supported by jOOQ as tuples. jOOQ's allows for the construction of type-safe tuples up to the degree / arity of 8. Higher-degree tuples are supported as well, but without any type-safety. Tuple types are modelled as follows:
+
+
+ Tuple1 tuple(T1 t1) { ... }
+public static Tuple2 tuple(T1 t1, T2 t2) { ... }
+public static Tuple3 tuple(T1 t1, T2 t2, T3 t3) { ... }
+public static Tuple4 tuple(T1 t1, T2 t2, T3 t3, T4 t4) { ... }
+
+// [ ... idem for Tuple5, Tuple6, Tuple7, Tuple8 ... ]
+
+// Degrees of more than 8 are supported without type-safety
+public static TupleN tuple(Object... values) { ... }]]>
+
+ Using tuples in predicates
+
+ Tuples are incompatible with most other , but they can be used as a basis for constructing various , such as , , or the "degree 2 tuple-only" . See the relevant sections for more details about how to use tuples in predicates.
+
+
+ Using tuples in UPDATE statements
+
+ The also supports a variant where tuples are updated, rather than single columns. See the relevant section for more details
+
+
+
@@ -4321,6 +4356,11 @@ notExists(create.selectOne().from(BOOK)
+
+