diff options
author | unknown <monty@hundin.mysql.fi> | 2001-10-31 18:27:49 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-10-31 18:27:49 +0200 |
commit | 03f6fdd575f71aacd4b6e782c9df4b929f8222b1 (patch) | |
tree | 603547f133fd6eaa7de511aeb171eb8224e0d208 /sql | |
parent | 3f7cf671a1d735a72e98e89d91a16cce085e6817 (diff) | |
download | mariadb-git-03f6fdd575f71aacd4b6e782c9df4b929f8222b1.tar.gz |
Portability fixes
Fix for consistent 0000-00-00 date handling
Close + open binary logs on flush tables
Fix for AVG() in HAVING.
BUILD/SETUP.sh:
Compile MySQL with -O0 to make debugging easier.
Docs/manual.texi:
Changelog
configure.in:
Version change
innobase/buf/buf0lru.c:
Fix for windows
mysql-test/r/func_time.result:
Updated tests
mysql-test/r/having.result:
Updated tests
mysql-test/t/func_time.test:
Updated tests
mysql-test/t/having.test:
Updated tests
mysys/mf_casecnv.c:
Portability fix
mysys/mf_qsort.c:
Portability fix
mysys/my_compress.c:
Portability fix
mysys/my_tempnam.c:
More comments
sql/field.cc:
Fix for consistent 0000-00-00 date handling
sql/item.h:
Fix for AVG() in HAVING
sql/log.cc:
Close + open update logs on flush tables
sql/sql_select.cc:
More debugging info
sql/time.cc:
Fix for consistent 0000-00-00 date handling
strings/ctype.c:
Portability fix
strings/strto.c:
Portability fix
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 18 | ||||
-rw-r--r-- | sql/item.h | 1 | ||||
-rw-r--r-- | sql/log.cc | 38 | ||||
-rw-r--r-- | sql/sql_select.cc | 1 | ||||
-rw-r--r-- | sql/time.cc | 6 |
5 files changed, 35 insertions, 29 deletions
diff --git a/sql/field.cc b/sql/field.cc index b34f58439db..bd923a09dc6 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2412,8 +2412,7 @@ String *Field_timestamp::val_str(String *val_buffer, return val_buffer; } -bool Field_timestamp::get_date(TIME *ltime, - bool fuzzydate __attribute__((unused))) +bool Field_timestamp::get_date(TIME *ltime, bool fuzzydate) { long temp; #ifdef WORDS_BIGENDIAN @@ -2424,6 +2423,8 @@ bool Field_timestamp::get_date(TIME *ltime, longget(temp,ptr); if (temp == 0L) { /* Zero time is "000000" */ + if (!fuzzydate) + return 1; bzero((char*) ltime,sizeof(*ltime)); } else @@ -2447,8 +2448,7 @@ bool Field_timestamp::get_date(TIME *ltime, bool Field_timestamp::get_time(TIME *ltime) { - Field_timestamp::get_date(ltime,0); - return 0; + return Field_timestamp::get_date(ltime,0); } int Field_timestamp::cmp(const char *a_ptr, const char *b_ptr) @@ -3029,13 +3029,12 @@ bool Field_newdate::get_date(TIME *ltime,bool fuzzydate) ltime->month= (tmp >> 5) & 15; ltime->year= (tmp >> 9); ltime->time_type=TIMESTAMP_DATE; - return (!fuzzydate && (!ltime->month || !ltime->day) && ltime->year) ? 1 : 0; + return (!fuzzydate && (!ltime->month || !ltime->day)) ? 1 : 0; } bool Field_newdate::get_time(TIME *ltime) { - Field_newdate::get_date(ltime,0); - return 0; + return Field_newdate::get_date(ltime,0); } int Field_newdate::cmp(const char *a_ptr, const char *b_ptr) @@ -3214,13 +3213,12 @@ bool Field_datetime::get_date(TIME *ltime,bool fuzzydate) ltime->day= part1%100; ltime->month= part1/100%100; ltime->year= part1/10000; - return (!fuzzydate && (!ltime->month || !ltime->day) && ltime->year) ? 1 : 0; + return (!fuzzydate && (!ltime->month || !ltime->day)) ? 1 : 0; } bool Field_datetime::get_time(TIME *ltime) { - Field_datetime::get_date(ltime,0); - return 0; + return Field_datetime::get_date(ltime,0); } int Field_datetime::cmp(const char *a_ptr, const char *b_ptr) diff --git a/sql/item.h b/sql/item.h index 9ad633d9278..c868f9d3bf7 100644 --- a/sql/item.h +++ b/sql/item.h @@ -292,6 +292,7 @@ public: Item_result_field() :result_field(0) {} ~Item_result_field() {} /* Required with gcc 2.95 */ Field *tmp_table_field() { return result_field; } + table_map used_tables() const { return 1; } virtual void fix_length_and_dec()=0; }; diff --git a/sql/log.cc b/sql/log.cc index d7825ce0e93..0417f7eb06b 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -513,29 +513,37 @@ bool MYSQL_LOG::is_active(const char* log_file_name) void MYSQL_LOG::new_file(bool inside_mutex) { - // only rotate open logs that are marked non-rotatable - // (binlog with constant name are non-rotatable) - if (is_open() && ! no_rotate) + if (is_open()) { char new_name[FN_REFLEN], *old_name=name; if (!inside_mutex) VOID(pthread_mutex_lock(&LOCK_log)); - if (generate_new_name(new_name, name)) - { - if (!inside_mutex) - VOID(pthread_mutex_unlock(&LOCK_log)); - return; // Something went wrong - } - if (log_type == LOG_BIN) + + if (!no_rotate) { /* - We log the whole file name for log file as the user may decide - to change base names at some point. + only rotate open logs that are marked non-rotatable + (binlog with constant name are non-rotatable) */ - Rotate_log_event r(new_name+dirname_length(new_name)); - r.write(&log_file); - VOID(pthread_cond_broadcast(&COND_binlog_update)); + if (generate_new_name(new_name, name)) + { + if (!inside_mutex) + VOID(pthread_mutex_unlock(&LOCK_log)); + return; // Something went wrong + } + if (log_type == LOG_BIN) + { + /* + We log the whole file name for log file as the user may decide + to change base names at some point. + */ + Rotate_log_event r(new_name+dirname_length(new_name)); + r.write(&log_file); + VOID(pthread_cond_broadcast(&COND_binlog_update)); + } } + else + strmov(new_name, old_name); // Reopen old file name name=0; close(); open(old_name, log_type, new_name); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 14f09454734..c4cd4421f98 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5302,6 +5302,7 @@ static bool fix_having(JOIN *join, Item **having) JOIN_TAB *table=&join->join_tab[join->const_tables]; table_map used_tables= join->const_table_map | table->table->map; + DBUG_EXECUTE("where",print_where(*having,"having");); Item* sort_table_cond=make_cond_for_table(*having,used_tables,used_tables); if (sort_table_cond) { diff --git a/sql/time.cc b/sql/time.cc index e0b74fc9d25..1d7e055f682 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -426,7 +426,6 @@ timestamp_type str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) { uint field_length,year_length,digits,i,number_of_fields,date[7]; - bool date_used=0; const char *pos; const char *end=str+length; DBUG_ENTER("str_to_TIME"); @@ -452,8 +451,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) tmp_value=tmp_value*10 + (uint) (uchar) (*str - '0'); str++; } - if ((date[i]=tmp_value)) - date_used=1; // Found something + date[i]=tmp_value; if (i == 2 && str != end && *str == 'T') str++; // ISO8601: CCYYMMDDThhmmss else if ( i != 5 ) // Skip inter-field delimiters @@ -486,7 +484,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) number_of_fields=i; while (i < 6) date[i++]=0; - if (number_of_fields < 3 || !date_used || date[1] > 12 || + if (number_of_fields < 3 || date[1] > 12 || date[2] > 31 || date[3] > 23 || date[4] > 59 || date[5] > 59 || !fuzzy_date && (date[1] == 0 || date[2] == 0)) { |