-# $Id: Named.pm,v 1.3 2007-03-05 12:53:57 mike Exp $
# See the "Main" test package for documentation
$conn->log('irspy_test', 'Testing for named resultset support');
$conn->irspy_search_pqf("\@attr 1=4 mineral", {},
- {'setname' => 'a', 'start' => 0, 'count' => 0},
+ {'setname' => 'a', 'start' => 0, 'count' => 0},
ZOOM::Event::ZEND, \&completed_search_a,
exception => \&error);
}
my $record = '';
my $hits = $rs->size();
- ## How should we handle the situation when there is 0 hits?
- if ($hits > 0) {
+ if ($hits == 0) {
+ ### We should try other searches as in Record::Fetch
+ $rs->destroy();
+ return ZOOM::IRSpy::Status::TEST_BAD;
+ } else {
my $rsrec = $rs->record(0);
if (!defined $rsrec) {
# I thought this was a "can't happen", but it sometimes
# does, as for example documented for
# kat.vkol.cz:9909/svk02 at ../../../../../tmp/bad-run-1
+ $rs->destroy();
eval { $conn->check() };
return error($conn, $task, $test_args, $@);
}
my $record = '';
my $error = '';
+ $task->{rs}->destroy(); # We only care about the original search
$rs->cache_reset();
- if ($test_args->{'hits_a'} > 0) {
+ if ($test_args->{'hits_a'} == 0) {
+ die "can't happen: hits_a == 0";
+ } else {
my $hits = $rs->size();
- my $record = $rs->record(0)->raw();
+ my $rsrec = $rs->record(0);
+ if (!defined $rsrec) {
+ $rs->destroy();
+ eval { $conn->check() };
+ return error($conn, $task, $test_args, $@);
+ }
+ my $record = $rsrec->raw();
if ($hits != $test_args->{'hits_a'}) {
$conn->log('irspy_test', 'Named result set not supported: ',
$error = 'hitcount';
}
- if ($record ne $test_args->{'record_a'}) {
+ if (!defined $record || $record ne $test_args->{'record_a'}) {
$conn->log('irspy_test', 'Named result set not supported: ',
'Mis-matching records');
$error = 'record';
update($conn, $error eq '' ? 1 : 0, $error);
+ $rs->destroy();
return ZOOM::IRSpy::Status::TASK_DONE;
}
my($conn, $task, $test_args, $exception) = @_;
$conn->log("irspy_test", "Named resultset check failed:", $exception);
+ zoom_error_timeout_update($conn, $exception);
return ZOOM::IRSpy::Status::TASK_DONE;
}