aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/query.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-08-13 13:39:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-08-13 13:39:57 +0200
commitbad675ea0e17b6eb18d75ddc403b81ff5f76ad25 (patch)
tree388a59f0c92eb4f59e812d9e38e4c1a6c8d80471 /odb/mysql/query.cxx
parent107c3754b2eccd0f2a30121aab9b29c25f83e40c (diff)
Add support for language-embedded query
Diffstat (limited to 'odb/mysql/query.cxx')
-rw-r--r--odb/mysql/query.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/odb/mysql/query.cxx b/odb/mysql/query.cxx
index 1a2003a..0caa214 100644
--- a/odb/mysql/query.cxx
+++ b/odb/mysql/query.cxx
@@ -42,9 +42,32 @@ namespace odb
return *this;
}
+ query& query::
+ operator+= (const query& q)
+ {
+ size_t n (clause_.size ());
+
+ if (n != 0 && clause_[n - 1] != ' ' &&
+ !q.clause_.empty () && q.clause_[0] != ' ')
+ clause_ += ' ';
+
+ clause_ += q.clause_;
+
+ parameters_.insert (
+ parameters_.end (), q.parameters_.begin (), q.parameters_.end ());
+
+ binding_.insert (
+ binding_.end (), q.binding_.begin (), q.binding_.end ());
+ }
+
void query::
add (shared_ptr<query_param> p)
{
+ size_t n (clause_.size ());
+
+ if (n != 0 && clause_[n - 1] != ' ')
+ clause_ += ' ';
+
clause_ += '?';
parameters_.push_back (p);