use unix timestamps

git-svn-id: http://yolanda.mister-muffin.de/svn@97 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
josch 2007-10-20 00:41:21 +00:00
parent a1614613eb
commit 1c155bdcad
3 changed files with 6 additions and 6 deletions

View file

@ -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,

View file

@ -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;

View file

@ -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;
}