#include <item_timefunc.h>
Inheritance diagram for Item_func_str_to_date:


Public Member Functions | |
| Item_func_str_to_date (Item *a, Item *b) | |
| String * | val_str (String *str) |
| bool | get_date (TIME *ltime, uint fuzzy_date) |
| const char * | func_name () const |
| enum_field_types | field_type () const |
| void | fix_length_and_dec () |
| Field * | tmp_table_field (TABLE *table) |
| bool | check_partition_func_processor (byte *bool_arg) |
Private Attributes | |
| enum_field_types | cached_field_type |
| date_time_format_types | cached_format_type |
| timestamp_type | cached_timestamp_type |
| bool | const_item |
Definition at line 955 of file item_timefunc.h.
| enum_field_types Item_func_str_to_date::field_type | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 968 of file item_timefunc.h.
References cached_field_type.
00968 { return cached_field_type; }
| void Item_func_str_to_date::fix_length_and_dec | ( | ) | [virtual] |
Implements Item_result_field.
Definition at line 3012 of file item_timefunc.cc.
References Item_func::args, cached_field_type, cached_format_type, cached_timestamp_type, Item_func::const_item(), DATE_ONLY, Item::decimals, format(), get_date_time_result_type(), MAX_DATE_WIDTH, MAX_DATETIME_FULL_WIDTH, Item::max_length, MAX_TIME_WIDTH, Item::maybe_null, my_charset_bin, MY_CHARSET_BIN_MB_MAXLEN, MYSQL_TIMESTAMP_DATE, MYSQL_TIMESTAMP_DATETIME, MYSQL_TIMESTAMP_NONE, MYSQL_TIMESTAMP_TIME, MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME, MYSQL_TYPE_STRING, MYSQL_TYPE_TIME, Item::null_value, TIME_MICROSECOND, TIME_ONLY, and Item::val_str().
03013 { 03014 char format_buff[64]; 03015 String format_str(format_buff, sizeof(format_buff), &my_charset_bin), *format; 03016 maybe_null= 1; 03017 decimals=0; 03018 cached_field_type= MYSQL_TYPE_STRING; 03019 max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; 03020 cached_timestamp_type= MYSQL_TIMESTAMP_NONE; 03021 format= args[1]->val_str(&format_str); 03022 if (!args[1]->null_value && (const_item= args[1]->const_item())) 03023 { 03024 cached_format_type= get_date_time_result_type(format->ptr(), 03025 format->length()); 03026 switch (cached_format_type) { 03027 case DATE_ONLY: 03028 cached_timestamp_type= MYSQL_TIMESTAMP_DATE; 03029 cached_field_type= MYSQL_TYPE_DATE; 03030 max_length= MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; 03031 break; 03032 case TIME_ONLY: 03033 case TIME_MICROSECOND: 03034 cached_timestamp_type= MYSQL_TIMESTAMP_TIME; 03035 cached_field_type= MYSQL_TYPE_TIME; 03036 max_length= MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; 03037 break; 03038 default: 03039 cached_timestamp_type= MYSQL_TIMESTAMP_DATETIME; 03040 cached_field_type= MYSQL_TYPE_DATETIME; 03041 break; 03042 } 03043 } 03044 }
Here is the call graph for this function:

| const char* Item_func_str_to_date::func_name | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 3046 of file item_timefunc.cc.
References Item_func::args, bzero, cached_timestamp_type, extract_date_time(), format(), String::length(), my_charset_bin, MYSQL_TIMESTAMP_TIME, Item::null_value, String::ptr(), Item::val_str(), and val_str().
Referenced by val_str().
03047 { 03048 DATE_TIME_FORMAT date_time_format; 03049 char val_buff[64], format_buff[64]; 03050 String val_str(val_buff, sizeof(val_buff), &my_charset_bin), *val; 03051 String format_str(format_buff, sizeof(format_buff), &my_charset_bin), *format; 03052 03053 val= args[0]->val_str(&val_str); 03054 format= args[1]->val_str(&format_str); 03055 if (args[0]->null_value || args[1]->null_value) 03056 goto null_date; 03057 03058 null_value= 0; 03059 bzero((char*) ltime, sizeof(ltime)); 03060 date_time_format.format.str= (char*) format->ptr(); 03061 date_time_format.format.length= format->length(); 03062 if (extract_date_time(&date_time_format, val->ptr(), val->length(), 03063 ltime, cached_timestamp_type, 0, "datetime")) 03064 goto null_date; 03065 if (cached_timestamp_type == MYSQL_TIMESTAMP_TIME && ltime->day) 03066 { 03067 /* 03068 Day part for time type can be nonzero value and so 03069 we should add hours from day part to hour part to 03070 keep valid time value. 03071 */ 03072 ltime->hour+= ltime->day*24; 03073 ltime->day= 0; 03074 } 03075 return 0; 03076 03077 null_date: 03078 return (null_value=1); 03079 }
Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from Item_func.
Definition at line 970 of file item_timefunc.h.
References Item::tmp_table_field_from_field_type().
00971 { 00972 return tmp_table_field_from_field_type(table, 1); 00973 }
Here is the call graph for this function:

Implements Item.
Definition at line 3082 of file item_timefunc.cc.
References cached_format_type, Item_func::const_item(), DATE_TIME, DATE_TIME_MICROSECOND, DBUG_ASSERT, Item::fixed, get_date(), make_datetime(), and TIME_FUZZY_DATE.
Referenced by get_date().
03083 { 03084 DBUG_ASSERT(fixed == 1); 03085 TIME ltime; 03086 03087 if (Item_func_str_to_date::get_date(<ime, TIME_FUZZY_DATE)) 03088 return 0; 03089 03090 if (!make_datetime((const_item ? cached_format_type : 03091 (ltime.second_part ? DATE_TIME_MICROSECOND : DATE_TIME)), 03092 <ime, str)) 03093 return str; 03094 return 0; 03095 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 957 of file item_timefunc.h.
Referenced by field_type(), and fix_length_and_dec().
bool Item_func_str_to_date::const_item [private] |
Definition at line 960 of file item_timefunc.h.
1.4.7

