From 2fbd31985a169c9c6a212460a01d0a78805933e3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 2 Oct 2011 17:07:20 +0200 Subject: If query substituting placeholder is empty, pass true expression instead This allows uniform usage of views both with and without any extra conditions. Also optimize some common cases so that we don't have useless WHERE TRUE clauses or (...) AND (TRUE) expressions. --- odb/relational/source.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'odb/relational/source.cxx') diff --git a/odb/relational/source.cxx b/odb/relational/source.cxx index 5dfc15a..fe23ac9 100644 --- a/odb/relational/source.cxx +++ b/odb/relational/source.cxx @@ -499,7 +499,7 @@ namespace relational if (tt == CPP_CLOSE_PAREN) { - r += 'q'; + r += "q.empty () ? query_base_type::true_expr : q"; *placeholder = true; } else -- cgit v1.1