示例#1
0
文件: context.go 项目: rorovic/tidb
// GetGlobalStatusVar implements GlobalVarAccessor GetGlobalStatusVar interface.
func (c *Context) GetGlobalStatusVar(ctx context.Context, name string) (string, error) {
	v := variable.GetStatusVar(name)
	if v == nil {
		return "", terror.UnknownStatusVar.Gen("unknown status variable: %s", name)
	}
	return v.Value, nil
}
示例#2
0
文件: context.go 项目: rorovic/tidb
// SetGlobalStatusVar implements GlobalVarAccessor SetGlobalStatusVar interface.
func (c *Context) SetGlobalStatusVar(ctx context.Context, name string, value string) error {
	v := variable.GetStatusVar(name)
	if v == nil {
		return terror.UnknownStatusVar.Gen("unknown status variable: %s", name)
	}
	v.Value = value
	return nil
}
示例#3
0
文件: session.go 项目: rorovic/tidb
// GetGlobalStatusVar implements GlobalVarAccessor.GetGlobalStatusVar interface.
func (s *session) GetGlobalStatusVar(ctx context.Context, name string) (string, error) {
	// TODO: get global status variables from store.
	v := variable.GetStatusVar(name)
	if v == nil {
		return "", terror.UnknownStatusVar.Gen("unknown status variable:%s", name)
	}

	return v.Value, nil
}
示例#4
0
文件: session.go 项目: rorovic/tidb
// SetGlobalStatusVar implements GlobalVarAccessor.SetGlobalStatusVar interface.
func (s *session) SetGlobalStatusVar(ctx context.Context, name string, value string) error {
	// TODO: set global status variables from store.
	v := variable.GetStatusVar(name)
	if v == nil {
		return terror.UnknownStatusVar.Gen("unknown status variable:%s", name)
	}
	v.Value = value

	return nil
}