added timestamps to videos
git-svn-id: http://yolanda.mister-muffin.de/svn@42 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
b9351019df
commit
57c2e01b13
3 changed files with 5 additions and 4 deletions
|
@ -19,7 +19,7 @@ $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->do(qq{create table videos (id int auto_increment not null, title varchar(255) not null, caption text not null, userid varchar(255) not null, hash char(64) not null, status int not null, timestamp datetime not null, primary key (id), fulltext (title, caption))});
|
||||
|
||||
$dbh->disconnect() or die $dbh->errstr;
|
||||
|
||||
|
|
|
@ -22,13 +22,13 @@ if($query->param('query'))
|
|||
my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass) or die $dbh->errstr;
|
||||
|
||||
#prepare query
|
||||
my $sth = $dbh->prepare(qq{select title, caption from videos where match(title, caption) against('$search_query') }) or die $dbh->errstr;
|
||||
my $sth = $dbh->prepare(qq{select title, caption, timestamp from videos where match(title, caption) against('$search_query') }) or die $dbh->errstr;
|
||||
|
||||
#execute it
|
||||
$sth->execute() or die $dbh->errstr;
|
||||
|
||||
#get every returned value
|
||||
while (my ($title, $caption) = $sth->fetchrow_array())
|
||||
while (my ($title, $caption, $timestamp) = $sth->fetchrow_array())
|
||||
{
|
||||
#really obfuscated array/hash creation
|
||||
push @{ $page->{'results'}->{'result'} },
|
||||
|
@ -40,6 +40,7 @@ if($query->param('query'))
|
|||
{
|
||||
'rdf:about' => './videos/1050x700/4chan_city_mashup.ogg',
|
||||
'dc:title' => [$title]
|
||||
'dc:date' => [$timestamp]
|
||||
},
|
||||
'cc:License' =>
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ if($userid)
|
|||
# 3 - error: was not a valid video/format
|
||||
# 4 - error: video is a duplicate
|
||||
#do query
|
||||
$dbh->do(qq{insert into videos (title, caption, userid, status) values ('$title', '$caption', '$userid', 0)}) or die $dbh->errstr;
|
||||
$dbh->do(qq{insert into videos (title, caption, userid, status, timestamp) values ('$title', '$caption', '$userid', 0, now())}) or die $dbh->errstr;
|
||||
|
||||
#prepare query
|
||||
my $sth = $dbh->prepare(qq{select last_insert_id() }) or die $dbh->errstr;
|
||||
|
|
Loading…
Reference in a new issue