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
Zejun Li committed Jan 18, 2019
1 parent 00e6929 commit 3c1c12e
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 3c1c12e

Please sign in to comment.