CGI-OptimalQuery
view release on metacpan or search on metacpan
lib/DBIx/OptimalQuery.pm view on Meta::CPAN
die "dep $dep for select $col does not exist"
if defined $dep && ! exists $$oq{'joins'}{$dep};
}
}
# look for new cursors and define parent child links if not already defined
foreach my $join (keys %{ $oq->{'joins'} }) {
my $opts = $oq->{'joins'}->{$join}->[3];
if (exists $opts->{new_cursor}) {
if (ref($opts->{new_cursor}) ne 'HASH') {
$oq->_formulate_new_cursor($join);
} else {
die "could not find keys, join, and sql for new cursor in $join"
unless exists $opts->{new_cursor}->{'keys'} &&
exists $opts->{new_cursor}->{'join'} &&
exists $opts->{new_cursor}->{'sql'};
}
}
# make sure defined deps exist
foreach my $dep (@{ $$oq{'joins'}{$join}[0] }) {
lib/DBIx/OptimalQuery.pm view on Meta::CPAN
# defines how a child cursor joins to its parent cursor
# by defining keys, join, sql in child cursor
# called from the _normalize method
sub _formulate_new_cursor {
my $oq = shift;
my $joinAlias = shift;
#$$oq{error_handler}->("DEBUG: \$oq->_formulate_new_cursor('$joinAlias')\n") if $$oq{debug};
# vars to define
my (@keys, $join, $sql, @sqlBinds);
# get join definition
my ($fromSql, @fromBinds) = @{ $oq->{joins}->{$joinAlias}->[1] };
my ($whereSql, @whereBinds);
($whereSql, @whereBinds) = @{ $oq->{joins}->{$joinAlias}->[2] }
if defined $oq->{joins}->{$joinAlias}->[2];
( run in 0.627 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )