MCPcopy
hub / github.com/jOOQ/jOOQ / delegate

Method delegate

jOOQ/src/main/java/org/jooq/impl/QuantifiedArray.java:110–169  ·  view source on GitHub ↗
(Context<?> ctx)

Source from the content-addressed store, hash-verified

108 }
109
110 private final QueryPart delegate(Context<?> ctx) {
111 if (array instanceof QOM.Array<T> a) {
112 switch (ctx.family()) {
113
114 // [#869] Postgres supports this syntax natively
115
116
117 case POSTGRES:
118 case YUGABYTEDB:
119 return array;
120
121 default: {
122 Select<Record1<T>> select = null;
123
124 for (Field<T> value : a.$elements())
125 if (select == null)
126 select = select(value);
127 else
128 select = select.unionAll(select(value));
129
130 return select;
131 }
132 }
133 }
134 else {
135 switch (ctx.family()) {
136
137 // [#869] Postgres supports this syntax natively
138
139
140 case POSTGRES:
141 case YUGABYTEDB:
142 if (array instanceof Param && array.getDataType().getArrayBaseDataType().isEmbeddable())
143 return paramToSelect((Param<? extends Object[]>) array);
144 else
145 return array;
146
147 // [#869] H2 and HSQLDB can emulate this syntax by unnesting
148 // the array in a subselect
149 case H2:
150 case HSQLDB:
151 if (array instanceof Param && array.getDataType().getArrayBaseDataType().isEmbeddable())
152 return paramToSelect((Param<? extends Object[]>) array);
153 else
154 return select().from(table(array));
155
156 // [#1048] All other dialects emulate unnesting of arrays using
157 // UNION ALL-connected subselects
158 default: {
159
160 // The Informix database has an interesting bug when quantified comparison predicates
161 // use nested derived tables with UNION ALL
162 if (array instanceof Param)
163 return paramToSelect((Param<? extends Object[]>) array);
164 else
165 return select().from(table(array));
166 }
167 }

Callers 1

acceptMethod · 0.95

Calls 10

paramToSelectMethod · 0.95
familyMethod · 0.65
$elementsMethod · 0.65
selectMethod · 0.65
unionAllMethod · 0.65
isEmbeddableMethod · 0.65
getArrayBaseDataTypeMethod · 0.65
getDataTypeMethod · 0.65
fromMethod · 0.65
tableMethod · 0.65

Tested by

no test coverage detected