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