Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: DBD::SQLite select fails

by poj (Prior)
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."

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]
[1nickt]: Corion I am trying to keep an open mind :-) Or at least, go with the flow. marto yes I saw som photos of lorries overturned on country roads, and wondered why they would have been driving fast enough to have that happen!

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2017-12-11 11:56 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (289 votes). Check out past polls.