NAME

Mojo::PgX::Cursor::Database

DESCRIPTION

Subclass of Mojo::Pg::Database. Adds the cursor method.

METHODS

cursor

my $results = $db->cursor('select * from foo');
my $results = $db->cursor('select * from foo where id >= (?)', 10);

Execute a blocking statement and return an Mojo::PgX::Cursor::Results object to iterate over the results. Unlike Mojo::Pg::Results results are fetched in batches rather than all at once but this is handled automatically by the Mojo::PgX::Cursor::Results object. Be aware that this makes the object behave somewhat differently.

Mojo::PgX::Cursor::Results does not support hashes or arrays since if you wish to use those you should just use query instead. rows returns the number of rows in the batch not the total rows for the query.

Mojo::PgX::Cursor::Results should behave like Mojo::Pg::Results for array, columns, hash, and expand.