summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-08-08 16:41:34 +0200
committerYorhel <git@yorhel.nl>2009-08-08 16:41:34 +0200
commit1e2a5c75f0154a12af7d19929153c27c75d193b1 (patch)
treed3a949969ef8ecc8d3c06f70238c8e5fe439e65f /lib
parentc90e590bdbe7933df8e8a0d83c82dddfa22afc37 (diff)
Converted threads_posts.date and edited to timestamptz
Everything still seems to be working fine so far.
Diffstat (limited to 'lib')
-rw-r--r--lib/Multi/IRC.pm2
-rw-r--r--lib/VNDB/DB/Discussions.pm10
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/Multi/IRC.pm b/lib/Multi/IRC.pm
index 2373178b..84f307d9 100644
--- a/lib/Multi/IRC.pm
+++ b/lib/Multi/IRC.pm
@@ -268,7 +268,7 @@ sub notify { # name, pid, payload
FROM threads_posts tp
JOIN threads t ON t.id = tp.tid
JOIN users u ON u.id = tp.uid
- WHERE tp.date > ?
+ WHERE tp.date > to_timestamp(?)
ORDER BY tp.date|
: q|SELECT
'g' AS type, t.id, t.name AS title, u.username
diff --git a/lib/VNDB/DB/Discussions.pm b/lib/VNDB/DB/Discussions.pm
index 5e371fbc..26beaaee 100644
--- a/lib/VNDB/DB/Discussions.pm
+++ b/lib/VNDB/DB/Discussions.pm
@@ -32,8 +32,8 @@ sub dbThreadGet {
my @select = (
qw|t.id t.title t.count t.locked t.hidden|,
- $o{what} =~ /firstpost/ ? ('tpf.uid AS fuid', 'tpf.date AS fdate', 'uf.username AS fusername') : (),
- $o{what} =~ /lastpost/ ? ('tpl.uid AS luid', 'tpl.date AS ldate', 'ul.username AS lusername') : (),
+ $o{what} =~ /firstpost/ ? ('tpf.uid AS fuid', q|EXTRACT('epoch' from tpf.date) AS fdate|, 'uf.username AS fusername') : (),
+ $o{what} =~ /lastpost/ ? ('tpl.uid AS luid', q|EXTRACT('epoch' from tpl.date) AS ldate|, 'ul.username AS lusername') : (),
);
my @join = (
@@ -170,7 +170,7 @@ sub dbPostGet {
$o{uid} ? (
'tp.uid = ?' => $o{uid} ) : (),
$o{mindate} ? (
- 'tp.date > ?' => $o{mindate} ) : (),
+ 'tp.date > to_timestamp(?)' => $o{mindate} ) : (),
$o{hide} ? (
'tp.hidden = FALSE' => 1 ) : (),
$o{hide} && $o{what} =~ /thread/ ? (
@@ -178,7 +178,7 @@ sub dbPostGet {
);
my @select = (
- qw|tp.num tp.date tp.edited tp.msg tp.hidden|,
+ qw|tp.num tp.msg tp.hidden|, q|extract('epoch' from tp.date) as date|, q|extract('epoch' from tp.edited) as edited|,
$o{what} =~ /user/ ? qw|tp.uid u.username| : (),
$o{what} =~ /thread/ ? (qw|tp.tid t.title|, 't.hidden AS thread_hidden') : (),
);
@@ -206,7 +206,7 @@ sub dbPostEdit {
my %set = (
'msg = ?' => $o{msg},
- 'edited = ?' => $o{lastmod},
+ 'edited = to_timestamp(?)' => $o{lastmod},
'hidden = ?' => $o{hidden}?1:0,
);