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

32 lines
795 B
Perl

#!/usr/bin/perl
#
#
# Benchmark script for Paul's marc db schema using split() to separate subfield
# code from subfield value
use DBI;
my $dbh=DBI->connect("dbi:mysql:kohabenchmark", 'youruserid', 'yourpassword');
my $count=$ARGV[0];
my $print=$ARGV[1];
my $bibid=$ARGV[2];
for ($i=0; $i<$count; $i++) {
($bibid) || ($bibid=int(rand(79998))+1);
($print) && (print "BIBID: $bibid\n");
my $sth=$dbh->prepare("select tagnumber,tagvalue from marc_0XX_tag_table where bibcode=$bibid order by tagorder");
$sth->execute;
while (my ($tagnumber, $tagvalue) = $sth->fetchrow) {
($print) && (print " Tag: $tagnumber\n");
foreach (split(/\0/, $tagvalue)) {
my ($code, $value) = split(/\s/, $_, 2);
($print) && (print " $code $value\n");
}
}
$bibid=0;
}