New benchmark run to test Sergey's schema
[koha.git] / marc / benchmarks / getdata-paul
1 #!/usr/bin/perl
2 #
3 #
4 # Benchmark script for Paul's marc db schema using split() to separate subfield
5 # code from subfield value
6
7 use DBI;
8
9
10 my $dbh=DBI->connect("dbi:mysql:kohabenchmark", 'youruserid', 'yourpassword');
11
12 my $count=$ARGV[0];
13 my $print=$ARGV[1];
14 my $bibid=$ARGV[2];
15
16
17
18 for ($i=0; $i<$count; $i++) {
19     ($bibid) || ($bibid=int(rand(79998))+1);
20
21     ($print) && (print "BIBID: $bibid\n");
22     my $sth=$dbh->prepare("select tagnumber,tagvalue from marc_0XX_tag_table where bibcode=$bibid order by tagorder");
23     $sth->execute;
24     while (my ($tagnumber, $tagvalue) = $sth->fetchrow) {
25         ($print) && (print "  Tag: $tagnumber\n");
26         foreach (split(/\0/, $tagvalue)) {
27             my ($code, $value) = split(/\s/, $_, 2);
28             ($print) && (print "    $code $value\n");
29         }
30     }
31     $bibid=0;
32 }