aboutsummaryrefslogtreecommitdiff
path: root/odb/tracer.cxx
blob: aa3382232cc9b9a9fe8e84a4bb2ee45d70211a3e (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
// file      : odb/tracer.cxx
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
// license   : GNU GPL v2; see accompanying LICENSE file

#include <iostream>

#include <odb/tracer.hxx>
#include <odb/statement.hxx>

using namespace std;

namespace odb
{
  //
  // tracer
  //

  tracer::
  ~tracer ()
  {
  }

  void tracer::
  prepare (connection&, const statement&)
  {
  }

  void tracer::
  execute (connection& c, const statement& s)
  {
    execute (c, s.text ());
  }

  void tracer::
  deallocate (connection&, const statement&)
  {
  }

  //
  // stderr_tracer
  //

  class stderr_tracer_type: public tracer
  {
    virtual void
    execute (connection&, const char* statement);
  };

  void stderr_tracer_type::
  execute (connection&, const char* s)
  {
    cerr << s << endl;
  }

  static stderr_tracer_type stderr_tracer_;
  tracer& stderr_tracer = stderr_tracer_;
}