Maybe you should be using IS TRUE. See https://sqlite.org/lang_expr.html
Boolean Expressions
The SQL language features several contexts where an expression is
evaluated and the result converted to a boolean (true or false) value. These
contexts are:
• the WHERE clause of a SELECT, UPDATE or DELETE statement,
• the ON or USING clause of a join in a SELECT statement,
• the HAVING clause of a SELECT statement,
• the WHEN clause of an SQL trigger, and
• the WHEN clause or clauses of some CASE expressions.
To convert the results of an SQL expression to a boolean value, SQLite
first casts the result to a NUMERIC value in the same way as a CAST expression.
A numeric zero value (integer value 0 or real value 0.0) is considered to be
false. A NULL value is still NULL. All other values are considered true.
For example, the values NULL, 0.0, 0, 'english' and '0' are all considered
to be false. Values 1, 1.0, 0.1, -0.1 and '1english' are considered to be true.
Beginning with SQLite 3.23.0 (2018-04-02), SQLite recognizes the
identifiers "TRUE" and "FALSE" as boolean literals, if and only if those
identifiers are not already used for some other meaning. If there already
exists columns or tables or other objects named TRUE or FALSE, then for the
sake of backwards compatibility, the TRUE and FALSE identifiers refer to those
other objects, not to the boolean values.
The boolean identifiers TRUE and FALSE are usually just aliases for the
integer values 1 and 0, respectively. However, if TRUE or FALSE occur on the
right-hand side of an IS operator, then they form new unary postfix operators
"IS TRUE" and "IS FALSE" which test the boolean value of the operand on the
left.
-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[email protected]] Im
Auftrag von Larry Brasfield
Gesendet: Samstag, 01. Dezember 2018 19:39
An: [email protected]
Betreff: [EXTERNAL] [sqlite] geopoly_contains_point(P,X,Y) doc is overly modest
The documentation at https://www.sqlite.org/geopoly.html , at 3.8. for
geopoly_contains_point(), asserts that the function “returns true if and only
if the coordinate X,Y is inside or on the boundary of the polygon P.” As now
implemented, in the v3.26 release, it returns 1 where the point is on a
boundary and 2 where the point is inside of the boundary. While the
documentation is technically correct, (for a suitable definition of “true”
differing from its meaning in SQL), this seems to be a useful behavior worthy
of exposure.
I suggest the rewording, “returns 2 if the coordinate X,Y is inside polygon P,
1 if on the boundary, or 0 otherwise.” I submit that this might help avoid
errors such as “… WHERE geopoly_contains_point(_shape, ptX, ptY) = TRUE”, which
will produce surprise for those who read the present claim literally.
_______________________________________________
sqlite-users mailing list
[email protected]<mailto:[email protected]>
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___________________________________________
Gunter Hick | Software Engineer | Scientific Games International GmbH |
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43
1 80100 - 0
May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users