From f880ae15d5657c7beb0a45e762d8947db7c84d2c Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 14 Jan 2022 20:34:24 +0100 Subject: [PATCH] [jOOQ/jOOQ#7284] Some trivial predicate transform patterns --- .../org/jooq/impl/DefaultRenderContext.java | 257 -------------- .../java/org/jooq/impl/TransformPatterns.java | 334 ++++++++++++++++++ 2 files changed, 334 insertions(+), 257 deletions(-) create mode 100644 jOOQ/src/main/java/org/jooq/impl/TransformPatterns.java diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultRenderContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultRenderContext.java index 23522a0eff..bb4b6ff06f 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultRenderContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultRenderContext.java @@ -37,15 +37,11 @@ */ package org.jooq.impl; -import static java.lang.Boolean.FALSE; import static java.lang.Boolean.TRUE; // ... import static org.jooq.SQLDialect.SQLITE; import static org.jooq.conf.ParamType.INLINED; import static org.jooq.conf.SettingsTools.renderLocale; -import static org.jooq.impl.DSL.falseCondition; -import static org.jooq.impl.DSL.trim; -import static org.jooq.impl.DSL.trueCondition; import static org.jooq.impl.Identifiers.QUOTES; import static org.jooq.impl.Identifiers.QUOTE_END_DELIMITER; import static org.jooq.impl.Identifiers.QUOTE_END_DELIMITER_ESCAPED; @@ -60,28 +56,22 @@ import java.util.Arrays; import java.util.Deque; import java.util.HashSet; import java.util.List; -import java.util.Objects; import java.util.Set; import java.util.regex.Pattern; import org.jooq.BindContext; -import org.jooq.Condition; import org.jooq.Configuration; import org.jooq.Constants; -import org.jooq.False; import org.jooq.Field; import org.jooq.ForeignKey; import org.jooq.Param; -// ... import org.jooq.Query; import org.jooq.QueryPart; import org.jooq.QueryPartInternal; import org.jooq.RenderContext; -// ... import org.jooq.SQLDialect; import org.jooq.Select; import org.jooq.Table; -import org.jooq.True; import org.jooq.conf.RenderFormatting; import org.jooq.conf.RenderKeywordCase; import org.jooq.conf.RenderNameCase; @@ -90,30 +80,10 @@ import org.jooq.conf.Settings; import org.jooq.conf.SettingsTools; import org.jooq.exception.ControlFlowSignal; import org.jooq.exception.DataAccessException; -import org.jooq.impl.QOM.And; -import org.jooq.impl.QOM.BitNot; -import org.jooq.impl.QOM.Eq; -import org.jooq.impl.QOM.FieldCondition; -import org.jooq.impl.QOM.Ge; -import org.jooq.impl.QOM.Gt; -import org.jooq.impl.QOM.IsNotDistinctFrom; -import org.jooq.impl.QOM.Le; -import org.jooq.impl.QOM.Lt; -import org.jooq.impl.QOM.Ltrim; -import org.jooq.impl.QOM.Ne; -import org.jooq.impl.QOM.Neg; -import org.jooq.impl.QOM.Not; -import org.jooq.impl.QOM.Or; -import org.jooq.impl.QOM.Rtrim; -import org.jooq.impl.QOM.Trim; -import org.jooq.impl.QOM.Upper; -import org.jooq.impl.QOM.Val; import org.jooq.impl.ScopeMarker.ScopeContent; import org.jooq.tools.JooqLogger; import org.jooq.tools.StringUtils; -import org.jetbrains.annotations.NotNull; - /** * @author Lukas Eder */ @@ -816,233 +786,6 @@ class DefaultRenderContext extends AbstractContext implements Ren } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - private final void checkForceInline(int max) throws ForceInlineSignal { if (bindValues.size() > max) if (TRUE.equals(data(DATA_COUNT_BIND_VALUES))) diff --git a/jOOQ/src/main/java/org/jooq/impl/TransformPatterns.java b/jOOQ/src/main/java/org/jooq/impl/TransformPatterns.java new file mode 100644 index 0000000000..c4d080c05a --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/TransformPatterns.java @@ -0,0 +1,334 @@ +/* + * 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; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +