$dbh
@islandids
@archipelagoes
+$qa
</%args>
<%perl>
my ($bs, $ix) = @_;
my $islandid= $islandids[$ix];
if (defined $islandid) {
- return "${bs}_islands.islandid = $islandid";
+ return "${bs}.islandid = $islandid";
} else {
push @query_params, $archipelagoes[$ix];
return "${bs}_islands.archipelago = ?";
my $src_cond= $sd_condition->('sell',$src_i);
my @dst_conds;
foreach my $dst_i ($src_i..$#islandids) {
- push @dst_conds, $sd_condition->('buy',$dst_i);
+ my $dst_cond= $sd_condition->('buy',$dst_i);
+ if ($dst_i==$src_i and !defined $islandids[$src_i]) {
+ # we always want arbitrage, but mentioning an arch
+ # once shouldn't produce intra-arch trades
+ $dst_cond=
+ "($dst_cond AND sell.islandid = buy.islandid)";
+ }
+ push @dst_conds, $dst_cond;
}
push @flow_conds, "$src_cond AND (
".join("
$sth->execute(@query_params);
</%perl>
+% if ($qa->{'debug'}) {
<pre>
<% $stmt |h %>
<% join(' | ',@query_params) |h %>
</pre>
+% }
<& dumpqueryresults, sth =>$sth &>