File: enable_odbc_tracing.pl

package info (click to toggle)
libdbd-odbc-perl 1.61-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,424 kB
  • sloc: perl: 8,928; ansic: 6,456; makefile: 33; sql: 8
file content (20 lines) | stat: -rw-r--r-- 624 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# $Id$
# Shows how to enable ODBC API tracing for this Perl script.
# NOTE: the ODBC Driver manager does the actual tracing
use strict;
use warnings;
use DBI;

my $h = DBI->connect($ENV{DBI_DSN}, $ENV{DBI_USER}, $ENV{DBI_PASS},
                     {odbc_trace_file => 'c:\users\martin\odbc.trc',
                      odbc_trace => 1});
print "trace is ", $h->{odbc_trace}, ", ", $h->{odbc_trace_file}, "\n";
my $s = $h->prepare('select 1');
$s->execute;
$h->{odbc_trace} = 0;
print "trace is ", $h->{odbc_trace}, "\n";
$s->fetch;
$s->fetch;
$h->{odbc_trace} = 1;
print "trace is ", $h->{odbc_trace}, "\n";
$h->disconnect;