#!/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", 'root', 'testpass'); 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; }