From 52d57765bbb489f5f8e1a2cc2468b9d6c6c90364 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 21 Feb 2013 11:07:26 +0200 Subject: Add support for pattern matching (SQL LIKE) --- doc/manual.xhtml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'doc') 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 + like() + matches a pattern + query::first.like ("J%") + + + is_null() value is NULL query::age.is_null () @@ -4468,7 +4474,22 @@ namespace odb query q2 (query::first.in_range (names.begin (), names.end ())); +

Note that the like() function does not perform any + translation of the database system-specific extensions of the + SQL LIKE 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 + % (matches zero or more characters) and _ + (matches exactly one character). It is also possible to specify + the escape character as a second argument to the like() + function. This character can then be used to escape the special + characters (% and _) in the pattern. + For example, the following query will match any two characters + separated by an underscore:

+
+  query q (query::name.like ("_!__", "!"));
+  

The operator precedence in the query expressions are the same as for equivalent C++ operators. We can use parentheses to -- cgit v1.1