blob: 60ae48d1f968000073d1587c2a6c25bffa2f76e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// file : odb/prepared-query.hxx
// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
#ifndef ODB_PREPARED_QUERY_HXX
#define ODB_PREPARED_QUERY_HXX
#include <odb/pre.hxx>
#include <odb/forward.hxx>
#include <odb/traits.hxx>
#include <odb/result.hxx>
#include <odb/details/export.hxx>
#include <odb/details/shared-ptr.hxx>
namespace odb
{
struct LIBODB_EXPORT prepared_query_impl: details::shared_base
{
virtual
~prepared_query_impl ();
const char* name;
details::shared_ptr<result_impl> (*execute) (prepared_query_impl&);
};
template <typename T>
struct prepared_query
{
result<T>
execute (bool cache = true)
{
typedef
typename result_base<T, class_traits<T>::kind>::result_impl_type
derived_type;
details::shared_ptr<result_impl> ri (impl_->execute (*impl_));
result<T> r (
details::shared_ptr<derived_type> (
static_cast<derived_type*> (ri.release ())));
if (cache)
r.cache ();
return r;
}
explicit
prepared_query (details::shared_ptr<prepared_query_impl> impl)
: impl_ (impl) {}
private:
details::shared_ptr<prepared_query_impl> impl_;
};
namespace core
{
using odb::prepared_query;
}
}
#include <odb/post.hxx>
#endif // ODB_PREPARED_QUERY_HXX
|