Skip to content

Commit

Permalink
mysql: add sql mode ALLOW_INVALID_DATES (pingcap#171)
Browse files Browse the repository at this point in the history
* mysql: add sql mode ALLOW_INVALID_DATES

* add HasAllowInvalidDatesMode
  • Loading branch information
bobotu authored and jackysp committed Jan 14, 2019
1 parent 38cdf03 commit fe7a03b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mysql/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,11 @@ func (m SQLMode) HasNoAutoCreateUserMode() bool {
return m&ModeNoAutoCreateUser == ModeNoAutoCreateUser
}

// HasAllowInvalidDatesMode detects if 'ALLOW_INVALID_DATES' mode is set in SQLMode
func (m SQLMode) HasAllowInvalidDatesMode() bool {
return m&ModeAllowInvalidDates == ModeAllowInvalidDates
}

// consts for sql modes.
const (
ModeNone SQLMode = 0
Expand Down Expand Up @@ -546,6 +551,7 @@ const (
ModeHighNotPrecedence
ModeNoEngineSubstitution
ModePadCharToFullLength
ModeAllowInvalidDates
)

// FormatSQLModeStr re-format 'SQL_MODE' variable.
Expand Down Expand Up @@ -623,6 +629,7 @@ var Str2SQLMode = map[string]SQLMode{
"HIGH_NOT_PRECEDENCE": ModeHighNotPrecedence,
"NO_ENGINE_SUBSTITUTION": ModeNoEngineSubstitution,
"PAD_CHAR_TO_FULL_LENGTH": ModePadCharToFullLength,
"ALLOW_INVALID_DATES": ModeAllowInvalidDates,
}

// CombinationSQLMode is the special modes that provided as shorthand for combinations of mode values.
Expand Down

0 comments on commit fe7a03b

Please sign in to comment.