koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/misc marc_into_authority.pl


From: Tumer Garip
Subject: [Koha-cvs] koha/misc marc_into_authority.pl
Date: Sat, 20 May 2006 00:03:14 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         
Changes by:     Tumer Garip <address@hidden>    06/05/20 00:03:14

Modified files:
        misc           : marc_into_authority.pl 

Log message:
        Alter auth_subfield_structure table as well incase somebody uses 
thisprior to updating database

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/misc/marc_into_authority.pl.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: koha/misc/marc_into_authority.pl
diff -u koha/misc/marc_into_authority.pl:1.3 
koha/misc/marc_into_authority.pl:1.4
--- koha/misc/marc_into_authority.pl:1.3        Fri May 19 23:17:42 2006
+++ koha/misc/marc_into_authority.pl    Sat May 20 00:03:14 2006
@@ -24,7 +24,7 @@
 }
 
 ##Update the database if missing fields;
- $dbh->do("LOCK TABLES auth_header WRITE auth_subfield_table READ");
+ $dbh->do("LOCK TABLES auth_header WRITE, auth_subfield_structure WRITE , 
auth_subfield_table READ");
 unless ($columns{'linkid'}){
 my $sth=$dbh->prepare("ALTER TABLE auth_header  ADD COLUMN `linkid` BIGINT(20) 
UNSIGNED NOT NULL DEFAULT 0 ");
 $sth->execute();
@@ -33,7 +33,31 @@
 my $sth=$dbh->prepare("ALTER TABLE auth_header  ADD COLUMN `marc` BLOB  NOT 
NULL DEFAULT 0 ");
 $sth->execute();
 }
-
+###Chechk auth_subfield_structure as well. User may have forgotten to update 
database
+my $sthcols=$dbh->prepare("show columns from auth_subfield_structure");
+$sthcols->execute();
+my %columns;
+while (( my $cols)=$sthcols->fetchrow){
+$columns{$cols}=1;
+}
+##Update the database if missing fields;
+ $dbh->do("LOCK TABLES auth_header WRITE, auth_subfield_structure WRITE , 
auth_subfield_table READ");
+unless ($columns{'link'}){
+my $sth=$dbh->prepare("ALTER TABLE auth_subfield_structure ADD COLUMN `link` 
TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 ");
+$sth->execute();
+}
+unless ($columns{'isurl'}){
+my $sth=$dbh->prepare("ALTER TABLE auth_subfield_structure ADD COLUMN `isurl` 
TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 ");
+$sth->execute();
+}
+unless ($columns{'hidden'}){
+my $sth=$dbh->prepare("ALTER TABLE auth_subfield_structure ADD COLUMN `hidden` 
TINYINT(3) UNSIGNED NOT NULL ZEROFILL DEFAULT 000 ");
+$sth->execute();
+}
+unless ($columns{'kohafield'}){
+my $sth=$dbh->prepare("ALTER TABLE auth_subfield_structure  ADD COLUMN 
`kohafield` VARCHAR(45)  NOT NULL  ");
+$sth->execute();
+}
 my $sth=$dbh->prepare("select authid,authtypecode from auth_header  ");
        $sth->execute();
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]