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

33 lines
802 B
Perl

#!/usr/bin/perl
#
#
# Benchmark script for Paul's marc db schema using regex 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)) {
m#$(.) (.*)#;
my ($code, $value) = ($1, $2);
($print) && (print " $code $value\n");
}
}
$bibid=0;
}