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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |