Benchmark script for sergey's schema
authortonnesen <tonnesen>
Thu, 30 May 2002 19:58:24 +0000 (19:58 +0000)
committertonnesen <tonnesen>
Thu, 30 May 2002 19:58:24 +0000 (19:58 +0000)
marc/benchmarks/getdata-sergey [new file with mode: 0644]

diff --git a/marc/benchmarks/getdata-sergey b/marc/benchmarks/getdata-sergey
new file mode 100644 (file)
index 0000000..be4e15d
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+#
+#
+# Benchmark script for Sergey'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 F.tag,S.subfieldcode,S.subfieldvalue from marc_field_table_sergey F,marc_subfield_table_sergey S where F.fieldid=S.fieldid and F.bibid=$bibid order by F.fieldid,S.subfieldorder");
+    $sth->execute;
+    my $lasttag='';
+    while (my ($tag,$subfieldcode,$subfieldvalue) = $sth->fetchrow) {
+       if ($tag ne $lasttag) {
+           ($print) && (print "  Tag: $tag\n");
+           $lasttag=$tag;
+       }
+       ($print) && (print "    $subfieldcode $subfieldvalue\n");
+    }
+    $bibid=0;
+}