summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB/Chars.pm
diff options
context:
space:
mode:
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;