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

Method SetVariable

server/plpgsql/interpreter_stack.go:231–238  ·  view source on GitHub ↗

SetVariable sets the first variable found, with a matching name, to the value given. This does not ensure that the value matches the expectations of the type, so it should be validated before this is called. Returns an error if the variable cannot be found.

(ctx *sql.Context, name string, val any)

Source from the content-addressed store, hash-verified

229// value matches the expectations of the type, so it should be validated before this is called. Returns an error if the
230// variable cannot be found.
231func (is *InterpreterStack) SetVariable(ctx *sql.Context, name string, val any) error {
232 iv := is.GetVariable(name)
233 if iv.Type == nil {
234 return fmt.Errorf("variable `%s` could not be found", name)
235 }
236 *iv.Value = val
237 return nil
238}
239
240// SetLabel sets the label for the current scope.
241func (is *InterpreterStack) SetLabel(label string) {

Callers 1

callFunction · 0.80

Calls 2

GetVariableMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected