Cast value to SMALLINT
(&self, value: Value)
| 5086 | |
| 5087 | /// Cast value to SMALLINT |
| 5088 | fn cast_to_smallint(&self, value: Value) -> Result<Value, ExecutionError> { |
| 5089 | let int_value = self.cast_to_integer(value)?; |
| 5090 | match int_value { |
| 5091 | Value::Number(n) => { |
| 5092 | if (-32768.0..=32767.0).contains(&n) { |
| 5093 | Ok(Value::Number(n)) |
| 5094 | } else { |
| 5095 | Err(ExecutionError::RuntimeError(format!( |
| 5096 | "Value {} is out of range for SMALLINT", |
| 5097 | n |
| 5098 | ))) |
| 5099 | } |
| 5100 | } |
| 5101 | other => Ok(other), // Pass through Null |
| 5102 | } |
| 5103 | } |
| 5104 | |
| 5105 | /// Cast value to FLOAT |
| 5106 | fn cast_to_float(&self, value: Value) -> Result<Value, ExecutionError> { |
no test coverage detected