bulrush:

Based on your description, I'd guess that when you're running the script:

Your script is overly complicated, you repeat yourself a good bit, so you should perhaps try a simple experiment without all the extraneous stuff. Something like:

use warnings; use strict; use DBI; use Data::Dumper; my $histfn = >>>put a path here for your temporary/test database<<< my $dbsql=DBI->connect("dbi:SQLite:dbname=$histfn", { RaiseError=>1 }) +; $dbsql->do(q{create table foo (id int, msg text)}); $dbsql->do(q{insert into foo VALUES (1,'hello')}); my $ra = $dbsql->selectall_arrayref('select * from foo'); print Dumper($ra);

Run it, and see if it is able to run successfully and print records. If so, then make a copy of your program and comment out chunks of it until it's nearly as simple as this one, and get that working. Then uncomment bits here and there until it breaks again. That last bit you uncommented will have a flaw in it.

The way I comment chunks out is to insert pod comments like this:

use warnings; use strict; =h1 Does perl even work on this box? use DBI; use Data::Dumper; my $histfn = >>>put a path here for your temporary/test database<<< my $dbsql=DBI->connect("dbi:SQLite:dbname=$histfn", { RaiseError=>1 }) +; $dbsql->do(q{create table foo (id int, msg text)}); $dbsql->do(q{insert into foo VALUES (1,'hello')}); my $ra = $dbsql->selectall_arrayref('select * from foo'); print Dumper($ra); =cut print "hello, world!\n";

So as you uncomment, you simply move your =h1 and =cut lines accordingly.

Update: Made the correction reported by bulrush.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


In reply to Re: SQLite select wont' return records by roboticus
in thread SQLite select won't return SELECTed records by bulrush

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.