summaryrefslogtreecommitdiff
path: root/sql/functions
diff options
context:
space:
mode:
Diffstat (limited to 'sql/functions')
-rw-r--r--sql/functions/general.get_galleries.sql6
-rw-r--r--sql/functions/general.get_gallery.sql6
-rw-r--r--sql/functions/general.insert_gallery.sql4
-rw-r--r--sql/functions/general.update_gallery.sql3
4 files changed, 17 insertions, 2 deletions
diff --git a/sql/functions/general.get_galleries.sql b/sql/functions/general.get_galleries.sql
index fc93095..db3ad09 100644
--- a/sql/functions/general.get_galleries.sql
+++ b/sql/functions/general.get_galleries.sql
@@ -9,7 +9,11 @@ begin
g.description,
g.filename,
g.mime_type,
- substring(g.content::text from 3) as content,
+ g.video_embed_url,
+ case
+ when g.content is null then null
+ else substring(g.content::text from 3)
+ end as content,
g.created,
g.modified
from general.gallery g
diff --git a/sql/functions/general.get_gallery.sql b/sql/functions/general.get_gallery.sql
index 66c9fce..c0972f4 100644
--- a/sql/functions/general.get_gallery.sql
+++ b/sql/functions/general.get_gallery.sql
@@ -13,7 +13,11 @@ begin
g.description,
g.filename,
g.mime_type,
- substring(g.content::text from 3) as content,
+ g.video_embed_url,
+ case
+ when g.content is null then null
+ else substring(g.content::text from 3)
+ end as content,
g.created,
g.modified
from general.gallery g
diff --git a/sql/functions/general.insert_gallery.sql b/sql/functions/general.insert_gallery.sql
index 0582c6b..26260fb 100644
--- a/sql/functions/general.insert_gallery.sql
+++ b/sql/functions/general.insert_gallery.sql
@@ -2,6 +2,7 @@ drop function general.insert_gallery (
p_description text,
p_filename character varying,
p_mime_type character varying,
+ p_video_embed_url character varying,
p_hex text
);
@@ -9,6 +10,7 @@ create or replace function general.insert_gallery (
p_description text,
p_filename character varying,
p_mime_type character varying,
+ p_video_embed_url character varying,
p_hex text
)
returns bigint
@@ -20,11 +22,13 @@ begin
description,
filename,
mime_type,
+ video_embed_url,
content
) values (
p_description,
p_filename,
p_mime_type,
+ p_video_embed_url,
decode(p_hex, 'hex')
) returning id into l_id;
diff --git a/sql/functions/general.update_gallery.sql b/sql/functions/general.update_gallery.sql
index e8532db..95296c3 100644
--- a/sql/functions/general.update_gallery.sql
+++ b/sql/functions/general.update_gallery.sql
@@ -3,6 +3,7 @@ drop function general.update_gallery (
p_description text,
p_filename character varying,
p_mime_type character varying,
+ p_video_embed_url character varying,
p_hex text
);
@@ -11,6 +12,7 @@ create or replace function general.update_gallery (
p_description text,
p_filename character varying,
p_mime_type character varying,
+ p_video_embed_url character varying,
p_hex text
)
returns bigint
@@ -27,6 +29,7 @@ begin
set description = p_description,
filename = p_filename,
mime_type = p_mime_type,
+ video_embed_url = p_video_embed_url,
content = decode(p_hex, 'hex'),
modified = now()
where id = p_id;