func composeColumnPrivUpdate(ctx context.Context, priv mysql.PrivilegeType, name string, host string, db string, tbl string, col string) (string, error) {
	newColumnPriv := ""
	if priv == mysql.AllPriv {
		for _, p := range mysql.AllColumnPrivs {
			v, ok := mysql.Priv2SetStr[p]
			if !ok {
				return "", errors.Errorf("Unknown column privilege %v", p)
			}
			if len(newColumnPriv) == 0 {
				newColumnPriv = v
			} else {
				newColumnPriv = fmt.Sprintf("%s,%s", newColumnPriv, v)
			}
		}
	} else {
		currColumnPriv, err := getColumnPriv(ctx, name, host, db, tbl, col)
		if err != nil {
			return "", errors.Trace(err)
		}
		p, ok := mysql.Priv2SetStr[priv]
		if !ok {
			return "", errors.Errorf("Unknown priv: %v", priv)
		}
		if len(currColumnPriv) == 0 {
			newColumnPriv = p
		} else {
			newColumnPriv = fmt.Sprintf("%s,%s", currColumnPriv, p)
		}
	}
	return fmt.Sprintf(`Column_priv="%s"`, newColumnPriv), nil
}
// Compose update stmt assignment list for column scope privilege update.
Compose update stmt assignment list for column scope privilege update.
// Compose update stmt assignment list for column scope privilege update .
func composeColumnPrivUpdate(ctx context.Context, priv mysql.PrivilegeType, name string, host string, db string, tbl string, col string) (string, error) {
	newColumnPriv := ""
	if priv == mysql.AllPriv {
		for _, p := range mysql.AllColumnPrivs {
			v, ok := mysql.Priv2SetStr[p]
			if !ok {
				return "", errors.Errorf("Unknown column privilege %v", p)
			}
			if len(newColumnPriv) == 0 {
				newColumnPriv = v
			} else {
				newColumnPriv = fmt.Sprintf("%s,%s", newColumnPriv, v)
			}
		}
	} else {
		currColumnPriv, err := getColumnPriv(ctx, name, host, db, tbl, col)
		if err != nil {
			return "", errors.Trace(err)
		}
		p, ok := mysql.Priv2SetStr[priv]
		if !ok {
			return "", errors.Errorf("Unknown priv: %v", priv)
		}
		if len(currColumnPriv) == 0 {
			newColumnPriv = p
		} else {
			newColumnPriv = fmt.Sprintf("%s,%s", currColumnPriv, p)
		}
	}
	return fmt.Sprintf(`Column_priv="%s"`, newColumnPriv), nil
}
func composeColumnPrivUpdate ( ctx context . Context , priv mysql . PrivilegeType , name string , host string , db string , tbl string , col string ) ( string , error ) { newColumnPriv := " " if priv == mysql . AllPriv { for _ , p := range mysql . AllColumnPrivs { v , ok := mysql . Priv2SetStr [ p ] if ! ok { return " " , errors . Errorf ( " " , p ) } if len ( newColumnPriv ) == 0 { newColumnPriv = v } else { newColumnPriv = fmt . Sprintf ( " " , newColumnPriv , v ) } } } else { currColumnPriv , err := getColumnPriv ( ctx , name , host , db , tbl , col ) if err != nil { return " " , errors . Trace ( err ) } p , ok := mysql . Priv2SetStr [ priv ] if ! ok { return " " , errors . Errorf ( " " , priv ) } if len ( currColumnPriv ) == 0 { newColumnPriv = p } else { newColumnPriv = fmt . Sprintf ( " " , currColumnPriv , p ) } } return fmt . Sprintf ( `Column_priv="%s"` , newColumnPriv ) , nil }
Compose update stmt assignment list for column scope privilege update.
Compose update stmt assignment list for column scope privilege update .