Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

This is vague, contradictory, and missing information. You'll need to supply a lot more information before we can effectively help you.

"I've enabled DBI trace with level 15 so it shows the full trace but it has no effect."

On the surface, this is contradictory: "so it shows the full trace" is the expected effect. Did you perhaps mean the opposite: "but it doesn't show the full trace"? Suggests a coding problem but, as you've shown no code, that's just guesswork.

"the output remains the same whether level 1 or 99"

There is no trace level 99. The valid range is 0-15.

"In particular I'd like to capture the SQL queries with the values interpolated."

See "DBI: Trace Flags"; in particular,

SQL - trace SQL statements executed (not yet implemented in DBI but implemented in some DBDs)

You haven't told us which DBD you're using, so I'm unable to comment on that part. There's also the possibility of a coding error; again, no code so only guesses.

"In other machines I do."

Please tell what machine you're currently using and the machines on which the same code is capturing the SQL queries.

"It's a bit of an old system with DBI version 1.64."

There is no "DBI version 1.64". See DBI: there are versions like 1.64x, where x is 0-3 and dates are 2018-2020 (so none are particularly old); BackPAN has a v0.64 from 1995.

In an attempt to provide some basic help, I created this dummy test database:

$ sqlite3 pm_11137916_anon SQLite version 3.34.0 2020-12-01 16:14:00 Enter ".help" for usage hints. sqlite> create table Planet (id, name, type); sqlite> insert into Planet values (3, 'Earth', 'rock'); sqlite> insert into Planet values (5, 'Jupiter', 'gas'); sqlite> insert into Planet values (9, 'Pluto', 'dwarf'); sqlite> select * from Planet; 3|Earth|rock 5|Jupiter|gas 9|Pluto|dwarf sqlite>

I then wrote this very simple Perl script ( as a basic test:

#!/usr/bin/env perl use strict; use warnings; use DBI; DBI->trace(0); my $dbh = DBI->connect('dbi:SQLite:dbname=pm_11137916_anon'); print join('|', @$_), "\n" for $dbh->selectall_array('select * from Pl +anet');

The output from that is the same as from the raw SQL statement:

$ ./ 3|Earth|rock 5|Jupiter|gas 9|Pluto|dwarf

Then I made multiple copies of that which changed the trace level to 1, 4, 5 and 15 (e.g. DBI->trace(4);). I then made equivalent copies that included the SQL trace flag (e.g. DBI->trace("4|SQL");). At each increased trace level, more information was produced. The SQL trace flag made no noticeable difference (so it doesn't look like DBD::SQLite is one of the DBDs that support that flag).

The output from all of those is far too great to post here; you can, of course, try them for yourself. However, I did capture the output from all of those; you can see how they increase with each trace level:

$ ls -al *.out -rw-r--r-- 1 ken None 1839 Oct 24 03:50 trace_dbi_1.out -rw-r--r-- 1 ken None 1853 Oct 24 03:51 trace_dbi_1_sql.out -rw-r--r-- 1 ken None 16771 Oct 24 04:14 trace_dbi_15.out -rw-r--r-- 1 ken None 16893 Oct 24 04:15 trace_dbi_15_sql.out -rw-r--r-- 1 ken None 6512 Oct 24 03:45 trace_dbi_4.out -rw-r--r-- 1 ken None 6570 Oct 24 03:45 trace_dbi_4_sql.out -rw-r--r-- 1 ken None 10574 Oct 24 04:02 trace_dbi_5.out -rw-r--r-- 1 ken None 10632 Oct 24 04:03 trace_dbi_5_sql.out

The first thing for you to do would be to read "How do I post a question effectively?" so that you understand the type of information we need and how to format it. Then create one or more SSCCE's to allow us to investigate: keep these as simple as possible, much like I've shown above.

All of my examples use Perl 5.34 and DBI 1.643.

— Ken

In reply to Re: DBI trace has limited output by kcott
in thread DBI trace has limited output by Anonymous Monk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2022-05-29 08:10 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (101 votes). Check out past polls.