Skip to content
Snippets Groups Projects
Commit cef3fa1c authored by Arno Schoenmakers's avatar Arno Schoenmakers
Browse files

Task #1771: Update single function from processType-20110707-1_0-release-branch

parent da30087b
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
-- 1: get all trees that are scheduled to start in the period: now till now+period -- 1: get all trees that are scheduled to start in the period: now till now+period
-- 2: get all trees with starttime <=now and stoptime > now ; period param is ignored -- 2: get all trees with starttime <=now and stoptime > now ; period param is ignored
-- 3: get all trees with stoptime in the period: now-period till now -- 3: get all trees with stoptime in the period: now-period till now
-- 4: get all trees with stoptime < now and have state >= FINISHED
-- --
-- With this function we can get the planned, active or finished trees from the database. -- With this function we can get the planned, active or finished trees from the database.
-- --
...@@ -68,12 +69,18 @@ CREATE OR REPLACE FUNCTION getTreeGroup(INT, INT) ...@@ -68,12 +69,18 @@ CREATE OR REPLACE FUNCTION getTreeGroup(INT, INT)
vQuery := vQuery || ' AND t.state > ' || TSscheduled; vQuery := vQuery || ' AND t.state > ' || TSscheduled;
vQuery := vQuery || ' AND t.state < ' || TSfinished; vQuery := vQuery || ' AND t.state < ' || TSfinished;
ELSE ELSE
IF $1 = 3 THEN IF $1 = 3 THEN
vQuery := ' AND t.state >= ' || TSfinished; vQuery := ' AND t.state >= ' || TSfinished;
vQuery := vQuery || ' AND t.stoptime > now()-interval ' || chr(39) || $2 || ' minutes' || chr(39); vQuery := vQuery || ' AND t.stoptime > now()-interval ' || chr(39) || $2 || ' minutes' || chr(39);
vSortOrder := 't.stoptime, t.treeID'; vSortOrder := 't.stoptime, t.treeID';
ELSE ELSE
RAISE EXCEPTION 'groupType must be 0,1,2 or 3 not %', $1; IF $1 = 4 THEN
vQuery := ' AND t.state >= ' || TSfinished;
vQuery := vQuery || ' AND t.stoptime < now() ';
vSortOrder := 't.treeID';
ELSE
RAISE EXCEPTION 'groupType must be 0,1,2,3 or 4 not %', $1;
END IF;
END IF; END IF;
END IF; END IF;
END IF; END IF;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment