http://qs321.pair.com?node_id=282803


in reply to DBD::SQLite dilemma

I'd go for option (3) myself and call

my $rowcount = $dbh->do("SELECT * FROM TABLE");

undefined behaviour (mainly coz I'd like iterators:-)

The benefit is worth the gain - and people should learn how to use COUNT().

Replies are listed 'Best First'.
Re: Re: DBD::SQLite dilemma
by PodMaster (Abbot) on Aug 11, 2003 at 10:13 UTC
    I second this idea (... on the other hand, maybe Matts can hack sqlite to add such functionality -- naah).

    update: `perldoc DBI' says "For SELECT statements... The execute method does not return the number of rows that will be returned by the query (because most databases can't tell in advance), it simply returns a true value.". So, since DBI users are not supposed to rely on this, they shouldn't ;)

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

      Indeed. It's expensive to return the count of a select because you either have to count the number of responces you get back, or run a count(*) on the same querey that you're executing, which can be as expensive as running the query itself.

      ----
      Zak