diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-03-25 14:15:11 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-03-25 14:15:11 +0200 |
commit | 9158a0bd5875bf0e1c3c7852389625c66069bca8 (patch) | |
tree | fc298e5dddf4ebebd308faa43035a3f57f7999e8 /doc | |
parent | 3b53b9157b610805b0d5c436bb01c0fe275390b9 (diff) |
Make queries without by-reference parameters immutable
This makes it possible to share such queries between multiple threads
without the need for synchronization.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/manual.xhtml | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/doc/manual.xhtml b/doc/manual.xhtml index 2744a7e..b586bf9 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -3134,9 +3134,16 @@ namespace odb result r1 (db.query<person> (query::first == "John")); </pre> - <p>Normally we would create a named query instance if we are + <p>Normally, we would create a named query instance if we are planning to run the same query multiple times and would use the - in-line version for those that are executed only once.</p> + in-line version for those that are executed only once. A named + query instance that does not have any by-reference parameters is + immutable and can be shared between multiple threads without + synchronization. On the other hand, a query instance with + by-reference parameters is modified every time it is executed. + If such a query is shared among multiple threads, then access + to this query instance must be synchronized from the execution + point and until the completion of the iteration over the result.</p> <p>It is also possible to create queries from other queries by combining them using logical operators. For example:</p> |