Just for fun, here is a completely runnable abstract example that doesn't use SQL at all, we are instead iterating over various lists that sort of simulate selecting a single column from several joined tables (No, you probably wouldn't really want to do this sort of hard coded list iterator this way, but it would be a good way to splice in hardcoded lists as sort of a Cartesian join on some SQL when combined with the SQL iterators):
use strict;
use warnings;
use DBIx::Iterator qw(mk_iterator list_iterator);
my $iter = mk_iterator(
\&list_123,
[
\&list_abc,
\&list_def,
],
[
\&list_456,
\&list_789,
],
);
use Data::Dumper qw(Dumper);
while ( my $r = $iter->() ) {
print Dumper($r);
}
sub list_ab {
my $x = shift;
my $y = shift;
list_iterator(
LIST => [ map {[$_]} $x..$y ],
SELECT => [ "$x$y" ],
@_,
)
}
sub list_123 { list_ab(1,3,@_) }
sub list_456 { list_ab(4,6,@_) }
sub list_789 { list_ab(7,9,@_) }
sub list_abc { list_ab("a","c",@_) }
sub list_def { list_ab("d","f",@_) }
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.