Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: DBD::SQLite select fails

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


in reply to DBD::SQLite select fails

See DBI

"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."
poj


Comment on Re: DBD::SQLite select fails
Re^2: DBD::SQLite select fails
by bulrush (Beadle) 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;
      poj

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-12-27 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls