Oracle ODB Runtime Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
section-statements.hxx
Go to the documentation of this file.
1 // file : odb/oracle/section-statements.hxx
2 // copyright : Copyright (c) 2005-2013 Code Synthesis Tools CC
3 // license : ODB NCUEL; see accompanying LICENSE file
4 
5 #ifndef ODB_ORACLE_SECTION_STATEMENTS_HXX
6 #define ODB_ORACLE_SECTION_STATEMENTS_HXX
7 
8 #include <odb/pre.hxx>
9 
10 #include <cstddef> // std::size_t
11 
12 #include <odb/forward.hxx>
13 #include <odb/schema-version.hxx>
14 #include <odb/traits.hxx>
15 
16 #include <odb/oracle/version.hxx>
18 #include <odb/oracle/binding.hxx>
19 #include <odb/oracle/statement.hxx>
21 #include <odb/oracle/database.hxx>
22 #include <odb/oracle/details/export.hxx>
23 
24 namespace odb
25 {
26  namespace oracle
27  {
28  class connection;
29 
30  // Template argument is the section traits type.
31  //
32  template <typename T, typename ST>
33  class section_statements
34  {
35  public:
36  typedef ST traits;
37 
38  typedef typename traits::image_type image_type;
39 
42 
44 
46  image_type&,
47  binding& id, binding& idv);
48 
50  connection () {return conn_;}
51 
53  version_migration (const char* name = "") const
54  {
55  if (svm_ == 0)
57 
58  return *svm_;
59  }
60 
61  image_type&
62  image () {return image_;}
63 
64  const binding&
65  id_binding () {return id_binding_;}
66 
67  // Id and optimistic concurrency version (if any).
68  //
69  const binding&
71 
72  // Select binding.
73  //
74  std::size_t
76 
77  void
79 
80  binding&
82 
83  // Update binding.
84  //
85  std::size_t
87 
88  void
90 
91  std::size_t
93 
94  void
96 
97  binding&
99 
100  //
101  // Statements.
102  //
103 
106  {
107  if (select_ == 0)
108  select_.reset (
109  new (details::shared) select_statement_type (
110  conn_,
111  traits::select_statement,
112  traits::versioned, // Process if versioned.
113  false, // Don't optimize.
114  id_binding_,
116  4096)); // Hardcode a 4kB LOB prefetch size.
117 
118  return *select_;
119  }
120 
123  {
124  if (update_ == 0)
125  update_.reset (
126  new (details::shared) update_statement_type (
127  conn_,
128  traits::update_statement,
129  traits::versioned, // Process if versioned.
131 
132  return *update_;
133  }
134 
135  public:
136  static const std::size_t id_column_count = traits::id_column_count;
137  static const std::size_t managed_optimistic_load_column_count =
138  traits::managed_optimistic_load_column_count;
139  static const std::size_t managed_optimistic_update_column_count =
140  traits::managed_optimistic_update_column_count;
141  static const std::size_t select_column_count = traits::load_column_count;
142  static const std::size_t update_column_count =
143  traits::update_column_count;
144 
145  private:
147  section_statements& operator= (const section_statements&);
148 
149  protected:
152 
153  // These come from object_statements.
154  //
158 
159  // Select binding.
160  //
162 
163  static const std::size_t select_bind_count =
166  : 1;
167 
170 
171  // Update binding.
172  //
175 
176  static const std::size_t update_bind_count =
180  : 1;
181 
184 
185  details::shared_ptr<select_statement_type> select_;
186  details::shared_ptr<update_statement_type> update_;
187  };
188  }
189 }
190 
191 #include <odb/oracle/section-statements.txx>
192 
193 #include <odb/post.hxx>
194 
195 #endif // ODB_ORACLE_SECTION_STATEMENTS_HXX
Definition: connection.hxx:35
binding & select_image_binding()
Definition: section-statements.hxx:81
void update_image_version(std::size_t v)
Definition: section-statements.hxx:89
details::shared_ptr< select_statement_type > select_
Definition: section-statements.hxx:185
database_type & database()
Definition: connection.hxx:48
traits::image_type image_type
Definition: section-statements.hxx:38
std::size_t update_image_version() const
Definition: section-statements.hxx:86
void select_image_version(std::size_t v)
Definition: section-statements.hxx:78
void update_id_binding_version(std::size_t v)
Definition: section-statements.hxx:95
const binding & id_binding()
Definition: section-statements.hxx:65
oracle::select_statement select_statement_type
Definition: section-statements.hxx:40
const schema_version_migration_type & schema_version_migration(const std::string &schema_name="") const
oracle::connection connection_type
Definition: section-statements.hxx:43
std::size_t select_image_version_
Definition: section-statements.hxx:161
const binding & idv_binding()
Definition: section-statements.hxx:70
select_statement_type & select_statement()
Definition: section-statements.hxx:105
static const std::size_t select_bind_count
Definition: section-statements.hxx:163
static const std::size_t update_bind_count
Definition: section-statements.hxx:176
ST traits
Definition: section-statements.hxx:36
Definition: statement.hxx:316
std::size_t select_image_version() const
Definition: section-statements.hxx:75
static const std::size_t update_column_count
Definition: section-statements.hxx:142
Definition: statement.hxx:169
static const std::size_t id_column_count
Definition: section-statements.hxx:136
Definition: binding.hxx:21
std::size_t update_image_version_
Definition: section-statements.hxx:173
const schema_version_migration & version_migration(const char *name="") const
Definition: section-statements.hxx:53
section_statements(connection_type &, image_type &, binding &id, binding &idv)
binding select_image_binding_
Definition: section-statements.hxx:168
Definition: oracle-types.hxx:78
static const std::size_t managed_optimistic_load_column_count
Definition: section-statements.hxx:137
static const std::size_t select_column_count
Definition: section-statements.hxx:141
const schema_version_migration * svm_
Definition: section-statements.hxx:151
binding update_image_binding_
Definition: section-statements.hxx:182
image_type & image()
Definition: section-statements.hxx:62
details::shared_ptr< update_statement_type > update_
Definition: section-statements.hxx:186
connection_type & connection()
Definition: section-statements.hxx:50
std::size_t update_id_binding_version() const
Definition: section-statements.hxx:92
bind update_image_bind_[update_bind_count]
Definition: section-statements.hxx:183
std::size_t update_id_binding_version_
Definition: section-statements.hxx:174
binding & idv_binding_
Definition: section-statements.hxx:157
connection_type & conn_
Definition: section-statements.hxx:150
oracle::update_statement update_statement_type
Definition: section-statements.hxx:41
binding & update_image_binding()
Definition: section-statements.hxx:98
Definition: forward.hxx:76
image_type & image_
Definition: section-statements.hxx:155
bind select_image_bind_[select_bind_count]
Definition: section-statements.hxx:169
update_statement_type & update_statement()
Definition: section-statements.hxx:122
static const std::size_t managed_optimistic_update_column_count
Definition: section-statements.hxx:139
binding & id_binding_
Definition: section-statements.hxx:156