Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I recently started using DBD::AnyData to query some flat files and it works great - except for the warnings it spits out. If I run the basic example from the DBD::AnyData docs, it prints the result set, followed by:
DBI st handle 0x9bd6468 cleared whilst still active. dbih_clearcom (sth 0x9bd6468, com 0x9bd83b8, imp DBD::AnyData::st) +: FLAGS 0x88005: COMSET Active HandleError PARENT DBI::db=HASH(0x9bd6384) KIDS 0 (0 Active) NUM_OF_FIELDS 2 NUM_OF_PARAMS 0
I did add $sth->finish and $dbh->disconnect to my test script but I still get that output.

I thought I could just add a __WARN__ handler to ignore this particular warning, but that only solves part of the problem. It appears that only the first line of the above output is the warning, the part starting with dbih_clearcom still gets printed.

I also tried using $dbh->{HandleError} but my handler isn't being called. Here's what I've tried so far:

#!/usr/bin/env perl use strict; use warnings; $| = 1; use DBI; $SIG{__WARN__} = \&handle_warnings; my $dbh = DBI->connect('dbi:AnyData:'); $dbh->{HandleError} = \&handle_errors; $dbh->{RaiseError} = 0; $dbh->{PrintError} = 0; $dbh->{PrintWarn} = 0; $dbh->{ShowErrorStatement} = 0; $dbh->{Warn} = 0; $dbh->func( 'cars', 'CSV', 'cars.csv', 'ad_catalog'); my $sth = $dbh->prepare('select make, model from cars'); $sth->execute(); while (my $row = $sth->fetch) { print "@$row\n"; } $sth->finish; $dbh->disconnect; sub handle_warnings { print Data::Dumper->Dump([\@_], ['*_']); my $warning = shift; print "Handling WARNING:\n$warning\n"; return if $warning =~ /handle .*? cleared whilst still active/ms; } sub handle_errors { print Data::Dumper->Dump([\@_], ['*_']); my $error = shift; print "Handling ERROR:$error\n"; 1; }
There is a bug report for this issue but it's been open for about a year. I've seen several recommendations here for DBD::AnyData, but no mention of this problem. Am I missing something obvious, or is there a workaround?


In reply to DBD::AnyData and 'handle cleared whilst still active' warning by iguanodon

Title:
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 How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-19 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found