path: root/lib/VNDB/DB/
diff options
authorYorhel <>2015-10-21 02:19:15 +0200
committerYorhel <>2015-10-21 02:28:48 +0200
commit9cf3eef0e0a7bde10a0e1bb8c94c38b058e5121d (patch)
tree9cbd3a439316bdfe3946cc80378e4f95a9d6e6db /lib/VNDB/DB/
parent718f4d0258049aa92f229c08d5ec7204dae3ffa6 (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/')
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/VNDB/DB/ b/lib/VNDB/DB/
index 0a8f5363..eafb84c0 100644
--- a/lib/VNDB/DB/
+++ b/lib/VNDB/DB/
@@ -203,38 +203,38 @@ sub dbReleaseRevisionInsert {
my %set = map exists($o->{$_}) ? ("$_ = ?", $o->{$_}) : (),
qw|title original gtin catalog website released notes minage type
patch resolution voiced freeware doujin ani_story ani_ero|;
- $self->dbExec('UPDATE edit_release !H', \%set) if keys %set;
+ $self->dbExec('UPDATE edit_releases !H', \%set) if keys %set;
if($o->{languages}) {
- $self->dbExec('DELETE FROM edit_release_lang');
+ $self->dbExec('DELETE FROM edit_releases_lang');
my $q = join ',', map '(?)', @{$o->{languages}};
- $self->dbExec("INSERT INTO edit_release_lang (lang) VALUES $q", @{$o->{languages}}) if @{$o->{languages}};
+ $self->dbExec("INSERT INTO edit_releases_lang (lang) VALUES $q", @{$o->{languages}}) if @{$o->{languages}};
if($o->{producers}) {
- $self->dbExec('DELETE FROM edit_release_producers');
+ $self->dbExec('DELETE FROM edit_releases_producers');
my $q = join ',', map '(?,?,?)', @{$o->{producers}};
my @q = map +($_->[0], $_->[1]?1:0, $_->[2]?1:0), @{$o->{producers}};
- $self->dbExec("INSERT INTO edit_release_producers (pid, developer, publisher) VALUES $q", @q) if @q;
+ $self->dbExec("INSERT INTO edit_releases_producers (pid, developer, publisher) VALUES $q", @q) if @q;
if($o->{platforms}) {
- $self->dbExec('DELETE FROM edit_release_platforms');
+ $self->dbExec('DELETE FROM edit_releases_platforms');
my $q = join ',', map '(?)', @{$o->{platforms}};
- $self->dbExec("INSERT INTO edit_release_platforms (platform) VALUES $q", @{$o->{platforms}}) if @{$o->{platforms}};
+ $self->dbExec("INSERT INTO edit_releases_platforms (platform) VALUES $q", @{$o->{platforms}}) if @{$o->{platforms}};
if($o->{vn}) {
- $self->dbExec('DELETE FROM edit_release_vn');
+ $self->dbExec('DELETE FROM edit_releases_vn');
my $q = join ',', map '(?)', @{$o->{vn}};
- $self->dbExec("INSERT INTO edit_release_vn (vid) VALUES $q", @{$o->{vn}}) if @{$o->{vn}};
+ $self->dbExec("INSERT INTO edit_releases_vn (vid) VALUES $q", @{$o->{vn}}) if @{$o->{vn}};
if($o->{media}) {
- $self->dbExec('DELETE FROM edit_release_media');
+ $self->dbExec('DELETE FROM edit_releases_media');
my $q = join ',', map '(?,?)', @{$o->{media}};
my @q = map +($_->[0], $_->[1]), @{$o->{media}};
- $self->dbExec("INSERT INTO edit_release_media (medium, qty) VALUES $q", @q) if @q;
+ $self->dbExec("INSERT INTO edit_releases_media (medium, qty) VALUES $q", @q) if @q;