From 3c1c12e6a756e23d1abc1554e7d56a06cccc831e Mon Sep 17 00:00:00 2001 From: Zejun Li Date: Mon, 14 Jan 2019 14:00:15 +0800 Subject: [PATCH] mysql: add sql mode ALLOW_INVALID_DATES (#171) * mysql: add sql mode ALLOW_INVALID_DATES * add HasAllowInvalidDatesMode --- mysql/const.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mysql/const.go b/mysql/const.go index efa4bce46..f8b94fa67 100644 --- a/mysql/const.go +++ b/mysql/const.go @@ -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 @@ -546,6 +551,7 @@ const ( ModeHighNotPrecedence ModeNoEngineSubstitution ModePadCharToFullLength + ModeAllowInvalidDates ) // FormatSQLModeStr re-format 'SQL_MODE' variable. @@ -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.