--- trunk/index_DBI_cache.pm 2003/10/30 00:49:43 141 +++ trunk/index_DBI_cache.pm 2003/10/30 01:02:22 142 @@ -120,7 +120,17 @@ my ($total) = $sth->fetchrow_array(); - return $total; + # no results, count all + if (! $total) { + my $sql = "select count(*) from $field"; + + my $sth = $self->{dbh}->prepare($sql) || die $self->{dbh}->errstr(); + $sth->execute() || die "sql: $sql; ".$self->{dbh}->errstr(); + $total = $sth->fetchrow_array(); + + } + + return $total || 1; }