From 1c155bdcad03d402e5d3392e8461429d62425df0 Mon Sep 17 00:00:00 2001 From: josch Date: Sat, 20 Oct 2007 00:41:21 +0000 Subject: [PATCH] use unix timestamps git-svn-id: http://yolanda.mister-muffin.de/svn@97 7eef14d0-6ed0-489d-bf55-20463b2d70db --- trunk/init_sql.pl | 6 +++--- trunk/uploader.pl | 2 +- trunk/video.pl | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/trunk/init_sql.pl b/trunk/init_sql.pl index 8771efb..c738d21 100644 --- a/trunk/init_sql.pl +++ b/trunk/init_sql.pl @@ -49,7 +49,7 @@ $dbh->do(qq{create table description varchar(255) not null, userid int not null, status int not null, - timestamp datetime not null, + timestamp bigint not null, creator varchar(255) not null, subject varchar(255) not null, contributor varchar(255) not null, @@ -74,7 +74,7 @@ $dbh->do(qq{create table description varchar(255) not null, userid int not null, hash char(64) not null, - timestamp datetime not null, + timestamp bigint not null, creator varchar(255) not null, subject varchar(255) not null, contributor varchar(255) not null, @@ -88,7 +88,7 @@ $dbh->do(qq{create table sharealike bool not null, commercialuse bool not null, filesize int not null, - duration float not null, + duration int not null, width smallint not null, height smallint not null, fps float not null, diff --git a/trunk/uploader.pl b/trunk/uploader.pl index bbbb270..536c42b 100644 --- a/trunk/uploader.pl +++ b/trunk/uploader.pl @@ -26,7 +26,7 @@ if($userid) my $dbh = DBI->connect("DBI:mysql:$database:$host", $dbuser, $dbpass) or die $dbh->errstr; #make new entry for video into the databse - my $sth = $dbh->prepare(qq{insert into uploaded (title, description, userid, status, timestamp) values ( ?, ?, ?, 0, now())}) or die $dbh->errstr; + my $sth = $dbh->prepare(qq{insert into uploaded (title, description, userid, status, timestamp) values ( ?, ?, ?, 0, unix_timestamp())}) or die $dbh->errstr; $sth->execute($query->param("title"), $query->param("description"), $userid) or die $dbh->errstr; $sth->finish() or die $dbh->errstr; diff --git a/trunk/video.pl b/trunk/video.pl index a9e6fbe..4fbd8c9 100644 --- a/trunk/video.pl +++ b/trunk/video.pl @@ -25,14 +25,14 @@ if($query->param('title') or $query->param('id')) if($query->param('id')) { #prepare query - $sth = $dbh->prepare(qq{select id, title, description, userid, timestamp from videos where id = ? }) or die $dbh->errstr; + $sth = $dbh->prepare(qq{select id, title, description, userid, from_unixtime( timestamp ) from videos where id = ? }) or die $dbh->errstr; #execute it $rowcount = $sth->execute($query->param('id')) or die $dbh->errstr; } else { #prepare query - $sth = $dbh->prepare(qq{select id, title, description, userid, timestamp from videos where title = ? }) or die $dbh->errstr; + $sth = $dbh->prepare(qq{select id, title, description, userid, from_unixtime( timestamp ) from videos where title = ? }) or die $dbh->errstr; #execute it $rowcount = $sth->execute($query->param('title')) or die $dbh->errstr; }