getContextValues accesses the contextValues in the given context. If the context does not have a contextValues, then it creates one and adds it to the context.
(ctx *sql.Context)
| 53 | // getContextValues accesses the contextValues in the given context. If the context does not have a contextValues, then |
| 54 | // it creates one and adds it to the context. |
| 55 | func getContextValues(ctx *sql.Context) (*contextValues, error) { |
| 56 | sess := dsess.DSessFromSess(ctx.Session) |
| 57 | if sess.DoltgresSessObj == nil { |
| 58 | cv := &contextValues{} |
| 59 | sess.DoltgresSessObj = cv |
| 60 | return cv, nil |
| 61 | } |
| 62 | cv, ok := sess.DoltgresSessObj.(*contextValues) |
| 63 | if !ok { |
| 64 | return nil, errors.Errorf("context contains an unknown values struct of type: %T", sess.DoltgresSessObj) |
| 65 | } |
| 66 | return cv, nil |
| 67 | } |
| 68 | |
| 69 | // ClearContextValues clears all context values. This is primarily for operations that are directly called from Dolt, as |
| 70 | // Dolt does not have the Doltgres concept of context values. Care must be taken to ensure that intermediate state |
no test coverage detected