diff options
author | Yorhel <git@yorhel.nl> | 2011-02-16 16:14:30 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2011-02-16 16:14:30 +0100 |
commit | cd7b3f34173dfeceec03691957c95f4d4ab9cf47 (patch) | |
tree | 819817f5e60ef4c8af7b98aba8264b0954970e8b /lib/VNDB/DB | |
parent | 24680d31a5a3433db5fd0140d9cb80b371659342 (diff) |
chardb: Added character add/edit form + misc. fixes
Diffstat (limited to 'lib/VNDB/DB')
-rw-r--r-- | lib/VNDB/DB/Chars.pm | 13 | ||||
-rw-r--r-- | lib/VNDB/DB/Misc.pm | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/VNDB/DB/Chars.pm b/lib/VNDB/DB/Chars.pm index a1866fcf..b12c4425 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|; +our @EXPORT = qw|dbCharGet dbCharRevisionInsert|; # options: id rev what results page @@ -45,5 +45,16 @@ sub dbCharGet { } +# Updates the edit_* tables, used from dbItemEdit() +# Arguments: { columns in chars_rev }, +sub dbCharRevisionInsert { + my($self, $o) = @_; + + my %set = map exists($o->{$_}) ? (qq|"$_" = ?|, $o->{$_}) : (), + qw|name original alias desc|; + $self->dbExec('UPDATE edit_char !H', \%set) if keys %set; +} + + 1; diff --git a/lib/VNDB/DB/Misc.pm b/lib/VNDB/DB/Misc.pm index 5fdad302..4b31ebb4 100644 --- a/lib/VNDB/DB/Misc.pm +++ b/lib/VNDB/DB/Misc.pm @@ -40,6 +40,7 @@ sub dbItemEdit { $self->dbVNRevisionInsert( \%o) if $type eq 'v'; $self->dbProducerRevisionInsert(\%o) if $type eq 'p'; $self->dbReleaseRevisionInsert( \%o) if $type eq 'r'; + $self->dbCharRevisionInsert( \%o) if $type eq 'c'; return $self->dbRow('SELECT * FROM edit_!s_commit()', $fun); } |