diff options
author | Yorhel <git@yorhel.nl> | 2015-10-21 02:19:15 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2015-10-21 02:28:48 +0200 |
commit | 9cf3eef0e0a7bde10a0e1bb8c94c38b058e5121d (patch) | |
tree | 9cbd3a439316bdfe3946cc80378e4f95a9d6e6db /lib/VNDB/DB/Producers.pm | |
parent | 718f4d0258049aa92f229c08d5ec7204dae3ffa6 (diff) |
SQL: Fix editing + func.sql + triggers.sql + autocreate editing funcs
This changes quite a bit to the way the editing functions work. Because
these functions are very repetitive and it's easy to keep things out of
sync, I created a script to generate them automatically. I had to rename
a few function and table names for consistency to make this work.
Since database entries don't have a 'latest' column anymore, and since
the order in which tables are updated doesn't have to be fixed, I
dropped many of the SQL triggers and replaced them with a
edit_committed() function which is called from edit_*_commit() and
checks for stuff to be done.
Don't forget to run 'make' before importing the update script.
Diffstat (limited to 'lib/VNDB/DB/Producers.pm')
-rw-r--r-- | lib/VNDB/DB/Producers.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/VNDB/DB/Producers.pm b/lib/VNDB/DB/Producers.pm index a9636282..929e333b 100644 --- a/lib/VNDB/DB/Producers.pm +++ b/lib/VNDB/DB/Producers.pm @@ -110,13 +110,13 @@ sub dbProducerRevisionInsert { my %set = map exists($o->{$_}) ? (qq|"$_" = ?|, $o->{$_}) : (), qw|name original website l_wp type lang desc alias|; - $self->dbExec('UPDATE edit_producer !H', \%set) if keys %set; + $self->dbExec('UPDATE edit_producers !H', \%set) if keys %set; if($o->{relations}) { - $self->dbExec('DELETE FROM edit_producer_relations'); + $self->dbExec('DELETE FROM edit_producers_relations'); my $q = join ',', map '(?,?)', @{$o->{relations}}; my @q = map +($_->[1], $_->[0]), @{$o->{relations}}; - $self->dbExec("INSERT INTO edit_producer_relations (pid, relation) VALUES $q", @q) if @q; + $self->dbExec("INSERT INTO edit_producers_relations (pid, relation) VALUES $q", @q) if @q; } } |