Martin Evans wrote:
After seeing the recent posting by Greg Sabino Mullane in subject "Log DBI query and values with placeholders" I realised there was something else DBD::ODBC was out of date with - tracing.

DBD::ODBC does not implement its own trace flags but neither does it react to 'SQL' tracing. If I set trace('SQL') I can see the TraceLevel is set to 256 and I can find:

    sub parse_trace_flag {
        my ($h, $name) = @_;
        #      0xddDDDDrL (driver, DBI, reserved, Level)
        return 0x00000100 if $name eq 'SQL';
        return;
    }

in DBI. So to test if 'SQL' is enabled we:

if *DBIc_TRACE_LEVEL(imp_xxh) & 256) {blah;}

Is that correct? No constant I am missing?

Martin

and also, how do I set this in Perl:

$dbh->{TraceLevel} = 'SQL|3';

DBI::db=HASH(0x82ba9d4) trace level set to 0x100/3 (DBI @ 0x0/0) in DBI 1.601-ithread (pid 4574)

$dbh->prepare(xxxx)
  here when I examine DBIc_TRACE_LEVEL(imp_dbh) it is 3!

Similarly if I use:

$h->trace($h->parse_trace_flags('SQL'))

What am I doing wrong? I'm a little confused by this since DBD::Pg seems to expect 'SQL' to work.

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Reply via email to