From 94d337f15a241912a92b7359bc4b57e0757c5bdf Mon Sep 17 00:00:00 2001 From: josch Date: Thu, 11 Oct 2007 22:42:21 +0000 Subject: [PATCH] initial version git-svn-id: http://yolanda.mister-muffin.de/svn@39 7eef14d0-6ed0-489d-bf55-20463b2d70db --- trunk/init_sql.pl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 trunk/init_sql.pl diff --git a/trunk/init_sql.pl b/trunk/init_sql.pl new file mode 100644 index 0000000..5672885 --- /dev/null +++ b/trunk/init_sql.pl @@ -0,0 +1,27 @@ +#!/usr/bin/perl +require "include.pl"; + +#create or resume session +CGI::Session->name($session_name); +my $session = new CGI::Session; + +my $dbh = DBI->connect("DBI:mysql:$database:$host", $dbuser, $dbpass) or die $dbh->errstr; + +$dbh->do(qq{drop table users}); + +$dbh->do(qq{drop table videos}); + +$dbh->do(qq{drop table tagcloud}); + +$dbh->do(qq{create table tagcloud (text varchar(255) not null, count int not null)}); + +$dbh->do(qq{insert into tagcloud values ('web tv', 68)}); + +$dbh->do(qq{create table users (id int auto_increment not null, username varchar(255) not null, password char(41) not null, sid char(32) not null, primary key (id))}); + +$dbh->do(qq{create table videos (id int auto_increment not null, title varchar(255) not null, caption text, userid varchar(255) not null, hash char(64) not null, status int not null, primary key (id), fulltext (title, caption))}); + +$dbh->disconnect() or die $dbh->errstr; + +print $session->header(); +print "initiated database";