diff options
author | Sinisa@sinisa.nasamreza.org <> | 2001-12-26 16:49:10 +0200 |
---|---|---|
committer | Sinisa@sinisa.nasamreza.org <> | 2001-12-26 16:49:10 +0200 |
commit | 038db406c15f3ebe90639218a447d98467749796 (patch) | |
tree | 1924b9282a4aed314ccafcecea76220ffcee2576 /sql/item_timefunc.h | |
parent | ec761d573022bd586349ea22001f1cfc49fb2a45 (diff) | |
download | mariadb-git-038db406c15f3ebe90639218a447d98467749796.tar.gz |
This is a large push. Included are :
* multi-table updates
* new paid feature for limiting number of queries per hour for users
* optional syntax for multi-table deletes
* optimization for SQL_CALC_FOUND_ROWS
* a small addition for CREATE .. SELECT that will be of future use
I know that all this will require many additions to documentation,
which I have not done, but I am at Arjen's disposal to help him document
all this.
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r-- | sql/item_timefunc.h | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 1343cdad390..e1df072ff2a 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -229,6 +229,23 @@ public: const char *func_name() const { return "date"; } void fix_length_and_dec() { decimals=0; max_length=10; } bool save_in_field(Field *to); + void make_field(Send_field *tmp_field) + { + init_make_field(tmp_field,FIELD_TYPE_DATE); + } +}; + + +class Item_date_func :public Item_str_func +{ +public: + Item_date_func() :Item_str_func() {} + Item_date_func(Item *a) :Item_str_func(a) {} + Item_date_func(Item *a,Item *b) :Item_str_func(a,b) {} + void make_field(Send_field *tmp_field) + { + init_make_field(tmp_field,FIELD_TYPE_DATETIME); + } }; @@ -247,6 +264,10 @@ public: { str_value.set(buff,buff_length); return &str_value; } const char *func_name() const { return "curtime"; } void fix_length_and_dec(); + void make_field(Send_field *tmp_field) + { + init_make_field(tmp_field,FIELD_TYPE_TIME); + } }; @@ -263,15 +284,15 @@ public: }; -class Item_func_now :public Item_func +class Item_func_now :public Item_date_func { longlong value; char buff[20]; uint buff_length; TIME ltime; public: - Item_func_now() :Item_func() {} - Item_func_now(Item *a) :Item_func(a) {} + Item_func_now() :Item_date_func() {} + Item_func_now(Item *a) :Item_date_func(a) {} enum Item_result result_type () const { return STRING_RESULT; } double val() { return (double) value; } longlong val_int() { return value; } @@ -307,16 +328,16 @@ public: }; -class Item_func_from_unixtime :public Item_func +class Item_func_from_unixtime :public Item_date_func { public: - Item_func_from_unixtime(Item *a) :Item_func(a) {} + Item_func_from_unixtime(Item *a) :Item_date_func(a) {} double val() { return (double) Item_func_from_unixtime::val_int(); } longlong val_int(); String *val_str(String *str); const char *func_name() const { return "from_unixtime"; } void fix_length_and_dec() { decimals=0; max_length=19; } - enum Item_result result_type () const { return STRING_RESULT; } +// enum Item_result result_type () const { return STRING_RESULT; } bool get_date(TIME *res,bool fuzzy_date); }; @@ -330,6 +351,10 @@ public: String *val_str(String *); void fix_length_and_dec() { maybe_null=1; max_length=13; } const char *func_name() const { return "sec_to_time"; } + void make_field(Send_field *tmp_field) + { + init_make_field(tmp_field,FIELD_TYPE_TIME); + } }; enum interval_type { INTERVAL_YEAR, INTERVAL_MONTH, INTERVAL_DAY, @@ -339,7 +364,7 @@ enum interval_type { INTERVAL_YEAR, INTERVAL_MONTH, INTERVAL_DAY, INTERVAL_HOUR_MINUTE, INTERVAL_HOUR_SECOND, INTERVAL_MINUTE_SECOND}; -class Item_date_add_interval :public Item_str_func +class Item_date_add_interval :public Item_date_func { const interval_type int_type; String value; @@ -347,7 +372,7 @@ class Item_date_add_interval :public Item_str_func public: Item_date_add_interval(Item *a,Item *b,interval_type type_arg,bool neg_arg) - :Item_str_func(a,b),int_type(type_arg), date_sub_interval(neg_arg) {} + :Item_date_func(a,b),int_type(type_arg), date_sub_interval(neg_arg) {} String *val_str(String *); const char *func_name() const { return "date_add_interval"; } void fix_length_and_dec() { maybe_null=1; max_length=19; value.alloc(32);} |