The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DBIx::QueryByName::Result::ScalarIterator - A scalar iterator around a statement handle

DESCRIPTION

Provides an iterator-like api to a DBI statement handle that is expected to return only a single column upon each call to fetchrow_array().

DO NOT USE DIRECTLY!

INTERFACE

my $i = new($sth);

Return a scalar iterator wrapped around this statement handle.

my $v = $i->next();

$v is the value of the single column in the entry returned by the next call to fetch_row() on the iterator's statement handle. Return undef if no entries could be fetched.

Examples:

    # table Jobs has only one column containing the values 1, 2 and 3.

    $dbh->load(session => "main",
               from_xml => "<queries><query name='GetJobs' params='' result='scalariterator'>SELECT * FROM Jobs</query></queries>",
              );

    # $i is a ScalarIterator
    my $i = $dbh->GetJobs();

    print $i->next."\n";  # prints '1'
    print $i->next."\n";  # prints '2'
    print $i->next."\n";  # prints '3'

    # the next '$i->next' returns undef