small fixes : opac lib is the same as librarian lib by default.
[koha.git] / marc / benchmarks / getdata-sergey
1 #!/usr/bin/perl
2 #
3 #
4 # Benchmark script for Sergey's marc db schema
5
6
7 use DBI;
8
9 my $dbh=DBI->connect("dbi:mysql:kohabenchmark", 'youruserid', 'yourpassword');
10
11 my $count=$ARGV[0];
12 my $print=$ARGV[1];
13 my $max=$ARGV[2];
14 my $bibid=$ARGV[3];
15 ($max) || ($max=79998);
16
17
18 for ($i=0; $i<$count; $i++) {
19     ($bibid) || ($bibid=int(rand($max))+1);
20     ($print) && (print "BIBID: $bibid\n");
21     my $sth=$dbh->prepare("select F.tag,S.subfieldcode,S.subfieldvalue from marc_field_table_sergey F,marc_subfield_table_sergey S where F.fieldid=S.fieldid and F.bibid=$bibid order by F.fieldid,S.subfieldorder");
22     $sth->execute;
23     my $lasttag='';
24     while (my ($tag,$subfieldcode,$subfieldvalue) = $sth->fetchrow) {
25         if ($tag ne $lasttag) {
26             ($print) && (print "  Tag: $tag\n");
27             $lasttag=$tag;
28         }
29         ($print) && (print "    $subfieldcode $subfieldvalue\n");
30     }
31     $bibid=0;
32 }