[odb-users] Custom tracer

Boris Kolpackov boris at codesynthesis.com
Thu Feb 23 12:02:22 EST 2017


Hi David

david bowe <dpbowe at hotmail.com> writes:

> I am implementing a custom tracer to log odb querys in a file using
> the given example in the manual.
> 
> However, when adding the custom tracer through the db pointer I am told
> I am not able to access the tracer odb::tracer class. The compiler gives
> the following error.
> 
> src/db-driver.cxx:68:21: error: ‘odb::tracer’ is an inaccessible base
> of ‘pgsql_tracer’
> 
>    db->tracer (tracer);

If only you read that section on tracers until the end, you would have
had your answer. Quoting Section 3.13, "Tracing SQL Statement Execution":

"Note also that you can only set a database-specific tracer object using a
database-specific database instance, for example:"

pgsql_tracer tracer;

odb::database& db = ...;
db.tracer (tracer); // Compile error.

odb::pgsql::database& db = ...;
db.tracer (tracer); // Ok.

Boris



More information about the odb-users mailing list