Mojo::PgX::Cursor::Results
Mojo::PgX::Cursor::Results is a container for a Mojo::PgX::Cursor::Cursor like Mojo::Pg::Results is for a statement handle. Therefore it tries to mimic the API of Mojo::Pg::Results whereever it makes sense to do do.
This container should behave like Mojo::Pg::Results for array, columns, hash, and expand. It intentionally does not support hashes or arrays since if you wish to use those you should just use query instead. One difference in behavior is rows returns the number of rows in the current iteration not the total rows for the query.
array
columns
hash
expand
hashes
arrays
query
rows
my $cursor = $results->cursor; $results = $results->cursor($cursor);
The Mojo::PgX::Cursor::Cursor rows are fetched from.
my $time_wasted = $results->seconds_blocked;
The cumulative time the cursor has spent waiting for rows.
my $row = $results->array;
Return next row from "cursor" as an array reference.
my $columns = $results->columns;
Return column names as an array reference.
$results = $results->expand;
Decode json and jsonb fields automatically for all rows.
json
jsonb
my $row = $results->hash;
Return next row from "cursor" as a hash reference.
my $results = Mojo::PgX::Cursor::Results->new(cursor => $cursor);
Construct a new Mojo::PgX::Cursor::Results object.
my $num = $results->rows;
Number of rows in current iteration; not the total for the original query.
$results->rows(1000);
Set the number of rows to fetch in each iteration. Since the next iteration is always pre-fetched up to twice this many rows will be in memory at any given time. Set this to optimize for time or memory in your specific use case.
If not set then the Mojo::PgX::Cursor::Cursor default fetch size is used.
$results->wait;
Wait for background query to finish. This would be used to block before making another background query on the same database handle.
Copyright (C) Nathaniel Nutter.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Nathaniel Nutter nnutter@cpan.org
nnutter@cpan.org
Mojo::PgX::Cursor, Mojo::PgX::Cursor::Cursor, Mojo::PgX::Cursor::Database
To install Mojo::PgX::Cursor, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::PgX::Cursor
CPAN shell
perl -MCPAN -e shell install Mojo::PgX::Cursor
For more information on module installation, please visit the detailed CPAN module installation guide.