[jOOQ/jOOQ#14046] Add support for MySQL's JSON_KEYS()

- Oracle support
This commit is contained in:
Lukas Eder 2022-09-30 17:35:08 +02:00
parent 5ead6c7585
commit 364c970963
5 changed files with 130 additions and 7 deletions

View File

@ -2267,13 +2267,6 @@ implements
name = null;
for (Parameter<?> parameter : getInParameters0(ctx.configuration())) {

View File

@ -105,6 +105,14 @@ implements
ctx.visit(DSL.field(select(DSL.coalesce(jsonbArrayAgg(DSL.field(unquotedName("j"))), jsonbArray())).from("jsonb_object_keys({0}) as j(j)", field)));
break;
case SQLITE:
ctx.visit(DSL.field(select(jsonbArrayAgg(DSL.field(name("key")))).from("json_each({0})", field)));
break;

View File

@ -98,6 +98,11 @@ implements
case YUGABYTEDB:
return false;
case SQLITE:
return false;
@ -122,6 +127,14 @@ implements
ctx.visit(DSL.field(select(DSL.coalesce(jsonArrayAgg(DSL.field(unquotedName("j"))), jsonArray())).from("json_object_keys({0}) as j(j)", field)));
break;
case SQLITE:
ctx.visit(DSL.field(select(jsonArrayAgg(DSL.field(name("key")))).from("json_each({0})", field)));
break;

View File

@ -0,0 +1,82 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Other licenses:
* -----------------------------------------------------------------------------
* Commercial licenses for this work are available. These replace the above
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
* database integrations.
*
* For more information, please visit: http://www.jooq.org/licenses
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.jooq.impl;

View File

@ -38,8 +38,13 @@
package org.jooq.impl;
import static org.jooq.impl.CommonTableExpressionList.markTopLevelCteAndAccept;
import static org.jooq.impl.Tools.SimpleDataKey.DATA_TOP_LEVEL_CTE;
import java.util.function.Predicate;
import java.util.function.Supplier;
import org.jooq.Context;
// ...
import org.jooq.QueryPart;
import org.jooq.impl.ScopeMarker.ScopeContent;
@ -59,4 +64,26 @@ final class TopLevelCte extends QueryPartList<QueryPart> implements ScopeContent
public final boolean declaresCTE() {
return true;
}
}