NAME
DBIx::Squirrel::Results - an iterator handing out rows as objects
SYNOPSIS
my $results = $dbh->results(
'SELECT id, Name FROM artist WHERE id <= ?', 10,
sub ($artist) { $artist->name },
);
while (my($name) = $results->next) {
say $name;
}
my $artist = $dbh->results('SELECT * FROM artist WHERE id = ?', 1)->single;
say $artist->name;
DESCRIPTION
A result set is a DBIx::Squirrel::Iterator whose rows are objects. Each row is fetched as an array, then blessed into a class with a method for each column, named in lower case, before the stages see it. DBIx::Squirrel::Result says how the classes are made. It also says how to give rows methods of their own, with the ekorn_result_class attribute, on connect or prepare.
Rows are always arrays. The ekorn_slice attribute doesn't apply.
A result set is made by "results" in DBIx::Squirrel::db or "results" in DBIx::Squirrel::st. It has the iterator's methods, and no others. A row needs nothing from its result set, and can be kept after the result set has gone.
DIAGNOSTICS
- Expected ekorn_result_class to be a subclass of DBIx::Squirrel::Result (%s)
-
The
ekorn_result_classattribute named a class that isn't one.
SEE ALSO
DBIx::Squirrel::Iterator, DBIx::Squirrel::Result
AUTHOR
Iain Campbell <cpanic@cpan.org>
LICENSE
Copyright (c) 2024-2026 by Iain Campbell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.