@Override protected ConcurrentMap<String, String> forScope(Scope scope) { // local and session scope are the same in MySQL if (scope == MySqlScope.LOCAL) { scope = MySqlScope.SESSION; } return super.forScope(scope); } }
/** * Set the variable with the specified scope. * * @param scope the variable scope; may be null if the session scope is to be used * @param name the name of the variable; may not be null * @param value the variable value; may be null if the value for the named variable is to be removed * @return this object for method chaining purposes; never null */ public SystemVariables setVariable(Scope scope, String name, String value) { name = variableName(name); if (value != null) { forScope(scope).put(name, value); } else { forScope(scope).remove(name); } return this; }
/** * Get the variable with the specified name and scope. * * @param name the name of the variable; may not be null * @param scope the variable scope; may not be null * @return the variable value; may be null if the variable is not currently set */ public String getVariable(String name, Scope scope) { name = variableName(name); return forScope(scope).get(name); }
/** * Get the variable with the specified name and scope. * * @param name the name of the variable; may not be null * @param scope the variable scope; may not be null * @return the variable value; may be null if the variable is not currently set */ public String getVariable(String name, Scope scope) { name = variableName(name); return forScope(scope).get(name); }
/** * Set the variable with the specified scope. * * @param scope the variable scope; may be null if the session scope is to be used * @param name the name of the variable; may not be null * @param value the variable value; may be null if the value for the named variable is to be removed * @return this object for method chaining purposes; never null */ public SystemVariables setVariable(Scope scope, String name, String value) { name = variableName(name); if (value != null) { forScope(scope).put(name, value); } else { forScope(scope).remove(name); } return this; }