26 lines
713 B
PL/PgSQL
26 lines
713 B
PL/PgSQL
CREATE OR REPLACE PROCEDURE set_folder_path(in_url text) AS $$
|
|
DECLARE
|
|
temp_folder_path text;
|
|
aw_artist_id integer;
|
|
aw_website_id integer;
|
|
artist_name text;
|
|
website_name text;
|
|
BEGIN
|
|
SELECT aw.artist_id INTO aw_artist_id FROM artist_website aw
|
|
WHERE aw.url = in_url;
|
|
|
|
SELECT aw.website_id INTO aw_website_id FROM artist_website aw
|
|
WHERE aw.url = in_url;
|
|
|
|
SELECT artist.name INTO artist_name FROM artist
|
|
WHERE artist.id = aw_artist_id;
|
|
|
|
SELECT website.name INTO website_name FROM website
|
|
WHERE website.id = aw_website_id;
|
|
|
|
temp_folder_path = concat('Artist/', artist_name, '/', website_name);
|
|
|
|
UPDATE artist_website SET folder_path = temp_folder_path
|
|
WHERE url = in_url;
|
|
END;
|
|
$$ LANGUAGE plpgsql; |