aboutsummaryrefslogtreecommitdiff
path: root/common/threads/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-10-12 17:24:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-10-19 11:41:11 +0200
commitf2e4c2c70344dd1a98593cfbe9256d1b3ed54f27 (patch)
tree713e2b8625aa9db41f2c18194baf68b830df39a3 /common/threads/driver.cxx
parent3fd1098c70a36cdffa256b6d9fd721cf95c6f482 (diff)
Completion of prepared query support
Diffstat (limited to 'common/threads/driver.cxx')
-rw-r--r--common/threads/driver.cxx20
1 files changed, 19 insertions, 1 deletions
diff --git a/common/threads/driver.cxx b/common/threads/driver.cxx
index dc4de0d..b8a66f1 100644
--- a/common/threads/driver.cxx
+++ b/common/threads/driver.cxx
@@ -96,10 +96,25 @@ struct task
for (unsigned long j (0); j < sub_iteration_count; ++j)
{
typedef odb::query<object> query;
+ typedef odb::prepared_query<object> prep_query;
typedef odb::result<object> result;
transaction t (db_.begin ());
- result r (db_.query<object> (query::str == "another value", false));
+
+ { // @@ TMP
+
+ //result r (db_.query<object> (query::str == "another value", false));
+
+ prep_query pq (db_.lookup_query<object> ("object-query"));
+
+ if (!pq)
+ {
+ pq = db_.prepare_query<object> (
+ "object-query", query::str == "another value");
+ db_.cache_query (pq);
+ }
+
+ result r (pq.execute (false));
bool found (false);
for (result::iterator i (r.begin ()); i != r.end (); ++i)
@@ -111,6 +126,9 @@ struct task
}
}
assert (found);
+
+ } // @@ TMP
+
t.commit ();
}