Loading acinclude.m4 +24 −0 Original line number Diff line number Diff line Loading @@ -1835,6 +1835,30 @@ dnl END OF MYSQL_CHECK_NDBCLUSTER SECTION dnl --------------------------------------------------------------------------- dnl dnl Macro to check time_t range: according to C standard dnl array index myst be greater then 0 => if time_t is signed dnl the code in the macros below won't compile. dnl AC_DEFUN([MYSQL_CHECK_TIME_T],[ AC_MSG_CHECKING(if time_t is unsigned) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ #include <time.h> ]], [[ int array[(((time_t)-1) > 0) ? 1 : -1]; ]] ) ], [ AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned]) AC_MSG_RESULT(yes) ], [AC_MSG_RESULT(no)] ) ]) dnl By default, many hosts won't let programs access large files; dnl one must use special compiler options to get large-file access to work. dnl For more details about this brain damage please see: Loading configure.in +7 −0 Original line number Diff line number Diff line Loading @@ -1824,6 +1824,13 @@ then AC_MSG_ERROR("MySQL needs a off_t type.") fi dnl dnl check if time_t is unsigned dnl MYSQL_CHECK_TIME_T # do we need #pragma interface/#pragma implementation ? # yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin AC_MSG_CHECKING(the need for @%:@pragma interface/implementation) Loading include/my_time.h +32 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,14 @@ typedef long my_time_t; #define MY_TIME_T_MAX LONG_MAX #define MY_TIME_T_MIN LONG_MIN /* Time handling defaults */ #define TIMESTAMP_MAX_YEAR 2038 #define YY_PART_YEAR 70 #define TIMESTAMP_MIN_YEAR (1900 + YY_PART_YEAR - 1) #define TIMESTAMP_MAX_VALUE INT_MAX32 #define TIMESTAMP_MIN_VALUE 1 #define YY_PART_YEAR 70 /* Flags to str_to_datetime */ Loading Loading @@ -67,6 +75,30 @@ long calc_daynr(uint year,uint month,uint day); void init_time(void); /* Function to check sanity of a TIMESTAMP value DESCRIPTION Check if a given MYSQL_TIME value fits in TIMESTAMP range. This function doesn't make precise check, but rather a rough estimate. RETURN VALUES FALSE The value seems sane TRUE The MYSQL_TIME value is definitely out of range */ static inline bool validate_timestamp_range(const MYSQL_TIME *t) { if ((t->year > TIMESTAMP_MAX_YEAR || t->year < TIMESTAMP_MIN_YEAR) || (t->year == TIMESTAMP_MAX_YEAR && (t->month > 1 || t->day > 19)) || (t->year == TIMESTAMP_MIN_YEAR && (t->month < 12 || t->day < 31))) return FALSE; return TRUE; } my_time_t my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap); Loading mysql-test/include/report-features.test 0 → 100644 +11 −0 Original line number Diff line number Diff line # # show server variables # --disable_query_log --echo ===== ENGINES ===== show engines; --echo ===== VARIABLES ===== show variables; --echo ===== STOP ===== --enable_query_log mysql-test/mysql-test-run.pl +49 −3 Original line number Diff line number Diff line Loading @@ -182,6 +182,7 @@ our $opt_force; our $opt_reorder= 0; our $opt_enable_disabled; our $opt_mem= $ENV{'MTR_MEM'}; our $opt_report_features; our $opt_gcov; our $opt_gcov_err; Loading Loading @@ -427,6 +428,10 @@ sub main () { initialize_servers(); if ( $opt_report_features ) { run_report_features(); } run_suite($opt_suite, $tests); } Loading Loading @@ -670,6 +675,7 @@ sub command_line_setup () { 'mem:s' => \$opt_mem, # Misc 'report-features' => \$opt_report_features, 'comment=s' => \$opt_comment, 'debug' => \$opt_debug, 'fast' => \$opt_fast, Loading Loading @@ -4196,6 +4202,43 @@ sub run_check_testcase ($$) { return $res; } ############################################################################## # # Report the features that were compiled in # ############################################################################## sub run_report_features () { my $args; if ( ! $glob_use_embedded_server ) { mysqld_start($master->[0],[],[]); if ( ! $master->[0]->{'pid'} ) { mtr_error("Can't start the mysqld server"); } mysqld_wait_started($master->[0]); } my $tinfo = {}; $tinfo->{'name'} = 'report features'; $tinfo->{'result_file'} = undef; $tinfo->{'component_id'} = 'mysqld'; $tinfo->{'path'} = 'include/report-features.test'; $tinfo->{'timezone'}= "GMT-3"; $tinfo->{'slave_num'} = 0; $tinfo->{'master_opt'} = []; $tinfo->{'slave_opt'} = []; $tinfo->{'slave_mi'} = []; $tinfo->{'comment'} = 'report server features'; run_mysqltest($tinfo); if ( ! $glob_use_embedded_server ) { stop_all_servers(); } } sub run_mysqltest ($) { Loading Loading @@ -4333,8 +4376,10 @@ sub run_mysqltest ($) { mtr_add_arg($args, "--test-file"); mtr_add_arg($args, $tinfo->{'path'}); if ( defined $tinfo->{'result_file'} ) { mtr_add_arg($args, "--result-file"); mtr_add_arg($args, $tinfo->{'result_file'}); } if ( $opt_record ) { Loading Loading @@ -4746,3 +4791,4 @@ HERE mtr_exit(1); } Loading
acinclude.m4 +24 −0 Original line number Diff line number Diff line Loading @@ -1835,6 +1835,30 @@ dnl END OF MYSQL_CHECK_NDBCLUSTER SECTION dnl --------------------------------------------------------------------------- dnl dnl Macro to check time_t range: according to C standard dnl array index myst be greater then 0 => if time_t is signed dnl the code in the macros below won't compile. dnl AC_DEFUN([MYSQL_CHECK_TIME_T],[ AC_MSG_CHECKING(if time_t is unsigned) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ #include <time.h> ]], [[ int array[(((time_t)-1) > 0) ? 1 : -1]; ]] ) ], [ AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned]) AC_MSG_RESULT(yes) ], [AC_MSG_RESULT(no)] ) ]) dnl By default, many hosts won't let programs access large files; dnl one must use special compiler options to get large-file access to work. dnl For more details about this brain damage please see: Loading
configure.in +7 −0 Original line number Diff line number Diff line Loading @@ -1824,6 +1824,13 @@ then AC_MSG_ERROR("MySQL needs a off_t type.") fi dnl dnl check if time_t is unsigned dnl MYSQL_CHECK_TIME_T # do we need #pragma interface/#pragma implementation ? # yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin AC_MSG_CHECKING(the need for @%:@pragma interface/implementation) Loading
include/my_time.h +32 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,14 @@ typedef long my_time_t; #define MY_TIME_T_MAX LONG_MAX #define MY_TIME_T_MIN LONG_MIN /* Time handling defaults */ #define TIMESTAMP_MAX_YEAR 2038 #define YY_PART_YEAR 70 #define TIMESTAMP_MIN_YEAR (1900 + YY_PART_YEAR - 1) #define TIMESTAMP_MAX_VALUE INT_MAX32 #define TIMESTAMP_MIN_VALUE 1 #define YY_PART_YEAR 70 /* Flags to str_to_datetime */ Loading Loading @@ -67,6 +75,30 @@ long calc_daynr(uint year,uint month,uint day); void init_time(void); /* Function to check sanity of a TIMESTAMP value DESCRIPTION Check if a given MYSQL_TIME value fits in TIMESTAMP range. This function doesn't make precise check, but rather a rough estimate. RETURN VALUES FALSE The value seems sane TRUE The MYSQL_TIME value is definitely out of range */ static inline bool validate_timestamp_range(const MYSQL_TIME *t) { if ((t->year > TIMESTAMP_MAX_YEAR || t->year < TIMESTAMP_MIN_YEAR) || (t->year == TIMESTAMP_MAX_YEAR && (t->month > 1 || t->day > 19)) || (t->year == TIMESTAMP_MIN_YEAR && (t->month < 12 || t->day < 31))) return FALSE; return TRUE; } my_time_t my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap); Loading
mysql-test/include/report-features.test 0 → 100644 +11 −0 Original line number Diff line number Diff line # # show server variables # --disable_query_log --echo ===== ENGINES ===== show engines; --echo ===== VARIABLES ===== show variables; --echo ===== STOP ===== --enable_query_log
mysql-test/mysql-test-run.pl +49 −3 Original line number Diff line number Diff line Loading @@ -182,6 +182,7 @@ our $opt_force; our $opt_reorder= 0; our $opt_enable_disabled; our $opt_mem= $ENV{'MTR_MEM'}; our $opt_report_features; our $opt_gcov; our $opt_gcov_err; Loading Loading @@ -427,6 +428,10 @@ sub main () { initialize_servers(); if ( $opt_report_features ) { run_report_features(); } run_suite($opt_suite, $tests); } Loading Loading @@ -670,6 +675,7 @@ sub command_line_setup () { 'mem:s' => \$opt_mem, # Misc 'report-features' => \$opt_report_features, 'comment=s' => \$opt_comment, 'debug' => \$opt_debug, 'fast' => \$opt_fast, Loading Loading @@ -4196,6 +4202,43 @@ sub run_check_testcase ($$) { return $res; } ############################################################################## # # Report the features that were compiled in # ############################################################################## sub run_report_features () { my $args; if ( ! $glob_use_embedded_server ) { mysqld_start($master->[0],[],[]); if ( ! $master->[0]->{'pid'} ) { mtr_error("Can't start the mysqld server"); } mysqld_wait_started($master->[0]); } my $tinfo = {}; $tinfo->{'name'} = 'report features'; $tinfo->{'result_file'} = undef; $tinfo->{'component_id'} = 'mysqld'; $tinfo->{'path'} = 'include/report-features.test'; $tinfo->{'timezone'}= "GMT-3"; $tinfo->{'slave_num'} = 0; $tinfo->{'master_opt'} = []; $tinfo->{'slave_opt'} = []; $tinfo->{'slave_mi'} = []; $tinfo->{'comment'} = 'report server features'; run_mysqltest($tinfo); if ( ! $glob_use_embedded_server ) { stop_all_servers(); } } sub run_mysqltest ($) { Loading Loading @@ -4333,8 +4376,10 @@ sub run_mysqltest ($) { mtr_add_arg($args, "--test-file"); mtr_add_arg($args, $tinfo->{'path'}); if ( defined $tinfo->{'result_file'} ) { mtr_add_arg($args, "--result-file"); mtr_add_arg($args, $tinfo->{'result_file'}); } if ( $opt_record ) { Loading Loading @@ -4746,3 +4791,4 @@ HERE mtr_exit(1); }