You can use $results->rows for number of rows (
http://mojolicio.us/perldoc/Mojo/Pg/Results#rows)
Or $results->arrays->size (http://mojolicio.us/perldoc/Mojo/Collection#size)
if you want to load all records to memory.

On Tue, Sep 1, 2015 at 4:30 AM, Neil Watson <[email protected]> wrote:

> I have a query to get a record count from a table:
>
> my $query = "SELECT reltuples FROM pg_class WHERE relname = ?";
> my $results = $mdb->query( $query, ( $agent_table ));
> my $record_counts = $results->arrays;
> warn "record_counts = ". Dumper( $record_counts );
>
> $record_counts dump shows:
> record_counts = $VAR1 = bless( [], 'Mojo::Collection' );
>
> And $record_counts->[0][0]; is empty.
>
> Using the same query via DBI I get the expected number returned. All
> other Mojo::Pg queries are working. What is wrong with this one?
>
> --
> Neil Watson
> Linux/UNIX Consultant
> http://watson-wilson.ca
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Andrey Khozov

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to