File: statement-cache.cxx

package info (click to toggle)
libodb-sqlite 2.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,396 kB
  • sloc: sh: 11,329; cpp: 2,743; makefile: 20
file content (40 lines) | stat: -rw-r--r-- 1,144 bytes parent folder | download | duplicates (2)
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
// file      : odb/sqlite/statement-cache.cxx
// copyright : Copyright (c) 2005-2015 Code Synthesis Tools CC
// license   : GNU GPL v2; see accompanying LICENSE file

#include <odb/sqlite/statement-cache.hxx>

namespace odb
{
  using namespace details;

  namespace sqlite
  {
    statement_cache::
    statement_cache (connection& conn)
        : conn_ (conn),
          version_seq_ (conn.database ().schema_version_sequence ()),
          // String lengths below include '\0', as per SQLite manual
          // suggestions.
          //
          begin_ (new (shared) generic_statement (conn_, "BEGIN", 6)),
          commit_ (new (shared) generic_statement (conn_, "COMMIT", 7)),
          rollback_ (new (shared) generic_statement (conn_, "ROLLBACK", 9))
    {
    }

    void statement_cache::
    begin_immediate_statement_ () const
    {
      begin_immediate_.reset (
        new (shared) generic_statement (conn_, "BEGIN IMMEDIATE", 16));
    }

    void statement_cache::
    begin_exclusive_statement_ () const
    {
      begin_exclusive_.reset (
        new (shared) generic_statement (conn_, "BEGIN EXCLUSIVE", 16));
    }
  }
}