Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
DB Interface Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWDBTracer

Module:  DB Interface Module   Group:  Utility and Diagnostics Classes


Does not inherit

Local Index

Members

Synopsis

#include <rw/db/tracer.h>
#include <fstream.h>

ofstream strm("trace.trc");
RWDBTracer& tracer = myDbase.tracer();
tracer.setOn(RWDBTracer::SQL);
tracer.stream(strm);

Description

Class RWDBTracer provides a runtime trace facility for DB Interface Module applications. RWDBTracers can be turned on or off, and they can be told what to trace. The default output for an RWDBTracer is the stream clog. The output from an RWDBTracer can be redirected to an ostream.

A database object of the DB Interface Module contains an RWDBTracer. Consequently, enabling tracing on an RWDBDatabase, for example, produces trace output for all objects produced by that RWDBDatabase.

It is the application's responsibility to insure that the associated ostream referenced by the RWDBTracer remains in scope while the RWDBTracer is set on.

Example

Here is how to obtain a trace of all SQL sent through the RWDBDatabase myDbase, sending the output to the file "trace.out."

Notice the declaration RWDBTracer& tracer. It would be ineffective to declare tracer as an RWDBTracer, rather than as an RWDBTracer reference. Doing so would result in a local copy of myDbase's tracer: the setOn() and stream() calls would have no effect on the database that we wished to trace.

Related Classes

RWDBDatabase instances provide access to their RWDBTracers.

Public Enum

enum TraceFlag { ZERO = 0, SQL = 1, BoundBuffers = 2, NoPlaceHoderSQL = 4, ThreadId = 8 };

Public Constructors

RWDBTracer();
RWDBTracer(const RWDBTracer& tracer);

Public Member Operators

RWDBTracer& 
operator=(const RWDBTracer& tracer);
RWDBTracer& 
operator<< (char value); 
RWDBTracer& 
operator<< (unsigned char value);
RWDBTracer& 
operator<< (short value); 
RWDBTracer& 
operator<< (unsigned short value);
RWDBTracer& 
operator<< (int value);
RWDBTracer& 
operator<< (unsigned int value);
RWDBTracer& 
operator<< (long value);
RWDBTracer& 
operator<< (unsigned long value);
RWDBTracer& 
operator<< (long long arg);
RWDBTracer& 
operator<< (unsigned long long arg);
RWDBTracer& 
operator<< (float value);
RWDBTracer& 
operator<< (double value);
RWDBTracer& 
operator<< (long double arg);
RWDBTracer& 
operator<< (const char* string);
RWDBTracer& 
operator<< (void* value);
RWDBTracer& 
operator<< (ostream& (_f)(ostream  & ));

Public Member Functions

void
acquire() const;
unsigned
flag() const;
bool 
isOn(TraceFlag flag) const;
bool
isValid() const;
void
release() const;
ostream&
stream();
RWDBTracer&
stream(ostream& strm);
TraceFlag
setOff(TraceFlag);
TraceFlag
setOn(TraceFlag);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.