3 # This script will check for required updates to the database. Would also be a
4 # good idea to offer to do a backup at this time...
17 my $sth=$dbh->prepare("show tables");
19 while (my ($table) = $sth->fetchrow) {
21 print "Table: $table\n";
26 # Add tables required by Z-3950 scripts
28 unless ($tables{'z3950queue') {
29 my $sti=$dbh->prepare("create table z3950queue (id int auto_increment primary key, term text, type char(10), startdate int, enddate int, done smallint, results longblob, numercords int, servers text, identifier char(30))");
33 unless ($tables{'z3950results'}) {
34 my $sti=$dbh->prepare("create table z3950results (id int auto_increment primary key, queryid int, server char(255), startdate int, enddate int, results longblob, numrecords int, numdownloaded int, highestseen int, active smallint)");
37 unless ($tables{'z3950servers'}) {
38 my $sti=$dbh->prepare("create table z3950servers (host char(255), port int, db char(255), userid char(255), password char(255), name text, id int, checked smallint, rank int)");
40 $sti=$dbh->prepare("insert into z3950servers values ('z3950.loc.gov', 7090, 'voyager', '', '', 'Library of Congress', 1, 1, 1)");
46 # Get list of columns from biblioitems table
48 my $sth=$dbh->prepare("show columns from biblioitems");
50 while (my ($column, $type, $null, $key, $default, $extra) = $sth->fetchrow) {
51 $types{$column}=$type;
53 unless ($types{'lccn'}) {
54 # Add LCCN field to biblioitems db
55 my $sti=$dbh->prepare("alter table biblioitems add column lccn char(25)");
58 unless ($types{'marc'}) {
59 # Add MARC field to biblioitems db (not used anymore)
60 my $sti=$dbh->prepare("alter table biblioitems add column marc text");