[Koha-cvs] CVS: koha/updater updatedatabase2.pl,1.2,1.3

Paul POULAIN tipaul at users.sourceforge.net
Mon Jun 24 17:00:16 CEST 2002


Update of /cvsroot/koha/koha/updater
In directory usw-pr-cvs1:/tmp/cvs-serv22982/updater

Modified Files:
	updatedatabase2.pl 
Log Message:
merging rel-1-2 and main


Index: updatedatabase2.pl
===================================================================
RCS file: /cvsroot/koha/koha/updater/updatedatabase2.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** updatedatabase2.pl	2 May 2002 09:19:50 -0000	1.2
--- updatedatabase2.pl	24 Jun 2002 15:00:13 -0000	1.3
***************
*** 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
--- 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
***************
*** 126,130 ****
  	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");
--- 126,130 ----
  	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");





More information about the Koha-cvs mailing list