1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use {
crate::{ExecuteError, Glue, Result, Value},
sqlparser::ast::{Ident, SetVariableValue},
};
impl Glue {
pub async fn set_variable(
&mut self,
variable: &Ident,
value: &[SetVariableValue],
) -> Result<()> {
let first_value = value.get(0).ok_or(ExecuteError::MissingComponentsForSet)?;
let value: Value = match first_value {
SetVariableValue::Ident(..) => unimplemented!(),
SetVariableValue::Literal(literal) => literal.try_into()?,
};
let name = variable.value.clone();
self.get_mut_context()?.set_variable(name, value);
Ok(())
}
}