func (v *SystemVar) String() string {
	switch v.Scope {
	case sql.SystemVariableScope_Session:
		return fmt.Sprintf("@@SESSION.%s", v.Name)
	case sql.SystemVariableScope_Global:
		return fmt.Sprintf("@@GLOBAL.%s", v.Name)
	default:  
		return fmt.Sprintf("@@UNKNOWN(%v).%s", v.Scope, v.Name)
	}
}
String implements the sql.Expression interface.
package expression
import (
	"fmt"
	"github.com/dolthub/go-mysql-server/sql"
)
type SystemVar struct {
	Name  string
	Scope sql.SystemVariableScope
}
func NewSystemVar(name string, scope sql.SystemVariableScope) *SystemVar {
	return &SystemVar{name, scope}
}
func (v *SystemVar) Children() []sql.Expression { return nil }
func (v *SystemVar) Eval(ctx *sql.Context, _ sql.Row) (interface{}, error) {
	switch v.Scope {
	case sql.SystemVariableScope_Session:
		val, err := ctx.GetSessionVariable(ctx, v.Name)
		if err != nil {
			return nil, err
		}
		return val, nil
	case sql.SystemVariableScope_Global:
		_, val, ok := sql.SystemVariables.GetGlobal(v.Name)
		if !ok {
			return nil, sql.ErrUnknownSystemVariable.New(v.Name)
		}
		return val, nil
	default:  
		return nil, fmt.Errorf("unknown scope `%v` on system variable `%s`", v.Scope, v.Name)
	}
}
func (v *SystemVar) Type() sql.Type {
	if sysVar, _, ok := sql.SystemVariables.GetGlobal(v.Name); ok {
		return sysVar.Type
	}
	return sql.Null
}
func (v *SystemVar) IsNullable() bool { return false }
func (v *SystemVar) Resolved() bool { return true }