summaryrefslogtreecommitdiff
path: root/sql/sql_class.h
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-05-28 05:11:32 +0300
committerMichael Widenius <monty@askmonty.org>2011-05-28 05:11:32 +0300
commit557f90b8e3bb23e95bd201f53996c7aa25724778 (patch)
treeb4590b80e7d50b664d8e6ff6a62978cb2402f0a6 /sql/sql_class.h
parent037065e4f79165b10b0d8ab511cedeb573cdbae4 (diff)
parenta0869fa02c5ad6b5d4ba9ad793dcf88e576a441c (diff)
downloadmariadb-git-557f90b8e3bb23e95bd201f53996c7aa25724778.tar.gz
Merge with 5.1-microseconds
A lot of small fixes and new test cases. client/mysqlbinlog.cc: Cast removed client/mysqltest.cc: Added missing DBUG_RETURN include/my_pthread.h: set_timespec_time_nsec() now only takes one argument mysql-test/t/date_formats.test: Remove --disable_ps_protocl as now also ps supports microseconds mysys/my_uuid.c: Changed to use my_interval_timer() instead of my_getsystime() mysys/waiting_threads.c: Changed to use my_hrtime() sql/field.h: Added bool special_const_compare() for fields that may convert values before compare (like year) sql/field_conv.cc: Added test to get optimal copying of identical temporal values. sql/item.cc: Return that item_int is equal if it's positive, even if unsigned flag is different. Fixed Item_cache_str::save_in_field() to have identical null check as other similar functions Added proper NULL check to Item_cache_int::save_in_field() sql/item_cmpfunc.cc: Don't call convert_constant_item() if there is nothing that is worth converting. Simplified test when years should be converted sql/item_sum.cc: Mark cache values in Item_sum_hybrid as not constants to ensure they are not replaced by other cache values in compare_datetime() sql/item_timefunc.cc: Changed sec_to_time() to take a my_decimal argument to ensure we don't loose any sub seconds. Added Item_temporal_func::get_time() (This simplifies some things) sql/mysql_priv.h: Added Lazy_string_decimal() sql/mysqld.cc: Added my_decimal constants max_seconds_for_time_type, time_second_part_factor sql/table.cc: Changed expr_arena to be of type CONVENTIONAL_EXECUTION to ensure that we don't loose any items that are created by fix_fields() sql/tztime.cc: TIME_to_gmt_sec() now sets *in_dst_time_gap in case of errors This is needed to be able to detect if timestamp is 0 storage/maria/lockman.c: Changed from my_getsystime() to set_timespec_time_nsec() storage/maria/ma_loghandler.c: Changed from my_getsystime() to my_hrtime() storage/maria/ma_recovery.c: Changed from my_getsystime() to mmicrosecond_interval_timer() storage/maria/unittest/trnman-t.c: Changed from my_getsystime() to mmicrosecond_interval_timer() storage/xtradb/handler/ha_innodb.cc: Added support for new time,datetime and timestamp unittest/mysys/thr_template.c: my_getsystime() -> my_interval_timer() unittest/mysys/waiting_threads-t.c: my_getsystime() -> my_interval_timer()
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r--sql/sql_class.h69
1 files changed, 52 insertions, 17 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 958e16b9361..23541f20b09 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1525,7 +1525,6 @@ public:
*/
const char *where;
- double tmp_double_value; /* Used in set_var.cc */
ulong client_capabilities; /* What the client supports */
ulong max_client_packet_length;
@@ -1549,7 +1548,9 @@ public:
uint32 file_id; // for LOAD DATA INFILE
/* remote (peer) port */
uint16 peer_port;
- time_t start_time, user_time;
+ my_time_t start_time; // start_time and its sec_part
+ ulong start_time_sec_part; // are almost always used separately
+ my_hrtime_t user_time;
// track down slow pthread_create
ulonglong prior_thr_create_utime, thr_create_utime;
ulonglong start_utime, utime_after_lock;
@@ -1984,6 +1985,7 @@ public:
*/
bool is_fatal_sub_stmt_error;
bool query_start_used, rand_used, time_zone_used;
+ bool query_start_sec_part_used;
/* for IS NULL => = last_insert_id() fix in remove_eq_conds() */
bool substitute_null_with_insert_id;
bool in_lock_tables;
@@ -2044,6 +2046,7 @@ public:
long long_value;
ulong ulong_value;
ulonglong ulonglong_value;
+ double double_value;
} sys_var_tmp;
struct {
@@ -2182,30 +2185,41 @@ public:
proc_info = old_msg;
pthread_mutex_unlock(&mysys_var->mutex);
}
- inline time_t query_start() { query_start_used=1; return start_time; }
+ inline my_time_t query_start() { query_start_used=1; return start_time; }
+ inline ulong query_start_sec_part()
+ { query_start_sec_part_used=1; return start_time_sec_part; }
+ inline void set_current_time()
+ {
+ my_hrtime_t hrtime= my_hrtime();
+ start_time= hrtime_to_my_time(hrtime);
+ start_time_sec_part= hrtime_sec_part(hrtime);
+ }
inline void set_time()
{
- if (user_time)
+ if (user_time.val)
{
- start_time= user_time;
- start_utime= utime_after_lock= my_micro_time();
+ start_time= hrtime_to_my_time(user_time);
+ start_time_sec_part= hrtime_sec_part(user_time);
}
else
- start_utime= utime_after_lock= my_micro_time_and_time(&start_time);
+ set_current_time();
+ start_utime= utime_after_lock= microsecond_interval_timer();
}
- inline void set_current_time() { start_time= my_time(MY_WME); }
- inline void set_time(time_t t)
+ inline void set_time(my_hrtime_t t)
{
- start_time= user_time= t;
- start_utime= utime_after_lock= my_micro_time();
+ user_time= t;
+ start_time= hrtime_to_my_time(user_time);
+ start_time_sec_part= hrtime_sec_part(user_time);
+ start_utime= utime_after_lock= microsecond_interval_timer();
}
- /*TODO: this will be obsolete when we have support for 64 bit my_time_t */
- inline bool is_valid_time()
- {
- return (IS_TIME_T_VALID_FOR_TIMESTAMP(start_time));
+ inline void set_time(my_time_t t, ulong sec_part)
+ {
+ my_hrtime_t hrtime= { hrtime_from_time(t) + sec_part };
+ set_time(hrtime);
}
- void set_time_after_lock() { utime_after_lock= my_micro_time(); }
- ulonglong current_utime() { return my_micro_time(); }
+ void set_time_after_lock() { utime_after_lock= microsecond_interval_timer(); }
+ ulonglong current_utime() { return microsecond_interval_timer(); }
+
inline ulonglong found_rows(void)
{
return limit_found_rows;
@@ -2642,6 +2656,27 @@ my_eof(THD *thd)
/*
+ These functions are for making it later easy to add strict
+ checking for all date handling.
+*/
+
+extern my_bool strict_date_checking;
+
+inline ulong sql_mode_for_dates(THD *thd)
+{
+ if (unlikely(strict_date_checking))
+ return (thd->variables.sql_mode &
+ (MODE_NO_ZERO_DATE | MODE_NO_ZERO_IN_DATE |
+ MODE_INVALID_DATES));
+ return (thd->variables.sql_mode & MODE_INVALID_DATES);
+}
+
+inline ulong sql_mode_for_dates()
+{
+ return sql_mode_for_dates(current_thd);
+}
+
+/*
Used to hold information about file and file structure in exchange
via non-DB file (...INTO OUTFILE..., ...LOAD DATA...)
XXX: We never call destructor for objects of this class.