pub fn execute_user_function(
func: &Function,
args: &[Expression],
db: &mut Database,
) -> Result<SqlValue, ExecutorError>Expand description
Execute a user-defined function
§Steps:
- Validate argument count matches parameter count
- Create function execution context (read-only, isolated)
- Check and increment recursion depth
- Bind argument values to function parameters
- Parse and execute function body
- Handle RETURN control flow
- Decrement recursion depth and return value
§Errors:
- ArgumentCountMismatch: Wrong number of arguments
- RecursionLimitExceeded: Too many nested function calls
- FunctionMustReturn: Function exited without RETURN statement
- Other execution errors from function body