Koha/marc/benchmarks/getdata-steve
2002-05-30 19:55:18 +00:00

34 lines
815 B
Perl

#!/usr/bin/perl
#
#
# Benchmark script for Steve's marc db schema
use DBI;
my $dbh=DBI->connect("dbi:mysql:kohabenchmark", 'youruserid', 'yourpassword');
my $count=$ARGV[0];
my $print=$ARGV[1];
my $max=$ARGV[2];
my $bibid=$ARGV[3];
($max) || ($max=79998);
for ($i=0; $i<$count; $i++) {
($bibid) || ($bibid=int(rand($max))+1);
($print) && (print "BIBID: $bibid\n");
my $sth=$dbh->prepare("select tagid,tag,subfieldcode,subfieldvalue from marc_subfield_table where bibid=$bibid order by tagid,subfieldorder");
$sth->execute;
my $lasttag='';
while (my ($tagid,$tag,$subfieldcode,$subfieldvalue) = $sth->fetchrow) {
if ($tag ne $lasttag) {
($print) && (print " Tag: $tag\n");
$lasttag=$tag;
}
($print) && (print " $subfieldcode $subfieldvalue\n");
}
$bibid=0;
}