aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/forward.hxx1
-rw-r--r--odb/tracer.cxx30
2 files changed, 30 insertions, 1 deletions
diff --git a/odb/forward.hxx b/odb/forward.hxx
index c727215..2e54471 100644
--- a/odb/forward.hxx
+++ b/odb/forward.hxx
@@ -59,6 +59,7 @@ namespace odb
//
class tracer; // Not in core.
extern LIBODB_EXPORT tracer& stderr_tracer;
+ extern LIBODB_EXPORT tracer& stderr_full_tracer;
namespace common
{
diff --git a/odb/tracer.cxx b/odb/tracer.cxx
index 6a617f4..ec79033 100644
--- a/odb/tracer.cxx
+++ b/odb/tracer.cxx
@@ -42,27 +42,55 @@ namespace odb
class stderr_tracer_type: public tracer
{
+ public:
+ stderr_tracer_type (bool full): full_ (full) {}
+
+ virtual void
+ prepare (connection&, const statement&);
+
virtual void
execute (connection&, const char* statement);
+ virtual void
+ deallocate (connection&, const statement&);
+
// Override the other version to get rid of a Sun CC warning.
//
virtual void
execute (connection&, const statement&);
+
+ private:
+ bool full_;
};
void stderr_tracer_type::
+ prepare (connection&, const statement& s)
+ {
+ if (full_)
+ cerr << "PREPARE " << s.text () << endl;
+ }
+
+ void stderr_tracer_type::
execute (connection&, const char* s)
{
cerr << s << endl;
}
void stderr_tracer_type::
+ deallocate (connection&, const statement& s)
+ {
+ if (full_)
+ cerr << "DEALLOCATE " << s.text () << endl;
+ }
+
+ void stderr_tracer_type::
execute (connection& c, const statement& s)
{
execute (c, s.text ());
}
- static stderr_tracer_type stderr_tracer_;
+ static stderr_tracer_type stderr_tracer_ (false);
+ static stderr_tracer_type stderr_full_tracer_ (true);
tracer& stderr_tracer = stderr_tracer_;
+ tracer& stderr_full_tracer = stderr_full_tracer_;
}