See $if_active in perldoc DBI

check line marked HERE in this sample of code ( since you didn't provide a Short, Self-Contained, Correct Example )

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11123285 use warnings; use DBI; my $dbfile = 'db.11123285'; unlink $dbfile; my $db = DBI->connect_cached( "DBI:SQLite(RaiseError=>1,PrintError=>0):$dbfile"); eval { $db->do('create table note (id integer primary key, ts int, mess tex +t)'); $db->do('insert into note (ts, mess) values (?, ?)', {}, 1, 'one'); $db->do('insert into note (ts, mess) values (?, ?)', {}, 2, 'two'); }; #system "sqlite3 $dbfile .dump"; my $sth = $db->prepare_cached('select * from note where id = ?'); $sth->bind_param(1, 2); $sth->execute; my @data = $sth->fetchrow_array; use Data::Dump 'dd'; dd \@data; $sth = $db->prepare_cached('select * from note where id = ?', {}, 1); +# HERE $sth->bind_param(1, 1); $sth->execute; @data = $sth->fetchrow_array; use Data::Dump 'dd'; dd \@data; unlink $dbfile; # cleanup

Outputs:

[2, 2, "two"] [1, 1, "one"]

Note that the "still Active" message does not prevent correct execution, so something else must be causing your lack of data.


In reply to Re: Perl DBI connect cached still active by tybalt89
in thread Perl DBI connect cached still active by newperldeveloper

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.