Oracle ODB Runtime Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
statements-base.hxx
Go to the documentation of this file.
1 // file : odb/oracle/statements-base.hxx
2 // copyright : Copyright (c) 2005-2013 Code Synthesis Tools CC
3 // license : ODB NCUEL; see accompanying LICENSE file
4 
5 #ifndef ODB_ORACLE_STATEMENTS_BASE_HXX
6 #define ODB_ORACLE_STATEMENTS_BASE_HXX
7 
8 #include <odb/pre.hxx>
9 
10 #include <odb/schema-version.hxx>
11 #include <odb/details/shared-ptr.hxx>
12 
13 #include <odb/oracle/version.hxx>
15 #include <odb/oracle/database.hxx>
16 
17 #include <odb/oracle/details/export.hxx>
18 
19 namespace odb
20 {
21  namespace oracle
22  {
23  class LIBODB_ORACLE_EXPORT statements_base: public details::shared_base
24  {
25  public:
27 
30  {
31  return conn_;
32  }
33 
34  // Schema version. database::schema_version_migration() is thread-
35  // safe which means it is also slow. Cache the result in statements
36  // so we can avoid the mutex lock. This is thread-safe since if the
37  // version is updated, then the statements cache will be expired.
38  //
40  version_migration (const char* name = "") const
41  {
42  if (svm_ == 0)
43  svm_ = &conn_.database ().schema_version_migration (name);
44 
45  return *svm_;
46  }
47 
48  public:
49  virtual
50  ~statements_base ();
51 
52  protected:
53  statements_base (connection_type& conn): conn_ (conn), svm_ (0) {}
54 
55  protected:
58  };
59  }
60 }
61 
62 #include <odb/post.hxx>
63 
64 #endif // ODB_ORACLE_STATEMENTS_BASE_HXX
statements_base(connection_type &conn)
Definition: statements-base.hxx:53
Definition: connection.hxx:35
const schema_version_migration * svm_
Definition: statements-base.hxx:57
connection_type & connection()
Definition: statements-base.hxx:29
oracle::connection connection_type
Definition: statements-base.hxx:26
connection_type & conn_
Definition: statements-base.hxx:56
const schema_version_migration & version_migration(const char *name="") const
Definition: statements-base.hxx:40
Definition: statements-base.hxx:23