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

Function TriggerCall

server/plpgsql/interpreter_logic.go:69–83  ·  view source on GitHub ↗

TriggerCall runs the contained trigger operations on the given runner.

(ctx *sql.Context, iFunc InterpretedFunction, runner sql.StatementRunner, sch sql.Schema, oldRow sql.Row, newRow sql.Row, trigVars map[string]any)

Source from the content-addressed store, hash-verified

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) {
70 // Set up the initial state of the function
71 stack := NewInterpreterStack(runner)
72 // Add the special variables
73 stack.NewRecord("OLD", sch, oldRow)
74 stack.NewRecord("NEW", sch, newRow)
75 for varName, val := range trigVars {
76 varType, ok := triggerSpecialVariables[varName]
77 if !ok {
78 return nil, fmt.Errorf("unknown variable %s for trigger", varName)
79 }
80 stack.NewVariableWithValue(varName, varType, val)
81 }
82 return call(ctx, iFunc, stack)
83}
84
85// call runs the contained operations on the given runner.
86func call(ctx *sql.Context, iFunc InterpretedFunction, stack InterpreterStack) (any, error) {

Callers 1

NextMethod · 0.92

Calls 5

NewRecordMethod · 0.95
NewVariableWithValueMethod · 0.95
NewInterpreterStackFunction · 0.85
callFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected