NewRecord creates a new record in the current scope. If a record with the same name exists in a previous scope, then that record will be shadowed until the current scope exits.
(name string, sch sql.Schema, val sql.Row)
| 174 | // NewRecord creates a new record in the current scope. If a record with the same name exists in a previous scope, then |
| 175 | // that record will be shadowed until the current scope exits. |
| 176 | func (is *InterpreterStack) NewRecord(name string, sch sql.Schema, val sql.Row) { |
| 177 | // TODO: this is currently implemented only for the specific record types used in triggers: OLD and NEW |
| 178 | var newVal sql.Row |
| 179 | if val != nil { |
| 180 | newVal = make(sql.Row, len(val)) |
| 181 | copy(newVal, val) |
| 182 | } |
| 183 | is.stack.Peek().variables[name] = &interpreterVariable{ |
| 184 | Record: sch, |
| 185 | Type: pgtypes.Trigger, // TODO: we need to implement the RECORD pseudotype and replace the TRIGGER type here |
| 186 | Value: newVal, |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | // NewVariable creates a new variable in the current scope. If a variable with the same name exists in a previous scope, |
| 191 | // then that variable will be shadowed until the current scope exits. |
no test coverage detected