use of org.jooq.impl.QOM.JSONOnNull in project jOOQ by jOOQ.
the class DefaultParseContext method parseJSONObjectAggFunctionIf.
private final AggregateFilterStep<?> parseJSONObjectAggFunctionIf() {
boolean jsonb = false;
if (parseFunctionNameIf("JSON_OBJECTAGG", "JSON_OBJECT_AGG", "JSON_GROUP_OBJECT") || (jsonb = parseFunctionNameIf("JSONB_OBJECT_AGG"))) {
AggregateFilterStep<?> result;
JSONObjectAggNullStep<?> s1;
JSONObjectAggReturningStep<?> s2;
JSONOnNull onNull;
DataType<?> returning;
parse('(');
result = s2 = s1 = jsonb ? jsonbObjectAgg(parseJSONEntry()) : jsonObjectAgg(parseJSONEntry());
if ((onNull = parseJSONNullTypeIf()) != null)
result = s2 = onNull == ABSENT_ON_NULL ? s1.absentOnNull() : s1.nullOnNull();
if ((returning = parseJSONReturningIf()) != null)
result = s2.returning(returning);
parse(')');
return result;
}
return null;
}
use of org.jooq.impl.QOM.JSONOnNull in project jOOQ by jOOQ.
the class DefaultParseContext method parseFieldJSONArrayConstructorIf.
private final Field<?> parseFieldJSONArrayConstructorIf() {
boolean jsonb = false;
if (parseFunctionNameIf("JSON_ARRAY", "JSON_BUILD_ARRAY") || (jsonb = parseFunctionNameIf("JSONB_BUILD_ARRAY"))) {
parse('(');
if (parseIf(')'))
return jsonb ? jsonbArray() : jsonArray();
List<Field<?>> result = null;
JSONOnNull onNull = parseJSONNullTypeIf();
DataType<?> returning = parseJSONReturningIf();
if (onNull == null && returning == null) {
result = parseList(',', c -> c.parseField());
onNull = parseJSONNullTypeIf();
returning = parseJSONReturningIf();
}
parse(')');
JSONArrayNullStep<?> s1 = result == null ? jsonb ? jsonbArray() : jsonArray() : jsonb ? jsonbArray(result) : jsonArray(result);
JSONArrayReturningStep<?> s2 = onNull == NULL_ON_NULL ? s1.nullOnNull() : onNull == ABSENT_ON_NULL ? s1.absentOnNull() : s1;
return returning == null ? s2 : s2.returning(returning);
}
return null;
}
use of org.jooq.impl.QOM.JSONOnNull in project jOOQ by jOOQ.
the class DefaultParseContext method parseJSONArrayAggFunctionIf.
private final AggregateFilterStep<?> parseJSONArrayAggFunctionIf() {
boolean jsonb = false;
if (parseFunctionNameIf("JSON_ARRAYAGG", "JSON_AGG", "JSON_GROUP_ARRAY") || (jsonb = parseFunctionNameIf("JSONB_AGG"))) {
AggregateFilterStep<?> result;
JSONArrayAggOrderByStep<?> s1;
JSONArrayAggNullStep<?> s2;
JSONArrayAggReturningStep<?> s3;
JSONOnNull onNull;
DataType<?> returning;
parse('(');
result = s3 = s2 = s1 = jsonb ? jsonbArrayAgg(parseField()) : jsonArrayAgg(parseField());
if (parseKeywordIf("ORDER BY"))
result = s3 = s2 = s1.orderBy(parseList(',', c -> c.parseSortField()));
if ((onNull = parseJSONNullTypeIf()) != null)
result = s3 = onNull == ABSENT_ON_NULL ? s2.absentOnNull() : s2.nullOnNull();
if ((returning = parseJSONReturningIf()) != null)
result = s3.returning(returning);
parse(')');
return result;
}
return null;
}
use of org.jooq.impl.QOM.JSONOnNull in project jOOQ by jOOQ.
the class DefaultParseContext method parseFieldJSONObjectConstructorIf.
private final Field<?> parseFieldJSONObjectConstructorIf() {
boolean jsonb = false;
if (parseFunctionNameIf("JSON_OBJECT", "JSON_BUILD_OBJECT") || (jsonb = parseFunctionNameIf("JSONB_BUILD_OBJECT"))) {
parse('(');
if (parseIf(')'))
return jsonb ? jsonbObject() : jsonObject();
List<JSONEntry<?>> result;
JSONOnNull onNull = parseJSONNullTypeIf();
DataType<?> returning = parseJSONReturningIf();
if (onNull == null && returning == null) {
result = parseList(',', c -> parseJSONEntry());
onNull = parseJSONNullTypeIf();
returning = parseJSONReturningIf();
} else
result = new ArrayList<>();
parse(')');
JSONObjectNullStep<?> s1 = jsonb ? jsonbObject(result) : jsonObject(result);
JSONObjectReturningStep<?> s2 = onNull == NULL_ON_NULL ? s1.nullOnNull() : onNull == ABSENT_ON_NULL ? s1.absentOnNull() : s1;
return returning == null ? s2 : s2.returning(returning);
}
return null;
}
Aggregations