--- db/prgsrc/mkdb.pl 2000/11/11 00:23:20 1.8 +++ db/prgsrc/mkdb.pl 2005/07/05 21:27:12 1.18 @@ -23,7 +23,7 @@ The database, user and password are hard Dmitry Rubinstein -=head1 $Id: mkdb.pl,v 1.8 2000/11/11 00:23:20 boris Exp $ +=head1 $Id: mkdb.pl,v 1.18 2005/07/05 21:27:12 boris Exp $ =cut @@ -37,7 +37,7 @@ sub CheckTable my ($TabName) = @_; my ($ans); - if (scalar(grep(/^$TabName$/, @tbl_list))) { + if (scalar(grep(/^$TabName$/i, @tbl_list))) { print "Table $TabName exists. Do you want to delete it? "; $ans = ; if ($ans =~ /[yY]/) { @@ -57,7 +57,7 @@ print "Before connecting to the DB\n"; or die "Can't connect to DB chgk\n" . $dbh->errstr; print "Connected successfully\n"; - @tbl_list = $dbh->func( '_ListTables' ); + @tbl_list = $dbh->tables(); &CheckTable("Questions"); $dbh->do("CREATE TABLE Questions ( @@ -67,14 +67,18 @@ print "Connected successfully\n"; KEY ParentIdKey (ParentId), Number SMALLINT UNSIGNED NOT NULL, KEY NumberKey (Number), - Type TEXT NOT NULL, + Type CHAR(5) NOT NULL DEFAULT 'þ', + KEY TypeKey (Type), Question TEXT, Answer TEXT, + PassCriteria TEXT, Authors TEXT, Sources TEXT, Comments TEXT, - Rating TEXT - )") + Rating TEXT, + Topic TEXT, + ProcessedBySearch INT + ) TYPE=MyISAM") or die "Can't create Questions table: $!\n"; &CheckTable("Tournaments"); @@ -85,6 +89,7 @@ print "Connected successfully\n"; ParentId INT UNSIGNED NOT NULL, KEY ParentIdKey (ParentId), Title TINYTEXT NOT NULL, + Number SMALLINT UNSIGNED, QuestionsNum INT UNSIGNED DEFAULT 0, Type ENUM('ç','ô','þ'), Copyright TEXT, @@ -95,7 +100,7 @@ print "Connected successfully\n"; EnteredBy TEXT, PlayedAt DATE, CreatedAt DATE NOT NULL - )") + ) TYPE=MyISAM") or die "Can't create Tournaments table: $!\n"; # CREATE INDEX ParentInd ON Tournaments (ParentId)