Returns a [`Var`] representing the configuration parameter with the specified name. Configuration parameters are matched case insensitively. If no such configuration parameter exists, `get` returns an error. Note that if `name` is known at compile time, you should instead use the named accessor to access the variable with its true Rust type. For example, `self.get("sql_safe_updates").value()` re
(&self, system_vars: &SystemVars, name: &str)
| 539 | /// example, `self.get("sql_safe_updates").value()` returns the string |
| 540 | /// `"true"` or `"false"`, while `self.sql_safe_updates()` returns a bool. |
| 541 | pub fn get(&self, system_vars: &SystemVars, name: &str) -> Result<&dyn Var, VarError> { |
| 542 | let name = compat_translate_name(name); |
| 543 | |
| 544 | let name = UncasedStr::new(name); |
| 545 | if name == MZ_VERSION_NAME { |
| 546 | Ok(&self.mz_version) |
| 547 | } else if name == IS_SUPERUSER_NAME { |
| 548 | Ok(&self.user) |
| 549 | } else { |
| 550 | self.vars |
| 551 | .get(name) |
| 552 | .map(|v| { |
| 553 | v.visible(&self.user, system_vars)?; |
| 554 | Ok(v.as_var()) |
| 555 | }) |
| 556 | .transpose()? |
| 557 | .ok_or_else(|| VarError::UnknownParameter(name.to_string())) |
| 558 | } |
| 559 | } |
| 560 | |
| 561 | /// Returns a [`SessionVar`] for inspection. |
| 562 | /// |
no test coverage detected