JetBrains / Exposed

Kotlin SQL Framework
http://jetbrains.github.io/Exposed/
Apache License 2.0
8.28k stars 690 forks source link

docs: [SQL Server, Oracle] Edit KDocs for Op.TRUE/FALSE #1957

Closed bog-walk closed 9 months ago

bog-walk commented 9 months ago

Current KDocs are misleading for the actual behavior of Op.TRUE and Op.FALSE as they make it seem like the objects simply translate to the SQL types for true and false.

This is technically correct for databases that support conventional boolean data types, so the objects can be used either as a stand-alone operator or as the left- or right-hand side of any comparison operator.

But for SQL Server and Oracle, which do not support syntax like WHERE 1 or WHERE TRUE, the object's logic returns an operator that always evaluates to a boolean, like 1 = 1. So attempting to use these objects as the left- or right-hand side of any comparison operator will cause a syntax error. booleanLiteral() or booleanParam() should be used in these situations.