Call runs the contained operations on the given runner.
(ctx *sql.Context, iFunc InterpretedFunction, runner sql.StatementRunner, paramsAndReturn []*pgtypes.DoltgresType, vals []any)
| 51 | |
| 52 | // Call runs the contained operations on the given runner. |
| 53 | func Call(ctx *sql.Context, iFunc InterpretedFunction, runner sql.StatementRunner, paramsAndReturn []*pgtypes.DoltgresType, vals []any) (any, error) { |
| 54 | // Set up the initial state of the function |
| 55 | stack := NewInterpreterStack(runner) |
| 56 | // Add the parameters |
| 57 | parameterTypes := iFunc.GetParameters() |
| 58 | parameterNames := iFunc.GetParameterNames() |
| 59 | if len(vals) != len(parameterTypes) { |
| 60 | return nil, fmt.Errorf("parameter count mismatch: expected %d got %d", len(parameterTypes), len(vals)) |
| 61 | } |
| 62 | for i := range vals { |
| 63 | stack.NewVariableWithValue(parameterNames[i], parameterTypes[i], vals[i]) |
| 64 | } |
| 65 | return call(ctx, iFunc, stack) |
| 66 | } |
| 67 | |
| 68 | // TriggerCall runs the contained trigger operations on the given runner. |
| 69 | func TriggerCall(ctx *sql.Context, iFunc InterpretedFunction, runner sql.StatementRunner, sch sql.Schema, oldRow sql.Row, newRow sql.Row, trigVars map[string]any) (any, error) { |
no test coverage detected