aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/query.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-17 14:16:53 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-17 14:16:53 +0200
commita0cf6442d57fbf1839f20c952f9880daa6bd2d59 (patch)
treec1ec9ef9dcf1ea4546b4590cc6769ea78a2b5d71 /odb/mysql/query.txx
parent0c5953ed01ff28f81c866fed126ebcd47f76c0ea (diff)
Handle empty query::in_range() case
Diffstat (limited to 'odb/mysql/query.txx')
-rw-r--r--odb/mysql/query.txx25
1 files changed, 15 insertions, 10 deletions
diff --git a/odb/mysql/query.txx b/odb/mysql/query.txx
index 8ddd65e..968ac7e 100644
--- a/odb/mysql/query.txx
+++ b/odb/mysql/query.txx
@@ -100,19 +100,24 @@ namespace odb
query_base query_column<T, ID>::
in_range (I begin, I end) const
{
- query_base q (table_, column_);
- q += "IN (";
-
- for (I i (begin); i != end; ++i)
+ if (begin != end)
{
- if (i != begin)
- q += ",";
+ query_base q (table_, column_);
+ q += "IN (";
- q.append<T, ID> (val_bind<T> (*i), conversion_);
- }
+ for (I i (begin); i != end; ++i)
+ {
+ if (i != begin)
+ q += ",";
- q += ")";
- return q;
+ q.append<T, ID> (val_bind<T> (*i), conversion_);
+ }
+
+ q += ")";
+ return q;
+ }
+ else
+ return query_base (false);
}
// like