diff options
author | monty@hundin.mysql.fi <> | 2001-10-31 18:27:49 +0200 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2001-10-31 18:27:49 +0200 |
commit | d89690e606d38e5b0f1d82117cd26a5264325088 (patch) | |
tree | 603547f133fd6eaa7de511aeb171eb8224e0d208 /sql/field.cc | |
parent | c9e4b2aab32a5d27336a4a2595ee20b3c4ff019d (diff) | |
download | mariadb-git-d89690e606d38e5b0f1d82117cd26a5264325088.tar.gz |
Portability fixes
Fix for consistent 0000-00-00 date handling
Close + open binary logs on flush tables
Fix for AVG() in HAVING.
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 18 |
1 files changed, 8 insertions, 10 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) |