X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Fquery_offers;fp=yarrg%2Fweb%2Fquery_offers;h=b9befe2c60ce3ed0016a6a37683737686a6e4d19;hb=d343fff49b802614be47d21b569f43b7d42d4511;hp=47c3555700c4ba290100dedddcdc0ded18311b2e;hpb=a47db0ee7177ab09fea575b793520550f6bcd388;p=ypp-sc-tools.db-test.git diff --git a/yarrg/web/query_offers b/yarrg/web/query_offers index 47c3555..b9befe2 100644 --- a/yarrg/web/query_offers +++ b/yarrg/web/query_offers @@ -87,11 +87,75 @@ $emsgokorprint->($emsg) or $cmid=undef; return unless defined $cmid and @islandids; foreach my $wf (@warningfs) { $wf->(); } -%perl> +%perl>
NOT YET IMPLEMENTED - +bs= <% $qa->{BuySell} %> cmdid= <% $cmid %> islandids= <% join ',', map { defined($_) ? $_ : 'U' } @islandids %>+<%perl> + +my $locdesc; +if (@islandids>1) { + $locdesc= ' at specified locations'; +} elsif (defined $islandids[0]) { + my $sth= $dbh->prepare("SELECT islandname FROM islands + WHERE islandid == ?"); + $sth->execute($islandids[0]); + $locdesc= ' at '.($sth->fetchrow_array())[0]; +} else { + $locdesc= ' in '.$archipelagoes[0]; +} + +my @conds; +my @condvals; +push @condvals, $cmid; +foreach my $ix (0..$#islandids) { + my $iid= $islandids[$ix]; + my $arch= $archipelagoes[$ix]; + if (defined $iid) { + push @conds, 'offers.islandid == ?'; + push @condvals, $iid; + } else { + push @conds, 'islands.archipelago == ?'; + push @condvals, $arch; + } +} +foreach my $bs (split /_/, $qa->{BuySell}) { + die unless grep { $bs eq $_ } qw(buy sell); + my $ascdesc= $bs eq 'buy' ? 'DESC' : 'ASC'; +%perl> +
+<% $stmt %> +<% join ',', @condvals |h %> ++<%perl> + } + + my $sth= $dbh->prepare($stmt); + $sth->execute(@condvals); +%perl> + <& dumptable, sth => $sth &> +<%perl> +} + +%perl>