execute_user_function

Function execute_user_function 

Source
pub fn execute_user_function(
    func: &Function,
    args: &[Expression],
    db: &mut Database,
) -> Result<SqlValue, ExecutorError>
Expand description

Execute a user-defined function

§Steps:

  1. Validate argument count matches parameter count
  2. Create function execution context (read-only, isolated)
  3. Check and increment recursion depth
  4. Bind argument values to function parameters
  5. Parse and execute function body
  6. Handle RETURN control flow
  7. 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