]> git.ktnx.net Git - mpd-feeder.git/blobdiff - bin/mpd-feeder
fixed SQL param numbers
[mpd-feeder.git] / bin / mpd-feeder
index 6cc9c196dcf02d7cee1488e367251237cef97139..ddc4a923a9f9fda295010c9fc6aba97ca72b2599 100755 (executable)
@@ -159,7 +159,8 @@ use constant DEFAULT_CONFIG_FILE => '/etc/mpd-feeder/mpd-feeder.conf';
     method connect_db {
         return if $db;
 
-        $db = DBI->connect( "dbi:" . $opt->db_path,
+        $db =
+            DBI->connect( "dbi:Pg:dbname=" . $opt->db_path,
             $opt->db_user, $opt->db_password,
             { RaiseError => 1, AutoCommit => 1 } );
 
@@ -185,7 +186,7 @@ use constant DEFAULT_CONFIG_FILE => '/etc/mpd-feeder/mpd-feeder.conf';
         $db->prepare_cached(
             <<'SQL')->execute( $song, $artist, $album, $db_generation );
 INSERT INTO songs(path, artist, album, generation)
-VALUES($1, $2, $3, $3)
+VALUES($1, $2, $3, $4)
 ON CONFLICT ON CONSTRAINT songs_pkey DO
 UPDATE SET artist = $2
          , album = $3