aboutsummaryrefslogtreecommitdiff
path: root/bpkg/diagnostics
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-17 15:16:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-17 15:16:47 +0200
commit2677da127b99bc4e6d904de3f14b8fe3f781740f (patch)
treee58e2c305ddba50a5e006f5f885f7b4327a9573e /bpkg/diagnostics
parent2dab23b28def943669796d60b42bede2f0c2cd7f (diff)
Integrate database statement tracing into our diagnostics machinery
Diffstat (limited to 'bpkg/diagnostics')
-rw-r--r--bpkg/diagnostics18
1 files changed, 17 insertions, 1 deletions
diff --git a/bpkg/diagnostics b/bpkg/diagnostics
index f403d9f..e48d4f2 100644
--- a/bpkg/diagnostics
+++ b/bpkg/diagnostics
@@ -13,6 +13,8 @@
#include <ostream>
#include <exception>
+#include <odb/tracer.hxx>
+
#include <bpkg/types>
namespace bpkg
@@ -320,11 +322,25 @@ namespace bpkg
// trace
//
- struct trace_mark_base: basic_mark_base
+ // Also implement the ODB tracer interface so that we can use
+ // it to trace database statement execution.
+ //
+ struct trace_mark_base: basic_mark_base, odb::tracer
{
explicit
trace_mark_base (const char* name, const void* data = nullptr)
: basic_mark_base ("trace", name, data) {}
+
+ // odb::tracer interface.
+ //
+ virtual void
+ prepare (odb::connection&, const odb::statement&);
+
+ virtual void
+ execute (odb::connection&, const char* statement);
+
+ virtual void
+ deallocate (odb::connection&, const odb::statement&);
};
typedef diag_mark<trace_mark_base> trace_mark;