[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-devel] CVS: koha/updater updatedatabase2.pl,1.1,1.2
From: |
Paul POULAIN |
Subject: |
[Koha-devel] CVS: koha/updater updatedatabase2.pl,1.1,1.2 |
Date: |
Thu May 2 02:20:30 2002 |
Update of /cvsroot/koha/koha/updater
In directory usw-pr-cvs1:/tmp/cvs-serv32641/updater
Modified Files:
updatedatabase2.pl
Log Message:
updated database.mysql : dropped unused tables, created indexes : old
database.mysql updated by updatedatabase2.pl script
Index: updatedatabase2.pl
===================================================================
RCS file: /cvsroot/koha/koha/updater/updatedatabase2.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** updatedatabase2.pl 19 Mar 2002 15:39:31 -0000 1.1
--- updatedatabase2.pl 2 May 2002 09:19:50 -0000 1.2
***************
*** 43,75 ****
my $dbh=C4Connect;
- my %tables;
my $sth=$dbh->prepare("show tables");
$sth->execute;
while (my ($table) = $sth->fetchrow) {
$tables{$table}=1;
}
! print "creating thesaurus...\n";
! dosql($dbh,"CREATE TABLE bibliothesaurus (code BIGINT not null
AUTO_INCREMENT, freelib CHAR (255) not null , stdlib CHAR (255) not null , type
CHAR (80) not null , PRIMARY KEY (code), INDEX
(freelib),index(stdlib),index(type))");
! my $sti=$dbh->prepare("select subject from bibliosubject");
! $sti->execute;
! $i=0;
! while ($line =$sti->fetchrow_hashref) {
! $i++;
# print "$i $line->{'subject'}\n";
! $sti2=$dbh->prepare("select count(*) as t from bibliothesaurus
where freelib=".$dbh->quote($line->{'subject'}));
! $sti2->execute;
! if ($sti2->err) {
! print "error : ".$sti2->errstr." \n tried to execute :
$sql_cmd\n";
! die;
! }
! $line2=$sti2->fetchrow_hashref;
! if ($line2->{'t'} ==0) {
! dosql($dbh,"insert into bibliothesaurus
(freelib,stdlib) values
(".$dbh->quote($line->{'subject'}).",".$dbh->quote($line->{'subject'}).")");
! } else {
! print "pas ecriture pour : $line->{'subject'}\n";
! }
!
! }
#aqbookfund : the sample db is full of trash data. Delete and recreate
--- 43,75 ----
my $dbh=C4Connect;
my $sth=$dbh->prepare("show tables");
$sth->execute;
while (my ($table) = $sth->fetchrow) {
$tables{$table}=1;
+ print "table $table\n";
}
! #print "creating thesaurus...\n";
! #dosql($dbh,"CREATE TABLE bibliothesaurus (code BIGINT not null
AUTO_INCREMENT, freelib CHAR (255) not null , stdlib CHAR (255) not null , type
CHAR (80) not null , PRIMARY KEY (code), INDEX
(freelib),index(stdlib),index(type))");
! # my $sti=$dbh->prepare("select subject from bibliosubject");
! # $sti->execute;
! # $i=0;
! # while ($line =$sti->fetchrow_hashref) {
! # $i++;
# print "$i $line->{'subject'}\n";
! # $sti2=$dbh->prepare("select count(*) as t from bibliothesaurus
where freelib=".$dbh->quote($line->{'subject'}));
! # $sti2->execute;
! # if ($sti2->err) {
! # print "error : ".$sti2->errstr." \n tried to execute :
$sql_cmd\n";
! # die;
! # }
! # $line2=$sti2->fetchrow_hashref;
! # if ($line2->{'t'} ==0) {
! # dosql($dbh,"insert into bibliothesaurus
(freelib,stdlib) values
(".$dbh->quote($line->{'subject'}).",".$dbh->quote($line->{'subject'}).")");
! # } else {
! # print "pas ecriture pour : $line->{'subject'}\n";
! # }
! #
! # }
#aqbookfund : the sample db is full of trash data. Delete and recreate
***************
*** 124,130 ****
dosql($dbh,"ALTER TABLE aqorderdelivery DROP PRIMARY KEY, ADD PRIMARY
KEY(ordernumber);");
dosql($dbh,"ALTER TABLE aqorders DROP PRIMARY KEY, ADD PRIMARY
KEY(ordernumber);");
! dosql($dbh,"ALTER TABLE biblio DROP PRIMARY KEY, ADD PRIMARY
KEY(biblionumber, biblionumber);");
dosql($dbh,"ALTER TABLE biblioitems DROP PRIMARY KEY, ADD PRIMARY
KEY(biblionumber, biblioitemnumber)");
! dosql($dbh,"CREATE INDEX SUBTITLE ON bibliosubtitle (subtitle(80))");
dosql($dbh,"ALTER TABLE borexp CHANGE borrowernumber borrowernumber INT
(11) not null");
dosql($dbh,"ALTER TABLE borexp CHANGE newexp newexp DATE not null");
--- 124,130 ----
dosql($dbh,"ALTER TABLE aqorderdelivery DROP PRIMARY KEY, ADD PRIMARY
KEY(ordernumber);");
dosql($dbh,"ALTER TABLE aqorders DROP PRIMARY KEY, ADD PRIMARY
KEY(ordernumber);");
! dosql($dbh,"ALTER TABLE biblio DROP PRIMARY KEY, ADD PRIMARY
KEY(biblionumber);");
dosql($dbh,"ALTER TABLE biblioitems DROP PRIMARY KEY, ADD PRIMARY
KEY(biblionumber, biblioitemnumber)");
! # dosql($dbh,"CREATE INDEX SUBTITLE ON bibliosubtitle (subtitle(80))");
dosql($dbh,"ALTER TABLE borexp CHANGE borrowernumber borrowernumber INT
(11) not null");
dosql($dbh,"ALTER TABLE borexp CHANGE newexp newexp DATE not null");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-devel] CVS: koha/updater updatedatabase2.pl,1.1,1.2,
Paul POULAIN <=