summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB/Chars.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2011-02-16 19:24:13 +0100
committerYorhel <git@yorhel.nl>2011-02-16 19:24:13 +0100
commit49a2516e6b076667e163aaff2ae2e94ed52fa083 (patch)
tree46d864db6670f8304353027ad2ea6eec36cff23a /lib/VNDB/DB/Chars.pm
parentcd7b3f34173dfeceec03691957c95f4d4ab9cf47 (diff)
chardb: Added image to character entries
Diffstat (limited to 'lib/VNDB/DB/Chars.pm')
-rw-r--r--lib/VNDB/DB/Chars.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/VNDB/DB/Chars.pm b/lib/VNDB/DB/Chars.pm
index b12c4425..3f744239 100644
--- a/lib/VNDB/DB/Chars.pm
+++ b/lib/VNDB/DB/Chars.pm
@@ -5,7 +5,7 @@ use strict;
use warnings;
use Exporter 'import';
-our @EXPORT = qw|dbCharGet dbCharRevisionInsert|;
+our @EXPORT = qw|dbCharGet dbCharRevisionInsert dbCharImageId|;
# options: id rev what results page
@@ -26,7 +26,7 @@ sub dbCharGet {
);
my @select = qw|c.id cr.name cr.original|;
- push @select, qw|c.hidden c.locked cr.alias cr.desc| if $o{what} =~ /extended/;
+ push @select, qw|c.hidden c.locked cr.alias cr.desc cr.image| if $o{what} =~ /extended/;
push @select, qw|h.requester h.comments c.latest u.username h.rev h.ihid h.ilock|, "extract('epoch' from h.added) as added", 'cr.id AS cid' if $o{what} =~ /changes/;
my @join;
@@ -51,10 +51,16 @@ sub dbCharRevisionInsert {
my($self, $o) = @_;
my %set = map exists($o->{$_}) ? (qq|"$_" = ?|, $o->{$_}) : (),
- qw|name original alias desc|;
+ qw|name original alias desc image|;
$self->dbExec('UPDATE edit_char !H', \%set) if keys %set;
}
+# fetches an ID for a new image
+sub dbCharImageId {
+ return shift->dbRow("SELECT nextval('charimg_seq') AS ni")->{ni};
+}
+
+
1;