MCPcopy Create free account
hub / github.com/dolthub/doltgresql / Call

Function Call

server/plpgsql/interpreter_logic.go:53–66  ·  view source on GitHub ↗

Call runs the contained operations on the given runner.

(ctx *sql.Context, iFunc InterpretedFunction, runner sql.StatementRunner, paramsAndReturn []*pgtypes.DoltgresType, vals []any)

Source from the content-addressed store, hash-verified

51
52// Call runs the contained operations on the given runner.
53func 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.
69func TriggerCall(ctx *sql.Context, iFunc InterpretedFunction, runner sql.StatementRunner, sch sql.Schema, oldRow sql.Row, newRow sql.Row, trigVars map[string]any) (any, error) {

Callers 1

EvalMethod · 0.92

Calls 6

NewVariableWithValueMethod · 0.95
NewInterpreterStackFunction · 0.85
callFunction · 0.85
GetParametersMethod · 0.65
GetParameterNamesMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected