1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00
* use sql_mode_for_dates() where appropriate.
* always specify an argument for sql_mode_for_dates()
  (future-proof. easier to notice and fix if the caller
   will start using thd from a local variable or an argument)
This commit is contained in:
Sergei Golubchik
2013-08-12 22:05:23 +02:00
parent 847e0f152b
commit a91a23858d
9 changed files with 22 additions and 59 deletions

View File

@@ -3494,25 +3494,10 @@ my_eof(THD *thd)
#define reenable_binlog(A) (A)->variables.option_bits= tmp_disable_binlog__save_options;}
/*
These functions are for making it later easy to add strict
checking for all date handling.
*/
const my_bool strict_date_checking= 1;
inline sql_mode_t sql_mode_for_dates(THD *thd)
{
if (strict_date_checking)
return (thd->variables.sql_mode &
(MODE_NO_ZERO_DATE | MODE_NO_ZERO_IN_DATE |
MODE_INVALID_DATES));
return (thd->variables.sql_mode & MODE_INVALID_DATES);
}
inline sql_mode_t sql_mode_for_dates()
{
return sql_mode_for_dates(current_thd);
return thd->variables.sql_mode &
(MODE_NO_ZERO_DATE | MODE_NO_ZERO_IN_DATE | MODE_INVALID_DATES);
}
/*