func (e *GrantExec) checkAndInitDBPriv(user string, host string) error {
	db, err := e.getTargetSchema()
	if err != nil {
		return errors.Trace(err)
	}
	ok, err := dbUserExists(e.ctx, user, host, db.Name.O)
	if err != nil {
		return errors.Trace(err)
	}
	if ok {
		return nil
	}
	// Entry does not exist for user-host-db. Insert a new entry.
	return initDBPrivEntry(e.ctx, user, host, db.Name.O)
}
// Check if DB scope privilege entry exists in mysql.DB.
// If unexists, insert a new one.
Check if DB scope privilege entry exists in mysql.DB.
If unexists, insert a new one.
// Check if DB scope privilege entry exists in mysql . DB . // If unexists insert a new one .
func (e *GrantExec) checkAndInitDBPriv(user string, host string) error {
	db, err := e.getTargetSchema()
	if err != nil {
		return errors.Trace(err)
	}
	ok, err := dbUserExists(e.ctx, user, host, db.Name.O)
	if err != nil {
		return errors.Trace(err)
	}
	if ok {
		return nil
	}
	return initDBPrivEntry(e.ctx, user, host, db.Name.O)
}
func ( e * GrantExec ) checkAndInitDBPriv ( user string , host string ) error { db , err := e . getTargetSchema ( ) if err != nil { return errors . Trace ( err ) } ok , err := dbUserExists ( e . ctx , user , host , db . Name . O ) if err != nil { return errors . Trace ( err ) } if ok { return nil } return initDBPrivEntry ( e . ctx , user , host , db . Name . O ) }
Check if DB scope privilege entry exists in mysql.DB.
Check if DB scope privilege entry exists in mysql . DB .
// Entry does not exist for user-host-db. Insert a new entry.