Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: DBD::SQLite select fails

by poj (Parson)
on Aug 11, 2014 at 19:43 UTC ( #1097028=note: print w/ replies, xml ) Need Help??

in reply to DBD::SQLite select fails

"For SELECT statements, it is generally not possible to know how many rows will be returned except by fetching them all. Some drivers will return the number of rows the application has fetched so far, but others may return -1 until all rows have been fetched. So use of the rows method or $DBI::rows with SELECT statements is not recommended."
Comment on Re: DBD::SQLite select fails
Replies are listed 'Best First'.
Re^2: DBD::SQLite select fails
by bulrush (Scribe) on Aug 12, 2014 at 11:29 UTC
    Yes, but also @rows=$sth->fetchrows_array also returns no records. Hence my puzzlement.
    Perl 5.8.8 on Redhat Linux RHEL 5.5.56 (64-bit)
      Method fetchrows_array does not exist. What where you expecting @rows to contain ?
      Update: Maybe you meant fetchrow_array like this
      #!perl use strict; use DBD::SQLite; use Data::Dump 'pp'; my $dbfile = 'test.sqlite'; my $dbh = DBI->connect('dbi:SQLite:'.$dbfile , undef , undef , {RaiseError =>1, AutoCommit =>1}) or die $DBI::errstr; $dbh->do('CREATE TABLE IF NOT EXISTS data ( skey TEXT PRIMARY KEY, svalue TEXT )'); $dbh->do("INSERT INTO data (skey, svalue) VALUES ('Stuff','Ge 1:1-more &stuff&here ')"); my $sql = "SELECT svalue FROM data WHERE skey='Stuff'"; my $sth = $dbh->prepare($sql); $sth->execute(); my @row = $sth->fetchrow_array; pp @row;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1097028]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2016-05-28 17:06 GMT
Find Nodes?
    Voting Booth?