summaryrefslogtreecommitdiff
path: root/sql/modules/Session.sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql/modules/Session.sql')
-rw-r--r--sql/modules/Session.sql21
1 files changed, 21 insertions, 0 deletions
diff --git a/sql/modules/Session.sql b/sql/modules/Session.sql
index 8b8b65c6..f8f0500e 100644
--- a/sql/modules/Session.sql
+++ b/sql/modules/Session.sql
@@ -1,3 +1,24 @@
+CREATE OR REPLACE FUNCTION form_check(in_session_id int, in_form_id int)
+RETURNS BOOL AS
+$$
+BEGIN
+ SELECT * FROM open_forms
+ WHERE session_id = in_session_id AND id = in_form_id;
+
+ IF FOUND THEN RETURN TRUE;
+ ELSE RETURN FALSE;
+END;
+$$ language plpgsql;
+
+CREATE OR REPLACE FUNCTION form_open(in_session_id int)
+RETURNS INT AS
+$$
+BEGIN
+ INSERT INTO open_forms (session_id) VALUES (in_session_id);
+ RETURN currval('form_id_seq');
+END;
+$$ LANGUAGE PLPGSQL
+
CREATE OR REPLACE FUNCTION session_check(in_session_id int, in_token text)
RETURNS session AS
$$