summaryrefslogtreecommitdiff
path: root/sql/functions/general.insert_gallery.sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql/functions/general.insert_gallery.sql')
-rw-r--r--sql/functions/general.insert_gallery.sql33
1 files changed, 33 insertions, 0 deletions
diff --git a/sql/functions/general.insert_gallery.sql b/sql/functions/general.insert_gallery.sql
new file mode 100644
index 0000000..0582c6b
--- /dev/null
+++ b/sql/functions/general.insert_gallery.sql
@@ -0,0 +1,33 @@
+drop function general.insert_gallery (
+ p_description text,
+ p_filename character varying,
+ p_mime_type character varying,
+ p_hex text
+);
+
+create or replace function general.insert_gallery (
+ p_description text,
+ p_filename character varying,
+ p_mime_type character varying,
+ p_hex text
+)
+returns bigint
+as $$
+declare
+ l_id bigint;
+begin
+ insert into general.gallery (
+ description,
+ filename,
+ mime_type,
+ content
+ ) values (
+ p_description,
+ p_filename,
+ p_mime_type,
+ decode(p_hex, 'hex')
+ ) returning id into l_id;
+
+ return l_id;
+end;
+$$ language plpgsql;