This commit is contained in:
2024-11-01 16:09:16 +01:00
parent 1e7f878a64
commit b2429246e4
10 changed files with 234 additions and 0 deletions

23
sql/set_artist_name.sql Normal file
View File

@ -0,0 +1,23 @@
CREATE OR REPLACE PROCEDURE set_artist_name(in_url text) AS $$
DECLARE
temp_artist_id integer;
temp_artist_name text;
temp_artist artist%ROWTYPE;
BEGIN
temp_artist_name = get_artist_name(in_url);
temp_artist_name = convert_artist_name(temp_artist_name);
SELECT * INTO temp_artist FROM artist
WHERE artist.name = temp_artist_name;
IF NOT FOUND THEN
INSERT INTO artist (name) VALUES (temp_artist_name);
END IF;
SELECT artist.id INTO temp_artist_id FROM artist
WHERE artist.name = temp_artist_name;
UPDATE artist_website SET artist_id = temp_artist_id
WHERE url = in_url;
END;
$$ LANGUAGE plpgsql;