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 } );
$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