summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.h
diff options
context:
space:
mode:
authorunknown <monty@mysql.com/narttu.mysql.fi>2007-03-23 22:08:31 +0200
committerunknown <monty@mysql.com/narttu.mysql.fi>2007-03-23 22:08:31 +0200
commit212ecf348cbb43f71cfd14a51ca19b7ef987859f (patch)
treee49fe06028525f2e9ade2717aa57f2ed8c319576 /sql/item_timefunc.h
parenta79e08a6e109982688cf37e5486282aa2af2a18d (diff)
downloadmariadb-git-212ecf348cbb43f71cfd14a51ca19b7ef987859f.tar.gz
Removed not used define YY_MAGIC_BELOW
Made year 2000 handling more uniform Removed year 2000 handling out from calc_days() The above removes some bugs in date/datetimes with year between 0 and 200 Now we get a note when we insert a datetime value into a date column For default values to CREATE, don't give errors for warning level NOTE Fixed some compiler failures Added library ws2_32 for windows compilation (needed if we want to compile with IOCP support) Removed duplicate typedef TIME and replaced it with MYSQL_TIME Better (more complete) fix for: Bug#21103 "DATE column not compared as DATE" Fixed properly Bug#18997 "DATE_ADD and DATE_SUB perform year2K autoconversion magic on 4-digit year value" Fixed Bug#23093 "Implicit conversion of 9912101 to date does not match cast(9912101 as date)" include/my_time.h: Removed not used define YY_MAGIC_BELOW Added prototype for year_2000_handling() mysql-test/r/date_formats.result: Updated results (fixed bug in date_format() with year < 99) mysql-test/r/func_sapdb.result: Added more testing of make_date() mysql-test/r/func_time.result: Fixed bug in date_sub() with years < 200 mysql-test/r/ps_2myisam.result: Now we get a note when we insert a datetime value into a date column mysql-test/r/ps_3innodb.result: Now we get a note when we insert a datetime value into a date column mysql-test/r/ps_4heap.result: Now we get a note when we insert a datetime value into a date column mysql-test/r/ps_5merge.result: Now we get a note when we insert a datetime value into a date column mysql-test/r/ps_7ndb.result: Now we get a note when we insert a datetime value into a date column mysql-test/r/type_date.result: Added test for date conversions mysql-test/r/type_datetime.result: Added testcase for datetime to date conversion. mysql-test/t/date_formats.test: Added testing of dates < 200 mysql-test/t/func_sapdb.test: More testing of makedate() mysql-test/t/type_date.test: Added test for date conversions mysql-test/t/type_datetime.test: Added testcase for datetime to date conversion. sql/CMakeLists.txt: Added library ws2_32 (needed if we want to compile with IOCP support) sql/event_data_objects.cc: TIME -> MYSQL_TIME sql/event_db_repository.cc: TIME -> MYSQL_TIME sql/event_queue.cc: TIME -> MYSQL_TIME sql/field.cc: Give note if we insert a datetime value in a date field Don't give notes if we are doing internal test conversions (like from convert_constant_item()) More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error)) Revert some changes in Field_newdate::store() to get more optimal code Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set. New parameters to make_truncated_value_warning() sql/field.h: TIME -> MYSQL_TIME sql/item.cc: New parameters to make_truncated_value_warning() Fixed get_date() to call number_to_datetime() if argument is not a string. Fixes Bug#23093 Implicit conversion of 9912101 to date does not match cast(9912101 as date) sql/item.h: TIME -> MYSQL_TIME sql/item_cmpfunc.cc: Don't print notes in convert_constant_item() sql/item_func.h: TIME -> MYSQL_TIME sql/item_timefunc.cc: New parameters to make_truncated_value_warning() Moved year 2000 handling out from calc_days() Don't return NULL for years < 200 in date_add/date_sub sql/item_timefunc.h: TIME -> MYSQL_TIME sql/my_decimal.cc: TIME -> MYSQL_TIME sql/my_decimal.h: TIME -> MYSQL_TIME sql/mysql_priv.h: Added error level to make_truncated_value_warning() sql/protocol.cc: TIME -> MYSQL_TIME sql/protocol.h: TIME -> MYSQL_TIME sql/sp.cc: TIME -> MYSQL_TIME sql/sql_base.cc: Make testing of result value of save_in_field() uniform sql-common/my_time.c: Added year_2000_handling() Removed year 2000 handling from calc_daynr() sql/sql_class.h: TIME -> MYSQL_TIME sql/sql_show.cc: TIME -> MYSQL_TIME sql/structs.h: TIME -> MYSQL_TIME sql/time.cc: Added error level to make_truncated_value_warning() sql/tztime.cc: TIME -> MYSQL_TIME sql/tztime.h: TIME -> MYSQL_TIME sql/unireg.cc: For default values to CREATE, don't give errors for warning level NOTE (Fixed failed CREATE when we give a datetime value to a date field) strings/ctype-utf8.c: Fixed compiler failures win/README: More comments
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r--sql/item_timefunc.h48
1 files changed, 24 insertions, 24 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index ea93619e59a..992b79753ca 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -449,9 +449,9 @@ public:
/*
Abstract method that defines which time zone is used for conversion.
Converts time current time in my_time_t representation to broken-down
- TIME representation using UTC-SYSTEM or per-thread time zone.
+ MYSQL_TIME representation using UTC-SYSTEM or per-thread time zone.
*/
- virtual void store_now_in_TIME(TIME *now_time)=0;
+ virtual void store_now_in_TIME(MYSQL_TIME *now_time)=0;
bool result_as_longlong() { return TRUE; }
};
@@ -462,7 +462,7 @@ public:
Item_func_curtime_local() :Item_func_curtime() {}
Item_func_curtime_local(Item *a) :Item_func_curtime(a) {}
const char *func_name() const { return "curtime"; }
- virtual void store_now_in_TIME(TIME *now_time);
+ virtual void store_now_in_TIME(MYSQL_TIME *now_time);
};
@@ -472,7 +472,7 @@ public:
Item_func_curtime_utc() :Item_func_curtime() {}
Item_func_curtime_utc(Item *a) :Item_func_curtime(a) {}
const char *func_name() const { return "utc_time"; }
- virtual void store_now_in_TIME(TIME *now_time);
+ virtual void store_now_in_TIME(MYSQL_TIME *now_time);
};
@@ -481,14 +481,14 @@ public:
class Item_func_curdate :public Item_date
{
longlong value;
- TIME ltime;
+ MYSQL_TIME ltime;
public:
Item_func_curdate() :Item_date() {}
longlong val_int() { DBUG_ASSERT(fixed == 1); return (value) ; }
String *val_str(String *str);
void fix_length_and_dec();
- bool get_date(TIME *res, uint fuzzy_date);
- virtual void store_now_in_TIME(TIME *now_time)=0;
+ bool get_date(MYSQL_TIME *res, uint fuzzy_date);
+ virtual void store_now_in_TIME(MYSQL_TIME *now_time)=0;
};
@@ -497,7 +497,7 @@ class Item_func_curdate_local :public Item_func_curdate
public:
Item_func_curdate_local() :Item_func_curdate() {}
const char *func_name() const { return "curdate"; }
- void store_now_in_TIME(TIME *now_time);
+ void store_now_in_TIME(MYSQL_TIME *now_time);
};
@@ -506,7 +506,7 @@ class Item_func_curdate_utc :public Item_func_curdate
public:
Item_func_curdate_utc() :Item_func_curdate() {}
const char *func_name() const { return "utc_date"; }
- void store_now_in_TIME(TIME *now_time);
+ void store_now_in_TIME(MYSQL_TIME *now_time);
};
@@ -518,7 +518,7 @@ protected:
longlong value;
char buff[20*2+32]; // +32 to make my_snprintf_{8bit|ucs2} happy
uint buff_length;
- TIME ltime;
+ MYSQL_TIME ltime;
public:
Item_func_now() :Item_date_func() {}
Item_func_now(Item *a) :Item_date_func(a) {}
@@ -527,8 +527,8 @@ public:
int save_in_field(Field *to, bool no_conversions);
String *val_str(String *str);
void fix_length_and_dec();
- bool get_date(TIME *res, uint fuzzy_date);
- virtual void store_now_in_TIME(TIME *now_time)=0;
+ bool get_date(MYSQL_TIME *res, uint fuzzy_date);
+ virtual void store_now_in_TIME(MYSQL_TIME *now_time)=0;
};
@@ -538,7 +538,7 @@ public:
Item_func_now_local() :Item_func_now() {}
Item_func_now_local(Item *a) :Item_func_now(a) {}
const char *func_name() const { return "now"; }
- virtual void store_now_in_TIME(TIME *now_time);
+ virtual void store_now_in_TIME(MYSQL_TIME *now_time);
virtual enum Functype functype() const { return NOW_FUNC; }
};
@@ -549,7 +549,7 @@ public:
Item_func_now_utc() :Item_func_now() {}
Item_func_now_utc(Item *a) :Item_func_now(a) {}
const char *func_name() const { return "utc_timestamp"; }
- virtual void store_now_in_TIME(TIME *now_time);
+ virtual void store_now_in_TIME(MYSQL_TIME *now_time);
};
@@ -564,13 +564,13 @@ public:
Item_func_sysdate_local(Item *a) :Item_func_now(a) {}
bool const_item() const { return 0; }
const char *func_name() const { return "sysdate"; }
- void store_now_in_TIME(TIME *now_time);
+ void store_now_in_TIME(MYSQL_TIME *now_time);
double val_real();
longlong val_int();
int save_in_field(Field *to, bool no_conversions);
String *val_str(String *str);
void fix_length_and_dec();
- bool get_date(TIME *res, uint fuzzy_date);
+ bool get_date(MYSQL_TIME *res, uint fuzzy_date);
void update_used_tables()
{
Item_func_now::update_used_tables();
@@ -584,7 +584,7 @@ class Item_func_from_days :public Item_date
public:
Item_func_from_days(Item *a) :Item_date(a) {}
const char *func_name() const { return "from_days"; }
- bool get_date(TIME *res, uint fuzzy_date);
+ bool get_date(MYSQL_TIME *res, uint fuzzy_date);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
};
@@ -616,7 +616,7 @@ class Item_func_from_unixtime :public Item_date_func
String *val_str(String *str);
const char *func_name() const { return "from_unixtime"; }
void fix_length_and_dec();
- bool get_date(TIME *res, uint fuzzy_date);
+ bool get_date(MYSQL_TIME *res, uint fuzzy_date);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
};
@@ -652,7 +652,7 @@ class Item_func_convert_tz :public Item_date_func
String *val_str(String *str);
const char *func_name() const { return "convert_tz"; }
void fix_length_and_dec();
- bool get_date(TIME *res, uint fuzzy_date);
+ bool get_date(MYSQL_TIME *res, uint fuzzy_date);
void cleanup();
};
@@ -695,7 +695,7 @@ public:
void fix_length_and_dec();
enum_field_types field_type() const { return cached_field_type; }
longlong val_int();
- bool get_date(TIME *res, uint fuzzy_date);
+ bool get_date(MYSQL_TIME *res, uint fuzzy_date);
bool eq(const Item *item, bool binary_cmp) const;
void print(String *str);
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
@@ -783,7 +783,7 @@ public:
Item_date_typecast(Item *a) :Item_typecast_maybe_null(a) {}
const char *func_name() const { return "cast_as_date"; }
String *val_str(String *str);
- bool get_date(TIME *ltime, uint fuzzy_date);
+ bool get_date(MYSQL_TIME *ltime, uint fuzzy_date);
const char *cast_type() const { return "date"; }
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
Field *tmp_table_field(TABLE *table)
@@ -817,7 +817,7 @@ public:
Item_time_typecast(Item *a) :Item_typecast_maybe_null(a) {}
const char *func_name() const { return "cast_as_time"; }
String *val_str(String *str);
- bool get_time(TIME *ltime);
+ bool get_time(MYSQL_TIME *ltime);
const char *cast_type() const { return "time"; }
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
Field *tmp_table_field(TABLE *table)
@@ -1020,7 +1020,7 @@ public:
:Item_str_func(a, b)
{}
String *val_str(String *str);
- bool get_date(TIME *ltime, uint fuzzy_date);
+ bool get_date(MYSQL_TIME *ltime, uint fuzzy_date);
const char *func_name() const { return "str_to_date"; }
enum_field_types field_type() const { return cached_field_type; }
void fix_length_and_dec();
@@ -1037,5 +1037,5 @@ class Item_func_last_day :public Item_date
public:
Item_func_last_day(Item *a) :Item_date(a) {}
const char *func_name() const { return "last_day"; }
- bool get_date(TIME *res, uint fuzzy_date);
+ bool get_date(MYSQL_TIME *res, uint fuzzy_date);
};