aboutsummaryrefslogtreecommitdiff
path: root/odb/tracer.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-11-07 15:00:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-11-07 15:00:06 +0200
commitbcf5fce175953bec0fd2725968828850a74d8539 (patch)
tree74388e8f50f893d53cf748a34b601c96557d0228 /odb/tracer.cxx
parent02e8d8116c01594716323fc6e03ede7094699d5c (diff)
Add support for SQL statement tracing
Diffstat (limited to 'odb/tracer.cxx')
-rw-r--r--odb/tracer.cxx58
1 files changed, 58 insertions, 0 deletions
diff --git a/odb/tracer.cxx b/odb/tracer.cxx
new file mode 100644
index 0000000..aa33822
--- /dev/null
+++ b/odb/tracer.cxx
@@ -0,0 +1,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_;
+}