The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mojo::PgX::Cursor::Cursor

DESCRIPTION

Mojo::PgX::Cursor::Cursor is a scope guard for DBD::Pg cursors.

ATTRIBUTES

bind

    $cursor->bind([1, 2, 3]);

Bind values for the "query".

db

    $cursor->db($pg->db);

The Mojo::Pg::Database the "query" will be run against.

name

    $cursor->name;

Name for the cursor. If not set then a UUID will be used.

query

    $cursor->query('select * from foo');

SQL statement for the cursor.

METHODS

close

    $cursor->close

Close the cursor.

fetch

    my $results = $cursor->fetch;
    my $results = $cursor->fetch(10);

Fetch rows from the cursor. Defaults to fetching 100 rows.

new

    my $cursor = Mojo::PgX::Cursor::Cursor->new(
      db => $pg->db,
      query => 'select * from foo',
    );

Construct a new Mojo::PgX::Cursor::Cursor object.

LICENSE

Copyright (C) Nathaniel Nutter.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Nathaniel Nutter nnutter@cpan.org

SEE ALSO

Mojo::PgX::Cursor, Mojo::PgX::Cursor::Database, Mojo::PgX::Cursor::Results