# Insert the song only if it doesn't already exist
# minimal SQL escaping
$songname =~ s/'/\\'/g;
$artist =~ s/'/\\'/g;
# Insert the song only if it doesn't already exist
- printf "INSERT INTO songs SELECT nextval('songs_song_seq') AS song, '%s' AS title, '%s' AS artist, 0 AS minbpm, 0 AS maxbpm WHERE '%s' NOT IN ( SELECT title FROM songs );\n",
+ printf "INSERT INTO songs SELECT nextval('songs_song_seq') AS song, '%s' AS title, '%s' AS artist, 0 AS minbpm, 0 AS maxbpm WHERE LOWER('%s') NOT IN ( SELECT LOWER(title) FROM songs );\n",
$songname, $artist, $songname;
$songname, $artist, $songname;
- printf "INSERT INTO machinesongs SELECT ( SELECT song FROM songs WHERE title='%s' ), ( SELECT machine FROM machines WHERE machinename='%s' );\n",
+ printf "INSERT INTO machinesongs SELECT ( SELECT song FROM songs WHERE LOWER(title)=LOWER('%s') ), ( SELECT machine FROM machines WHERE machinename='%s' );\n",
- printf "INSERT INTO songratings (song,machine,playmode,difficulty,feetrating) VALUES ((SELECT song FROM songs WHERE title='%s'),(SELECT machine FROM machines WHERE machinename='%s'),'%s','%s',%u);\n",
+ printf "INSERT INTO songratings (song,machine,playmode,difficulty,feetrating) VALUES ((SELECT song FROM songs WHERE LOWER(title)=LOWER('%s')),(SELECT machine FROM machines WHERE machinename='%s'),'%s','%s',%u);\n",