diff --git a/jOOQ/src/main/java/org/jooq/Field.java b/jOOQ/src/main/java/org/jooq/Field.java index b3513e67c8..52b8a72785 100644 --- a/jOOQ/src/main/java/org/jooq/Field.java +++ b/jOOQ/src/main/java/org/jooq/Field.java @@ -864,6 +864,12 @@ public interface Field extends GroupField { * Create a condition to check if this field is DISTINCT from * another value. *

+ * In {@link SQLDialect#MYSQL} and {@link SQLDialect#MARIADB}, this can be + * emulated through

not([this] <=> [value])
+ *

+ * In {@link SQLDialect#SQLITE}, this can be emulated through + *

[this] IS NOT [value]
+ *

* If this is not supported by the underlying database, jOOQ will render * this instead:

      * CASE WHEN [this] IS     NULL AND [value] IS     NULL THEN FALSE
@@ -886,6 +892,12 @@ public interface Field extends GroupField {
      * Create a condition to check if this field is DISTINCT from
      * another field.
      * 

+ * In {@link SQLDialect#MYSQL} and {@link SQLDialect#MARIADB}, this can be + * emulated through

not([this] <=> [value])
+ *

+ * In {@link SQLDialect#SQLITE}, this can be emulated through + *

[this] IS NOT [value]
+ *

* If this is not supported by the underlying database, jOOQ will render * this instead:

      * CASE WHEN [this] IS     NULL AND [field] IS     NULL THEN FALSE
@@ -908,6 +920,12 @@ public interface Field extends GroupField {
      * Create a condition to check if this field is NOT DISTINCT
      * from another value.
      * 

+ * In {@link SQLDialect#MYSQL} and {@link SQLDialect#MARIADB}, this can be + * emulated through

[this] <=> [value]
+ *

+ * In {@link SQLDialect#SQLITE}, this can be emulated through + *

[this] IS [value]
+ *

* If this is not supported by the underlying database, jOOQ will render * this instead:

      * CASE WHEN [this] IS     NULL AND [value] IS     NULL THEN TRUE
@@ -930,6 +948,12 @@ public interface Field extends GroupField {
      * Create a condition to check if this field is NOT DISTINCT
      * from another field.
      * 

+ * In {@link SQLDialect#MYSQL} and {@link SQLDialect#MARIADB}, this can be + * emulated through

[this] <=> [value]
+ *

+ * In {@link SQLDialect#SQLITE}, this can be emulated through + *

[this] IS [value]
+ *

* If this is not supported by the underlying database, jOOQ will render * this instead:

      * CASE WHEN [this] IS     NULL AND [field] IS     NULL THEN TRUE
diff --git a/jOOQ/src/main/java/org/jooq/impl/IsDistinctFrom.java b/jOOQ/src/main/java/org/jooq/impl/IsDistinctFrom.java
index 1cb3276627..d0ff6c7349 100644
--- a/jOOQ/src/main/java/org/jooq/impl/IsDistinctFrom.java
+++ b/jOOQ/src/main/java/org/jooq/impl/IsDistinctFrom.java
@@ -77,6 +77,7 @@ class IsDistinctFrom extends AbstractCondition {
     private final Comparator            comparator;
 
     private transient QueryPartInternal mySQLCondition;
+    private transient QueryPartInternal sqliteCondition;
     private transient QueryPartInternal compareCondition;
     private transient QueryPartInternal caseExpression;
 
@@ -108,8 +109,8 @@ class IsDistinctFrom extends AbstractCondition {
      */
     private final QueryPartInternal delegate(Configuration configuration) {
 
-        // These dialects need to simulate the IS DISTINCT FROM operator
-        if (asList(ASE, CUBRID, DB2, DERBY, INGRES, ORACLE, SQLSERVER, SQLITE, SYBASE).contains(configuration.dialect().family())) {
+        // These dialects need to simulate the IS DISTINCT FROM predicate
+        if (asList(ASE, CUBRID, DB2, DERBY, INGRES, ORACLE, SQLSERVER, SYBASE).contains(configuration.dialect().family())) {
             if (caseExpression == null) {
                 if (comparator == Comparator.IS_DISTINCT_FROM) {
                     caseExpression = (QueryPartInternal) decode()
@@ -138,7 +139,7 @@ class IsDistinctFrom extends AbstractCondition {
         else if (asList(MARIADB, MYSQL).contains(configuration.dialect())) {
             if (mySQLCondition == null) {
                 if (comparator == Comparator.IS_DISTINCT_FROM) {
-                    mySQLCondition = (QueryPartInternal) condition("not({0} <=> {1})", lhs, rhs);
+                    mySQLCondition = (QueryPartInternal) condition("{not}({0} <=> {1})", lhs, rhs);
                 }
                 else {
                     mySQLCondition = (QueryPartInternal) condition("{0} <=> {1}", lhs, rhs);
@@ -148,7 +149,21 @@ class IsDistinctFrom extends AbstractCondition {
             return mySQLCondition;
         }
 
-        // These dialects natively support the IS DISTINCT FROM operator:
+        // SQLite knows the IS / IS NOT predicate
+        else if (SQLITE == configuration.dialect()) {
+            if (sqliteCondition == null) {
+                if (comparator == Comparator.IS_DISTINCT_FROM) {
+                    sqliteCondition = (QueryPartInternal) condition("{0} {is not} {1}", lhs, rhs);
+                }
+                else {
+                    sqliteCondition = (QueryPartInternal) condition("{0} {is} {1}", lhs, rhs);
+                }
+            }
+
+            return sqliteCondition;
+        }
+
+        // These dialects natively support the IS DISTINCT FROM predicate:
         // H2, Postgres
         else {
             if (compareCondition == null) {