Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
77aba954
Commit
77aba954
authored
18 years ago
by
Ruud Overeem
Browse files
Options
Downloads
Patches
Plain Diff
BugID: 795
updateNode function now also workt on VIChierarchical tries.
parent
c4e6446f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/OTDB/sql/updateVTnode_func.sql
+38
-11
38 additions, 11 deletions
SAS/OTDB/sql/updateVTnode_func.sql
with
38 additions
and
11 deletions
SAS/OTDB/sql/updateVTnode_func.sql
+
38
−
11
View file @
77aba954
...
...
@@ -30,13 +30,17 @@
-- Authorisation: yes
--
-- Tables: VICtemplate update
-- VIChierarchy update
--
-- Types: OTDBnode
--
CREATE
OR
REPLACE
FUNCTION
updateVTnode
(
INT4
,
INT4
,
INT4
,
INT2
,
TEXT
)
RETURNS
BOOLEAN
AS
'
DECLARE
vFunction INT2 := 1;
TThardware CONSTANT INT2 := 10;
TTtemplate CONSTANT INT2 := 20;
vFunction CONSTANT INT2 := 1;
vTreeType OTDBtree.treetype%TYPE;
vIsAuth BOOLEAN;
vAuthToken ALIAS FOR $1;
vLimits TEXT;
...
...
@@ -51,6 +55,16 @@ CREATE OR REPLACE FUNCTION updateVTnode(INT4, INT4, INT4, INT2, TEXT)
RETURN FALSE;
END IF;
-- get treetype
SELECT treetype
INTO vTreeType
FROM OTDBtree
WHERE treeID = $1;
IF NOT FOUND THEN
RAISE EXCEPTION
\'
Tree % does not exist
\'
, $1;
END IF;
IF vTreeType = TTtemplate THEN
-- get ParentID of node to duplicate
vLimits := replace($5,
\'\\\'\'
,
\'\'
);
UPDATE VICtemplate
...
...
@@ -59,9 +73,22 @@ CREATE OR REPLACE FUNCTION updateVTnode(INT4, INT4, INT4, INT2, TEXT)
WHERE treeID = $2
AND nodeID = $3;
IF NOT FOUND THEN
RAISE EXCEPTION
\'
Node % could not be updated
\'
, $3;
RAISE EXCEPTION
\'
Node % of template-tree could not be updated
\'
, $3;
RETURN FALSE;
END IF;
ELSEIF vTreeType = TTHardware THEN
vLimits := replace($5,
\'\\\'\'
,
\'\'
);
UPDATE VIChierarchy
SET limits = vLimits
WHERE treeID = $2
AND nodeID = $3;
IF NOT FOUND THEN
RAISE EXCEPTION
\'
Node % of VIC-tree could not be updated
\'
, $3;
RETURN FALSE;
END IF;
ELSE
RAISE EXCEPTION
\'
Nodes of PIC trees can not be updated
\'
;
END IF;
RETURN TRUE;
END;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment