my $tsquery = join(' & ', split(/\s+/,$query) );
+ my $table = lc $self->{database};
+ $table =~ s/^crosbi-//g;
+
my $sql = qq{
select *
-from casopis
+from $table
inner join rad_ustanova using (id)
left outer join rad_napomena using (id)
left outer join rad_projekt using (id)
my $dbh = DBI->connect_cached("dbi:Pg:dbname=$dbname", '', '', {AutoCommit => 0});
- my $sth = $dbh->prepare( $sql );
-
warn "XXX SQL = ",$sql;
-#-- and naslov like ?
+ my $sth = $dbh->prepare( $sql );
$sth->execute(
130, # FIXME ustanova
'DPLA' => 'DPLA',
'MKUTUP' => 'AlephTR',
'CROSBI' => 'CROSBI',
+ 'CROSBI-CASOPIS' => 'CROSBI',
+ 'CROSBI-PREPRINT' => 'CROSBI',
};
my $max_records = 10; # XXX configure this
ok( my $o = CROSBI->new(), 'new' );
+foreach my $database ( qw( CROSBI-CASOPIS CROSBI-PREPRINT ) ) {
+ diag $o->{database} = $database;
+
ok( my $hits = $o->search( $search ), "search: $search" );
like $hits, qr/^\d+$/, "hits: $hits";
diag "SQL", $o->{sql};
-foreach ( 1 .. 3 ) {
+foreach ( 1 .. $hits ) {
ok( my $marc = $o->next_marc, "next_marc $_" );
diag $marc;
}
+
+} # database