diff options
author | Thomas Dybdahl Ahle <[email protected]> | 2014-03-19 17:31:22 +0100 |
---|---|---|
committer | Simon Holywell <[email protected]> | 2014-04-26 13:23:19 +0100 |
commit | 8c2457e7d6deb25ab2480b37def2d0b0692e8b7d (patch) | |
tree | ff430b32d459c97d44be9200d4a923870e94ab86 | |
parent | b8ce5f262874edeeb21115e6c37e5ff1568b8809 (diff) |
Note about precedence
-rw-r--r-- | docs/querying.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/querying.rst b/docs/querying.rst index f3d4ede..3edad1a 100644 --- a/docs/querying.rst +++ b/docs/querying.rst @@ -326,6 +326,13 @@ with preceding and following WHERE clauses with AND. // Creates SQL: SELECT * FROM `person` WHERE `name` = "Fred" AND (`age` = 20 OR `age` = 25) ORDER BY `name` ASC; +.. note:: + + You must wrap your expression in parentheses when using any of ``ALL``, + ``ANY``, ``BETWEEN``, ``IN``, ``LIKE``, ``OR`` and ``SOME``. Otherwise + the precedence of ``AND`` will bind stronger and in the above example + you would effectively get ``WHERE (`name` = "Fred" AND `age` = 20) OR `age` = 25`` + Note that this method only supports "question mark placeholder" syntax, and NOT "named placeholder" syntax. This is because PDO does not allow queries that contain a mixture of placeholder types. Also, you should |