Liran Zelkha has uploaded a new change for review. Change subject: core: Allow changing CSV params in vdc_options ......................................................................
core: Allow changing CSV params in vdc_options In case vdc_option contain several values seperated by commas, this patch will give a nice stored procedure to remove a value from such a param. Change-Id: Ic25172a8b44e2f0aec81fe48808803c31b5f327b Signed-off-by: [email protected] <[email protected]> --- M packaging/dbscripts/common_sp.sql 1 file changed, 25 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/44/25744/1 diff --git a/packaging/dbscripts/common_sp.sql b/packaging/dbscripts/common_sp.sql index beb3efa..86e93a9 100644 --- a/packaging/dbscripts/common_sp.sql +++ b/packaging/dbscripts/common_sp.sql @@ -553,4 +553,29 @@ -- return full set of generated records RETURN; END; $procedure$ +LANGUAGE plpgsql; + + +-- Remove a value from a CSV string in vdc_options +Create or replace FUNCTION fn_db_remove_csv_config_value(v_option_name varchar(100), v_value varchar(4000), v_version varchar(40)) +returns void +AS $procedure$ +DECLARE +v varchar[]; +e varchar; +v_result varchar; +v_sep varchar(1); +BEGIN +v_result := ''; +v_sep := ''; + v := string_to_array(option_value, ',') from vdc_options where option_name = v_option_name and version = v_version; + FOREACH e in ARRAY v + LOOP + IF (e != v_value) THEN + v_result := v_result || v_sep || e; + v_sep := ','; + END IF; + END LOOP; + UPDATE vdc_options set option_value = v_result where option_name = v_option_name and version = v_version; +END; $procedure$ LANGUAGE plpgsql; \ No newline at end of file -- To view, visit http://gerrit.ovirt.org/25744 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic25172a8b44e2f0aec81fe48808803c31b5f327b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Liran Zelkha <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
