func SetSystemVar(vars *variable.SessionVars, name string, value types.Datum) error {
	name = strings.ToLower(name)
	if value.IsNull() {
		if name != variable.CharacterSetResults {
			return variable.ErrCantSetToNull
		}
		delete(vars.Systems, name)
		return nil
	}
	sVal, err := value.ToString()
	if err != nil {
		return errors.Trace(err)
	}
	switch name {
	case variable.SQLModeVar:
		sVal = strings.ToUpper(sVal)
		if strings.Contains(sVal, "STRICT_TRANS_TABLES") || strings.Contains(sVal, "STRICT_ALL_TABLES") {
			vars.StrictSQLMode = true
		} else {
			vars.StrictSQLMode = false
		}
	case variable.TiDBSnapshot:
		err = setSnapshotTS(vars, sVal)
		if err != nil {
			return errors.Trace(err)
		}
	case variable.AutocommitVar:
		isAutocommit := strings.EqualFold(sVal, "ON") || sVal == "1"
		vars.SetStatusFlag(mysql.ServerStatusAutocommit, isAutocommit)
	case variable.TiDBSkipConstraintCheck:
		vars.SkipConstraintCheck = (sVal == "1")
	}
	vars.Systems[name] = sVal
	return nil
}
// SetSystemVar sets system variable and updates SessionVars states.
SetSystemVar sets system variable and updates SessionVars states.
// SetSystemVar sets system variable and updates SessionVars states .
func SetSystemVar(vars *variable.SessionVars, name string, value types.Datum) error {
	name = strings.ToLower(name)
	if value.IsNull() {
		if name != variable.CharacterSetResults {
			return variable.ErrCantSetToNull
		}
		delete(vars.Systems, name)
		return nil
	}
	sVal, err := value.ToString()
	if err != nil {
		return errors.Trace(err)
	}
	switch name {
	case variable.SQLModeVar:
		sVal = strings.ToUpper(sVal)
		if strings.Contains(sVal, "STRICT_TRANS_TABLES") || strings.Contains(sVal, "STRICT_ALL_TABLES") {
			vars.StrictSQLMode = true
		} else {
			vars.StrictSQLMode = false
		}
	case variable.TiDBSnapshot:
		err = setSnapshotTS(vars, sVal)
		if err != nil {
			return errors.Trace(err)
		}
	case variable.AutocommitVar:
		isAutocommit := strings.EqualFold(sVal, "ON") || sVal == "1"
		vars.SetStatusFlag(mysql.ServerStatusAutocommit, isAutocommit)
	case variable.TiDBSkipConstraintCheck:
		vars.SkipConstraintCheck = (sVal == "1")
	}
	vars.Systems[name] = sVal
	return nil
}
func SetSystemVar ( vars * variable . SessionVars , name string , value types . Datum ) error { name = strings . ToLower ( name ) if value . IsNull ( ) { if name != variable . CharacterSetResults { return variable . ErrCantSetToNull } delete ( vars . Systems , name ) return nil } sVal , err := value . ToString ( ) if err != nil { return errors . Trace ( err ) } switch name { case variable . SQLModeVar : sVal = strings . ToUpper ( sVal ) if strings . Contains ( sVal , " " ) || strings . Contains ( sVal , " " ) { vars . StrictSQLMode = true } else { vars . StrictSQLMode = false } case variable . TiDBSnapshot : err = setSnapshotTS ( vars , sVal ) if err != nil { return errors . Trace ( err ) } case variable . AutocommitVar : isAutocommit := strings . EqualFold ( sVal , " " ) || sVal == " " vars . SetStatusFlag ( mysql . ServerStatusAutocommit , isAutocommit ) case variable . TiDBSkipConstraintCheck : vars . SkipConstraintCheck = ( sVal == " " ) } vars . Systems [ name ] = sVal return nil }
SetSystemVar sets system variable and updates SessionVars states.
SetSystemVar sets system variable and updates SessionVars states .