Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

DBI - !! ERROR: 2000 CLEARED by call to fetch method

by metaperl (Curate)
on Nov 15, 2011 at 08:11 UTC ( #938100=perlquestion: print w/replies, xml ) Need Help??

metaperl has asked for the wisdom of the Perl Monks concerning the following question:

I have some source code which makes a DBI call:
#!/usr/bin/env perl use strict; use warnings; # core modules use Data::Dumper; use File::Basename 'dirname'; use File::Spec; use List::Util qw(sum); # cpan modules use Mojolicious::Lite; use autodie qw/:all/; use DBI; #DBI->trace(1); use SQL::Interp qw/:all/; use Sys::Hostname; # local modules use lib join '/', File::Spec->splitdir( dirname(__FILE__) ), '..', 'li +b'; use Local::DB; use Local::Bitcoin; my $bitcoin = Local::Bitcoin->new; my $da = Local::DB->new->da; DBI->trace(1); my @m = $da->sqlarrayhash('SELECT * FROM v_missing_pledges');
The trace of the call "works" - it returns an array of hashrefs of the data from the query. However, part of the DBI trace has me concerned. It claims something about an error that is cleared by call to fetch method:
schemelab@li2-168:~/domains/com/elcaminoclaro/www/cleartrader/bin$ ./r DBI 1.616-ithread default trace level set to 0x0/1 (pid 31485 pi 9 +52e008) at line 28 <- prepare('SELECT * FROM v_missing_pledges')= ( DBI::st=HASH(0xa8 +17544) ) [1 items] at line 270 <- execute= ( 1 ) [1 items] at line 288 <- FETCH('NAME')= ( [ 'pledger_id' 'sponsor_id' 'address' ] ) [1 i +tems] at line 500 !! ERROR: 2000 CLEARED by call to fetch method <- fetchrow_hashref= ( HASH(0xa817904)3keys ) [1 items] row1 at Ar line 503 !! ERROR: 2000 CLEARED by call to fetch method <- fetchrow_hashref= ( undef ) [1 items] row1 at line 504 <- finish= ( 1 ) [1 items] at line 507
The sqlarrayhash method I am calling is fairly straightforward - it just prepares a SQL call with bind parameters. I would appreciate some insight into why the trace has
!! ERROR: 2000 CLEARED by call to fetch method
in it and what that means, because everything seems to be working just fine.

The mantra of every experienced web application developer is the same: thou shalt separate business logic from display. Ironically, almost all template engines allow violation of this separation principle, which is the very impetus for HTML template engine development.

-- Terence Parr, "Enforcing Strict Model View Separation in Template Engines"

Replies are listed 'Best First'.
Re: DBI - !! ERROR: 2000 CLEARED by call to fetch method
by mje (Curate) on Nov 15, 2011 at 08:58 UTC

    The code generating that trace message is in DBI.xs which I believe it used by all C DBDs.

    /* --- dispatch --- */ if (!keep_error && !(*meth_name=='s' && strEQ(meth_name,"set_err") +)) { SV *err_sv; if (trace_level && SvOK(err_sv=DBIc_ERR(imp_xxh))) { PerlIO *logfp = DBILOGFP; PerlIO_printf(logfp, " !! %s: %s CLEARED by call to %s +method\n", SvTRUE(err_sv) ? "ERROR" : strlen(SvPV_nolen(err_sv)) +? "warn" : "info", neatsvpv(DBIc_ERR(imp_xxh),0), meth_name); } DBIh_CLEAR_ERROR(imp_xxh); } else { /* we check for change in ErrCount during call */ ErrCount = DBIc_ErrCount(imp_xxh); }

    It is in the despatch code. I /think/ its purpose is that any call to a new method other than set_err clears any previous error/warning/informational error state. 2000 may not be an error - it may be a warning (have you PrintWarn and warnings set) or it may be an informational message which don't get printed at all - you have to go out of your way to get those. Some DBI methods can return true but when tested the return is actually 0E0 and this indicates an informational - read the DBI docs on that.

    Without knowing the driver it is impossible to guess what 2000 is.

Re: DBI - !! ERROR: 2000 CLEARED by call to fetch method
by Anonymous Monk on Nov 15, 2011 at 08:40 UTC

    What driver? AFAIK, those are driver messages, so you'd consult driver docs.

    Try increasing the trace level to 999, the messages get more verbose (though some say not very informative)

Re: DBI - !! ERROR: 2000 CLEARED by call to fetch method
by metaperl (Curate) on Nov 15, 2011 at 21:12 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://938100]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2020-09-22 17:18 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (129 votes). Check out past polls.