summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2015-09-06 03:35:36 +0200
committerYorhel <git@yorhel.nl>2015-09-06 03:35:36 +0200
commit19ce5fcf536ed478ad34b6b1014bf6f44841d25d (patch)
tree772556d6df88dc204f2a9dbe3d0cb118d94cc3cf /lib/VNDB/DB
parent6e0def1868b20ef1174d06c4bd8655548c024302 (diff)
SQL: Convert threads_board.type to ENUM
The char(2) solution is both inefficient and ugly. Also needed to be careful with handling the extra space that Postgres would automatically add to single-character types.
Diffstat (limited to 'lib/VNDB/DB')
-rw-r--r--lib/VNDB/DB/Discussions.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/VNDB/DB/Discussions.pm b/lib/VNDB/DB/Discussions.pm
index 9da25384..574560a0 100644
--- a/lib/VNDB/DB/Discussions.pm
+++ b/lib/VNDB/DB/Discussions.pm
@@ -70,7 +70,7 @@ sub dbThreadGet {
} 0..$#$r;
if($o{what} =~ /boards/) {
- ($_->{type}=~s/ +//||1) && push(@{$r->[$r{$_->{tid}}]{boards}}, [ $_->{type}, $_->{iid} ]) for (@{$self->dbAll(q|
+ push(@{$r->[$r{$_->{tid}}]{boards}}, [ $_->{type}, $_->{iid} ]) for (@{$self->dbAll(q|
SELECT tid, type, iid
FROM threads_boards
WHERE tid IN(!l)|,
@@ -78,7 +78,7 @@ sub dbThreadGet {
)});
}
if($o{what} =~ /boardtitles/) {
- ($_->{type}=~s/ +//||1) && push(@{$r->[$r{$_->{tid}}]{boards}}, $_) for (@{$self->dbAll(q|
+ push(@{$r->[$r{$_->{tid}}]{boards}}, $_) for (@{$self->dbAll(q|
SELECT tb.tid, tb.type, tb.iid, COALESCE(u.username, vr.title, pr.name) AS title, COALESCE(u.username, vr.original, pr.original) AS original
FROM threads_boards tb
LEFT JOIN vn v ON tb.type = 'v' AND v.id = tb.iid