diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-02-21 11:07:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-02-21 13:38:22 +0200 |
commit | 52d57765bbb489f5f8e1a2cc2468b9d6c6c90364 (patch) | |
tree | 6b7eb10dce59cb8a8a6b85666c19654d3af59e11 /doc/manual.xhtml | |
parent | d89d5e198222b0183aee506d58185d61e91aed33 (diff) |
Add support for pattern matching (SQL LIKE)
Diffstat (limited to 'doc/manual.xhtml')
-rw-r--r-- | doc/manual.xhtml | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/manual.xhtml b/doc/manual.xhtml index 00acf40..813822e 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -4437,6 +4437,12 @@ namespace odb </tr> <tr> + <td><code>like()</code></td> + <td>matches a pattern</td> + <td><code>query::first.like ("J%")</code></td> + </tr> + + <tr> <td><code>is_null()</code></td> <td>value is NULL</td> <td><code>query::age.is_null ()</code></td> @@ -4468,7 +4474,22 @@ namespace odb query q2 (query::first.in_range (names.begin (), names.end ())); </pre> + <p>Note that the <code>like()</code> function does not perform any + translation of the database system-specific extensions of the + SQL <code>LIKE</code> operator. As a result, if you would like + your application to be portable among various database systems, + then limit the special characters used in the pattern to + <code>%</code> (matches zero or more characters) and <code>_</code> + (matches exactly one character). It is also possible to specify + the escape character as a second argument to the <code>like()</code> + function. This character can then be used to escape the special + characters (<code>%</code> and <code>_</code>) in the pattern. + For example, the following query will match any two characters + separated by an underscore:</p> + <pre class="cxx"> + query q (query::name.like ("_!__", "!")); + </pre> <p>The operator precedence in the query expressions are the same as for equivalent C++ operators. We can use parentheses to |