Skip to content

Commit 25ac8bc

Browse files
committed
Straightforward ts functions for chroncontrols.
1 parent dfbbb48 commit 25ac8bc

File tree

6 files changed

+52
-0
lines changed

6 files changed

+52
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE OR REPLACE FUNCTION ts.updatechroncontrolage(_chroncontrolid integer, _age float DEFAULT NULL)
2+
RETURNS void
3+
LANGUAGE sql
4+
AS $function$
5+
UPDATE ndb.chroncontrols
6+
SET age = _age
7+
WHERE chroncontrolid = _chroncontrolid
8+
$function$
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE OR REPLACE FUNCTION ts.updatechroncontrolageolder(_chroncontrolid integer, _agelimitolder float DEFAULT NULL)
2+
RETURNS void
3+
LANGUAGE sql
4+
AS $function$
5+
UPDATE ndb.chroncontrols
6+
SET agelimitolder = _agelimitolder
7+
WHERE chroncontrolid = _chroncontrolid
8+
$function$
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE OR REPLACE FUNCTION ts.updatechroncontrolagetype(_chroncontrolid integer, _agetypeid integer)
2+
RETURNS void
3+
LANGUAGE sql
4+
AS $function$
5+
UPDATE ndb.chroncontrols
6+
SET agetypeid = _agetypeid
7+
WHERE chroncontrolid = _chroncontrolid
8+
$function$
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE OR REPLACE FUNCTION ts.updatechroncontrolageyounger(_chroncontrolid integer, _ageyounger float DEFAULT NULL)
2+
RETURNS void
3+
LANGUAGE sql
4+
AS $function$
5+
UPDATE ndb.chroncontrols
6+
SET agelimityounger = _ageyounger
7+
WHERE chroncontrolid = _chroncontrolid
8+
$function$
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CREATE OR REPLACE FUNCTION ts.updatechroncontrolevent(_chroncontrolid int, _eventid int, _analysisunitid int = null)
2+
RETURNS void
3+
LANGUAGE sql
4+
AS $function$
5+
INSERT INTO ndb.eventchronology
6+
(analysisunitid, eventid, chroncontrolid)
7+
VALUES (_analysisunitid, _eventid, _chroncontrolid)
8+
ON CONFLICT ON CONSTRAINT uniqueeventset
9+
DO UPDATE
10+
SET analysisunitid = _analysisunitid, eventid = _eventid, chroncontrolid = _chroncontrolid, notes = null
11+
WHERE ndb.eventchronology.eventchronologyid = (SELECT ec.eventchronologyid FROM ndb.eventchronology AS ec WHERE (chroncontrolid = _chroncontrolid))
12+
$function$
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE OR REPLACE FUNCTION ts.updatechroncontrolnotes(_chroncontrolid integer, _notes CHARACTER VARYING DEFAULT NULL)
2+
RETURNS void
3+
LANGUAGE sql
4+
AS $function$
5+
UPDATE ndb.chroncontrols
6+
SET notes = _notes
7+
WHERE chroncontrolid = _chroncontrolid
8+
$function$

0 commit comments

Comments
 (0)