func (e *GrantExec) grantDBPriv(priv *ast.PrivElem, user *ast.UserSpec) error {
	db, err := e.getTargetSchema()
	if err != nil {
		return errors.Trace(err)
	}
	asgns, err := composeDBPrivUpdate(priv.Priv)
	if err != nil {
		return errors.Trace(err)
	}
	userName, host := parseUser(user.User)
	sql := fmt.Sprintf(`UPDATE %s.%s SET %s WHERE User="%s" AND Host="%s" AND DB="%s";`, mysql.SystemDB, mysql.DBTable, asgns, userName, host, db.Name.O)
	_, err = e.ctx.(sqlexec.RestrictedSQLExecutor).ExecRestrictedSQL(e.ctx, sql)
	return errors.Trace(err)
}
// Manipulate mysql.db table.
Manipulate mysql.db table.
// Manipulate mysql . db table .
func (e *GrantExec) grantDBPriv(priv *ast.PrivElem, user *ast.UserSpec) error {
	db, err := e.getTargetSchema()
	if err != nil {
		return errors.Trace(err)
	}
	asgns, err := composeDBPrivUpdate(priv.Priv)
	if err != nil {
		return errors.Trace(err)
	}
	userName, host := parseUser(user.User)
	sql := fmt.Sprintf(`UPDATE %s.%s SET %s WHERE User="%s" AND Host="%s" AND DB="%s";`, mysql.SystemDB, mysql.DBTable, asgns, userName, host, db.Name.O)
	_, err = e.ctx.(sqlexec.RestrictedSQLExecutor).ExecRestrictedSQL(e.ctx, sql)
	return errors.Trace(err)
}
func ( e * GrantExec ) grantDBPriv ( priv * ast . PrivElem , user * ast . UserSpec ) error { db , err := e . getTargetSchema ( ) if err != nil { return errors . Trace ( err ) } asgns , err := composeDBPrivUpdate ( priv . Priv ) if err != nil { return errors . Trace ( err ) } userName , host := parseUser ( user . User ) sql := fmt . Sprintf ( `UPDATE %s.%s SET %s WHERE User="%s" AND Host="%s" AND DB="%s";` , mysql . SystemDB , mysql . DBTable , asgns , userName , host , db . Name . O ) _ , err = e . ctx . ( sqlexec . RestrictedSQLExecutor ) . ExecRestrictedSQL ( e . ctx , sql ) return errors . Trace ( err ) }
Manipulate mysql.db table.
Manipulate mysql . db table .