feat(query): add set_setting_level
@@ -96,7 +96,8 @@ impl Settings {
tracing::warn!("Ignore deprecated global setting {} = {}", name, val);
continue;
}
- settings.set_settings(name, val, false)?;
+ settings.set_settings(name.clone(), val, false)?;
+ settings.set_setting_level(&name, true)?;
}
settings
};
@@ -672,6 +673,18 @@ impl Settings {
Ok(())
}
+ fn set_setting_level(&self, key: &str, is_global: bool) -> Result<()> {
+ let mut settings = self.settings.write();
+ let mut setting = settings
+ .get_mut(key)
+ .ok_or_else(|| ErrorCode::UnknownVariable(format!("Unknown variable: {:?}", key)))?;
+
+ if is_global {
+ setting.level = ScopeLevel::Global;
+ }
+ Ok(())
+ }
+
pub fn get_setting_values(
&self,
) -> Vec<(String, UserSettingValue, UserSettingValue, String, String)> {
