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


Public Member Functions | |
| Item_func_timediff (Item *a, Item *b) | |
| String * | val_str (String *str) |
| const char * | func_name () const |
| enum_field_types | field_type () const |
| void | fix_length_and_dec () |
| Field * | tmp_table_field (TABLE *table) |
Definition at line 858 of file item_timefunc.h.
| enum_field_types Item_func_timediff::field_type | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 865 of file item_timefunc.h.
References MYSQL_TYPE_TIME.
00865 { return MYSQL_TYPE_TIME; }
| void Item_func_timediff::fix_length_and_dec | ( | ) | [inline, virtual] |
Implements Item_result_field.
Definition at line 866 of file item_timefunc.h.
References Item::decimals, Item::max_length, MAX_TIME_WIDTH, Item::maybe_null, and MY_CHARSET_BIN_MB_MAXLEN.
00867 { 00868 decimals=0; 00869 max_length=MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; 00870 maybe_null= 1; 00871 }
| const char* Item_func_timediff::func_name | ( | ) | const [inline, virtual] |
Reimplemented from Item_func.
Definition at line 872 of file item_timefunc.h.
References Item::tmp_table_field_from_field_type().
00873 { 00874 return tmp_table_field_from_field_type(table, 0); 00875 }
Here is the call graph for this function:

Implements Item.
Definition at line 2643 of file item_timefunc.cc.
References Item_func::args, calc_time_diff(), calc_time_from_sec(), DBUG_ASSERT, Item::fixed, Item::get_time(), make_datetime(), st_mysql_time::neg, Item::null_value, st_mysql_time::second_part, TIME_MICROSECOND, TIME_ONLY, and st_mysql_time::time_type.
02644 { 02645 DBUG_ASSERT(fixed == 1); 02646 longlong seconds; 02647 long microseconds; 02648 int l_sign= 1; 02649 TIME l_time1 ,l_time2, l_time3; 02650 02651 null_value= 0; 02652 if (args[0]->get_time(&l_time1) || 02653 args[1]->get_time(&l_time2) || 02654 l_time1.time_type != l_time2.time_type) 02655 goto null_date; 02656 02657 if (l_time1.neg != l_time2.neg) 02658 l_sign= -l_sign; 02659 02660 l_time3.neg= calc_time_diff(&l_time1, &l_time2, l_sign, 02661 &seconds, µseconds); 02662 02663 /* 02664 For MYSQL_TIMESTAMP_TIME only: 02665 If first argument was negative and diff between arguments 02666 is non-zero we need to swap sign to get proper result. 02667 */ 02668 if (l_time1.neg && (seconds || microseconds)) 02669 l_time3.neg= 1-l_time3.neg; // Swap sign of result 02670 02671 calc_time_from_sec(&l_time3, (long) seconds, microseconds); 02672 02673 if (!make_datetime(l_time1.second_part || l_time2.second_part ? 02674 TIME_MICROSECOND : TIME_ONLY, 02675 &l_time3, str)) 02676 return str; 02677 02678 null_date: 02679 null_value=1; 02680 return 0; 02681 }
Here is the call graph for this function:

1.4.7

