func composeDBPrivUpdate(priv mysql.PrivilegeType) (string, error) {
	if priv == mysql.AllPriv {
		strs := make([]string, 0, len(mysql.AllDBPrivs))
		for _, p := range mysql.AllDBPrivs {
			v, ok := mysql.Priv2UserCol[p]
			if !ok {
				return "", errors.Errorf("Unknown db privilege %v", priv)
			}
			strs = append(strs, fmt.Sprintf(`%s="Y"`, v))
		}
		return strings.Join(strs, ", "), nil
	}
	col, ok := mysql.Priv2UserCol[priv]
	if !ok {
		return "", errors.Errorf("Unknown priv: %v", priv)
	}
	return fmt.Sprintf(`%s="Y"`, col), nil
}
// Compose update stmt assignment list for db scope privilege update.
Compose update stmt assignment list for db scope privilege update.
// Compose update stmt assignment list for db scope privilege update .
func composeDBPrivUpdate(priv mysql.PrivilegeType) (string, error) {
	if priv == mysql.AllPriv {
		strs := make([]string, 0, len(mysql.AllDBPrivs))
		for _, p := range mysql.AllDBPrivs {
			v, ok := mysql.Priv2UserCol[p]
			if !ok {
				return "", errors.Errorf("Unknown db privilege %v", priv)
			}
			strs = append(strs, fmt.Sprintf(`%s="Y"`, v))
		}
		return strings.Join(strs, ", "), nil
	}
	col, ok := mysql.Priv2UserCol[priv]
	if !ok {
		return "", errors.Errorf("Unknown priv: %v", priv)
	}
	return fmt.Sprintf(`%s="Y"`, col), nil
}
func composeDBPrivUpdate ( priv mysql . PrivilegeType ) ( string , error ) { if priv == mysql . AllPriv { strs := make ( [ ] string , 0 , len ( mysql . AllDBPrivs ) ) for _ , p := range mysql . AllDBPrivs { v , ok := mysql . Priv2UserCol [ p ] if ! ok { return " " , errors . Errorf ( " " , priv ) } strs = append ( strs , fmt . Sprintf ( `%s="Y"` , v ) ) } return strings . Join ( strs , " " ) , nil } col , ok := mysql . Priv2UserCol [ priv ] if ! ok { return " " , errors . Errorf ( " " , priv ) } return fmt . Sprintf ( `%s="Y"` , col ) , nil }
Compose update stmt assignment list for db scope privilege update.
Compose update stmt assignment list for db scope privilege update .