From 0129cd78f1516df6d2af2a2eb81b58a039bfb1b5 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Fri, 17 Feb 2012 22:57:13 +0100 Subject: prefix --- videomv.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'videomv.pl') diff --git a/videomv.pl b/videomv.pl index ddc3357..063ecb3 100755 --- a/videomv.pl +++ b/videomv.pl @@ -29,7 +29,8 @@ my %config = do $confile; die "Error in `" .$confile. "'\n" if $@ || not %config; map { exists $config{$_} || die "Error: Missing `${_}'.\n" } - qw /videodir driver database hostname user port password videodata/; + qw /videodir driver database hostname user port password/; +$config{prefix} = "" unless exists $config{prefix}; my $symlinks = catdir($config{videodir},'MOVIES'); # Symlinks folder die "Error: No such directory: `" .$symlinks. "'.\n" unless -d $symlinks; @@ -310,7 +311,7 @@ e.g., user => 'username', port => 3306, password => '******', - videodata => "videodb_videodata", + prefix => "videodb_", =head1 EXIT STATUS @@ -391,7 +392,7 @@ unless (defined $ignoredb_flag) { # Lookup for the file in the videodb database $RES = - $dbh->selectall_hashref ( "SELECT id,director,title FROM $config{videodata} + $dbh->selectall_hashref ( "SELECT id,director,title FROM $config{prefix}videodata WHERE filename = ?", 'id', undef, $old_filename ) @@ -574,7 +575,7 @@ unless ($r || defined ($ignoredb_flag) || $old_filename eq $new_filename) { &revert(@actions); } else { - my $rv = $dbh->do ( "UPDATE $config{videodata} SET filename = ? WHERE id = ?", + my $rv = $dbh->do ( "UPDATE $config{prefix}videodata SET filename = ? WHERE id = ?", undef, $new_filename, $id ); &ack (\$r, $rv); -- cgit v1.2.3