Escape ISO8859-1 characters. msgmerge still hates these strings, but at
[koha.git] / marc / benchmarks / getdata-steve
1 #!/usr/bin/perl
2 #
3 #
4 # Benchmark script for Steve's marc db schema
5
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 $max=$ARGV[2];
15 my $bibid=$ARGV[3];
16 ($max) || ($max=79998);
17
18
19 for ($i=0; $i<$count; $i++) {
20     ($bibid) || ($bibid=int(rand($max))+1);
21
22     ($print) && (print "BIBID: $bibid\n");
23     my $sth=$dbh->prepare("select tagid,tag,subfieldcode,subfieldvalue from marc_subfield_table where bibid=$bibid order by tagid,subfieldorder");
24     $sth->execute;
25     my $lasttag='';
26     while (my ($tagid,$tag,$subfieldcode,$subfieldvalue) = $sth->fetchrow) {
27         if ($tag ne $lasttag) {
28             ($print) && (print "  Tag: $tag\n");
29             $lasttag=$tag;
30         }
31         ($print) && (print "    $subfieldcode $subfieldvalue\n");
32     }
33     $bibid=0;
34 }