NAME

Net::Presto::Statement - Presto client statement object

SYNOPSIS

use Net::Presto;

my $presto = Net::Presto->new(...);
my $sth = $presto->execute('SELECT * FROM ...');
while (my $rows = $sth->fetch) {
    my @column_names = $sth->column_names;
    for my $row (@$rows) {
        my @columns = @$row; # ArrayRef
    }
}
while (my $rows = $sth->fetch_hashref) {
    for my $row (@$rows) {
        $row->{column_name}; # HashRef
    }
}

$sth->cancel; # cancel the statement

# do callback on each requests
$sth->poll(sub {
    my $res = shift;
    my $data = $res->{data};
    my $stats = $res->{stats};
    # stop polling by return false
    return 0 if $stats->{status} eq 'FINISHED';
    1; # continue
});

DESCRIPTION

Net::Presto statement handler object.

METHODS

$sth->fetch() :ArrayRef[ArrayRef[Str]]

Fetch next data as ArrayRef.

$sth->fetch_hashref() :ArrayRef[HashRef[Str]]

Fetch next data as HashRef.

$sth->columns() :ArrayRef[HashRef[Str]]

Returns column data.

$sth->columns_names() :(Str,...)

Returns column names.

$sth->cancel() :Bool

Cancel the query.

$sth->wait_for_completion() :Void

Wait until the query is completed.

$sth->poll($callback) :Void

Do $callback on each HTTP requests.

SEE ALSO

Net::Presto

AUTHOR

Jiro Nishiguchi <jiro@cpan.org>