diff --git a/jOOQ-examples/jOOQ-spring-boot-example/pom.xml b/jOOQ-examples/jOOQ-spring-boot-example/pom.xml index d9b1ec4683..1301e5a077 100644 --- a/jOOQ-examples/jOOQ-spring-boot-example/pom.xml +++ b/jOOQ-examples/jOOQ-spring-boot-example/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.6.RELEASE + 2.0.2.RELEASE org.jooq @@ -34,25 +34,6 @@ org.springframework.boot spring-boot-starter-jooq - - - - - org.jooq - jooq - - - - - - - org.jooq - jooq - ${jooq.version} @@ -140,7 +121,6 @@ org.jooq jooq-codegen-maven - ${jooq.version} @@ -177,6 +157,13 @@ + + + com.h2database + h2 + ${h2.version} + + diff --git a/jOOQ/src/main/java/org/jooq/Field.java b/jOOQ/src/main/java/org/jooq/Field.java index ee641853d2..a460b39bfd 100644 --- a/jOOQ/src/main/java/org/jooq/Field.java +++ b/jOOQ/src/main/java/org/jooq/Field.java @@ -1658,9 +1658,71 @@ extends @Support LikeEscapeStep likeAny(Collection values); + /** + * Create a condition to negatively pattern-check this field against any element in an array of values. + *

+ * SQL: (this not like value0 or this not like value1 or ...) + * + * @see LikeEscapeStep#escape(char) + */ + @Support + LikeEscapeStep notLikeAny(String... values); + + /** + * Create a condition to negatively pattern-check this field against any element in an array of values. + *

+ * SQL: (this not like value0 or this not like value1 or ...) + * + * @see LikeEscapeStep#escape(char) + */ + @Support + @SuppressWarnings("unchecked") + LikeEscapeStep notLikeAny(Field... fields); + + /** + * Create a condition to negatively pattern-check this field against any element in an array of values. + *

+ * SQL: (this not like value0 or this not like value1 or ...) + * + * @see LikeEscapeStep#escape(char) + */ + @Support + LikeEscapeStep notLikeAny(Collection values); + /** * Create a condition to pattern-check this field against all elements in an array of values. *

+ * SQL: (this like value0 and this like value1 and ...) + * + * @see LikeEscapeStep#escape(char) + */ + @Support + LikeEscapeStep likeAll(String... values); + + /** + * Create a condition to pattern-check this field against all elements in an array of fields. + *

+ * SQL: (this like field0 and this like field1 and ...) + * + * @see LikeEscapeStep#escape(char) + */ + @Support + @SuppressWarnings("unchecked") + LikeEscapeStep likeAll(Field... fields); + + /** + * Create a condition to pattern-check this field against all elements in a collection of fields or values. + *

+ * SQL: (this like field0 and this like field1 and ...) + * + * @see LikeEscapeStep#escape(char) + */ + @Support + LikeEscapeStep likeAll(Collection values); + + /** + * Create a condition to negatively pattern-check this field against all elements in an array of values. + *

* SQL: (this not like value0 and this not like value1 and ...) * * @see LikeEscapeStep#escape(char) @@ -1669,7 +1731,7 @@ extends LikeEscapeStep notLikeAll(String... values); /** - * Create a condition to pattern-check this field against all elements in an array of fields. + * Create a condition to negatively pattern-check this field against all elements in an array of fields. *

* SQL: (this not like field0 and this not like field1 and ...) * @@ -1680,7 +1742,7 @@ extends LikeEscapeStep notLikeAll(Field... fields); /** - * Create a condition to pattern-check this field against all elements in a collection of fields or values. + * Create a condition to negatively pattern-check this field against all elements in a collection of fields or values. *

* SQL: (this not like field0 and this not like field1 and ...) * diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractField.java b/jOOQ/src/main/java/org/jooq/impl/AbstractField.java index 04a505e1af..1ea86249d5 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractField.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractField.java @@ -868,6 +868,38 @@ abstract class AbstractField extends AbstractNamed implements Field { return new CombinedCompareCondition(this, LIKE, Quantifier.ANY, Tools.fields(values, SQLDataType.VARCHAR)); } + @Override + public final LikeEscapeStep notLikeAny(String... values) { + return notLikeAny(Tools.fields(values)); + } + + @Override + @SuppressWarnings("unchecked") + public final LikeEscapeStep notLikeAny(Field... fields) { + return notLikeAny(Arrays.asList(fields)); + } + + @Override + public final LikeEscapeStep notLikeAny(Collection values) { + return new CombinedCompareCondition(this, NOT_LIKE, Quantifier.ANY, Tools.fields(values, SQLDataType.VARCHAR)); + } + + @Override + public final LikeEscapeStep likeAll(String... values) { + return likeAll(Tools.fields(values)); + } + + @Override + @SuppressWarnings("unchecked") + public final LikeEscapeStep likeAll(Field... fields) { + return likeAll(Arrays.asList(fields)); + } + + @Override + public final LikeEscapeStep likeAll(Collection values) { + return new CombinedCompareCondition(this, LIKE, Quantifier.ALL, Tools.fields(values, SQLDataType.VARCHAR)); + } + @Override public final LikeEscapeStep notLikeAll(String... values) { return notLikeAll(Tools.fields(values)); diff --git a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java index 57734b309f..5d086c3dbf 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java @@ -4398,7 +4398,7 @@ final class ParserImpl implements Parser { : ((RowN) left).between((RowN) r1, (RowN) r2); } else if (left instanceof Field && parseKeywordIf(ctx, "LIKE")) { - if (!not && parseKeywordIf(ctx, "ANY")) { + if (parseKeywordIf(ctx, "ANY")) { parse(ctx, '('); List> fields = null; if (parseIf(ctx, ')')) @@ -4413,10 +4413,10 @@ final class ParserImpl implements Parser { } boolean escape = parseKeywordIf(ctx, "ESCAPE"); char character = escape ? parseCharacterLiteral(ctx) : ' '; - LikeEscapeStep result = ((Field) left).likeAny(fields); + LikeEscapeStep result = not ? ((Field) left).notLikeAny(fields) : ((Field) left).likeAny(fields); return escape ? result.escape(character) : result; } - else if (not && parseKeywordIf(ctx, "ALL")) { + else if (parseKeywordIf(ctx, "ALL")) { parse(ctx, '('); List> fields = null; if (parseIf(ctx, ')')) @@ -4431,7 +4431,7 @@ final class ParserImpl implements Parser { } boolean escape = parseKeywordIf(ctx, "ESCAPE"); char character = escape ? parseCharacterLiteral(ctx) : ' '; - LikeEscapeStep result = ((Field) left).notLikeAll(fields); + LikeEscapeStep result = not ? ((Field) left).notLikeAll(fields) : ((Field) left).likeAll(fields); return escape ? result.escape(character) : result; } else {