diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/hostname.cc | 4 | ||||
-rw-r--r-- | sql/item_func.cc | 6 | ||||
-rw-r--r-- | sql/item_func.h | 19 | ||||
-rw-r--r-- | sql/mysql_priv.h | 2 | ||||
-rw-r--r-- | sql/opt_range.cc | 4 | ||||
-rw-r--r-- | sql/sql_parse.cc | 25 | ||||
-rw-r--r-- | sql/sql_test.cc | 12 |
7 files changed, 51 insertions, 21 deletions
diff --git a/sql/hostname.cc b/sql/hostname.cc index a93af8b273e..abccc466a22 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -57,8 +57,8 @@ void hostname_cache_refresh() bool hostname_cache_init() { - host_entry *tmp; - uint offset= (uint) ((char*) (&tmp->ip) - (char*) tmp); + host_entry tmp; + uint offset= (uint) ((char*) (&tmp.ip) - (char*) &tmp); (void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW); if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset, diff --git a/sql/item_func.cc b/sql/item_func.cc index accc5219a71..2d800cddb0d 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2047,13 +2047,14 @@ err: return 0; } + void Item_func_match::init_search(bool no_order) { if (ft_handler) return; if (key == NO_SUCH_KEY) - concat=new Item_func_concat_ws (new Item_string(" ",1), fields); + concat= new Item_func_concat_ws(new Item_string(" ",1), fields); if (master) { @@ -2071,7 +2072,7 @@ void Item_func_match::init_search(bool no_order) // MATCH ... AGAINST (NULL) is meaningless, but possible if (!(ft_tmp=key_item()->val_str(&tmp2))) { - ft_tmp=&tmp2; + ft_tmp= &tmp2; tmp2.set("",0); } @@ -2087,6 +2088,7 @@ void Item_func_match::init_search(bool no_order) } } + bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist) { List_iterator<Item> li(fields); diff --git a/sql/item_func.h b/sql/item_func.h index 35f17d1686b..57147b6336f 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -171,9 +171,22 @@ class Item_num_op :public Item_func bool is_null() { (void) val(); return null_value; } Field *tmp_table_field(TABLE *t_arg) { - if (!t_arg) return result_field; - return args[0]->result_type() == INT_RESULT ? ((max_length > 11) ? (Field *)new Field_longlong(max_length,maybe_null,name, t_arg,unsigned_flag) : (Field *)new Field_long(max_length,maybe_null,name, t_arg,unsigned_flag)) : (Field *) new Field_double(max_length, maybe_null, name,t_arg,decimals); - } + Field *res; + if (!t_arg) + return result_field; + if (args[0]->result_type() == INT_RESULT) + { + if (max_length > 11) + res= new Field_longlong(max_length, maybe_null, name, t_arg, + unsigned_flag); + else + res= new Field_long(max_length, maybe_null, name, t_arg, + unsigned_flag); + } + else + res= new Field_double(max_length, maybe_null, name, t_arg, decimals); + return res; + } }; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 1637546e09c..a22299b0af0 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -75,7 +75,7 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); #define MAX_FIELDS_BEFORE_HASH 32 #define USER_VARS_HASH_SIZE 16 #define STACK_MIN_SIZE 8192 // Abort if less stack during eval. -#define STACK_BUFF_ALLOC 32 // For stack overrun checks +#define STACK_BUFF_ALLOC 64 // For stack overrun checks #ifndef MYSQLD_NET_RETRY_COUNT #define MYSQLD_NET_RETRY_COUNT 10 // Abort read after this many int. #endif diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 33574a81431..2a76229ecf9 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -67,7 +67,9 @@ public: SEL_ARG(Field *field, uint8 part, char *min_value, char *max_value, uint8 min_flag, uint8 max_flag, uint8 maybe_flag); SEL_ARG(enum Type type_arg) - :elements(1),use_count(1),left(0),next_key_part(0),type(type_arg) {} + :elements(1),use_count(1),left(0),next_key_part(0),color(BLACK), + type(type_arg) + {} inline bool is_same(SEL_ARG *arg) { if (type != arg->type) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7124066bd3b..783a1631fad 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -345,13 +345,12 @@ char uc_update_queries[SQLCOM_END]; static bool check_mqh(THD *thd, uint check_command) { bool error=0; - DBUG_ENTER("check_mqh"); + time_t check_time = thd->start_time ? thd->start_time : time(NULL); USER_CONN *uc=thd->user_connect; + DBUG_ENTER("check_mqh"); DBUG_ASSERT(uc != 0); - bool my_start = thd->start_time != 0; - time_t check_time = (my_start) ? thd->start_time : time(NULL); - + /* If more than a hour since last check, reset resource checking */ if (check_time - uc->intime >= 3600) { (void) pthread_mutex_lock(&LOCK_user_conn); @@ -361,6 +360,7 @@ static bool check_mqh(THD *thd, uint check_command) uc->intime=check_time; (void) pthread_mutex_unlock(&LOCK_user_conn); } + /* Check that we have not done too many questions / hour */ if (uc->user_resources.questions && uc->questions++ >= uc->user_resources.questions) { @@ -371,14 +371,15 @@ static bool check_mqh(THD *thd, uint check_command) } if (check_command < (uint) SQLCOM_END) { - if (uc->user_resources.updates && uc_update_queries[check_command] && - ++(uc->updates) > uc->user_resources.updates) - { - net_printf(&thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_updates", - (long) uc->user_resources.updates); - error=1; - goto end; - } + /* Check that we have not done too many updates / hour */ + if (uc->user_resources.updates && uc_update_queries[check_command] && + uc->updates++ >= uc->user_resources.updates) + { + net_printf(&thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_updates", + (long) uc->user_resources.updates); + error=1; + goto end; + } } end: DBUG_RETURN(error); diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 43c24da85a2..9c458c27b95 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -21,6 +21,7 @@ #include "mysql_priv.h" #include "sql_select.h" #include <hash.h> +#include <thr_alarm.h> /* Intern key cache variables */ extern "C" pthread_mutex_t THR_LOCK_keycache; @@ -239,6 +240,17 @@ Open streams: %10lu\n", (ulong) cached_tables(), (ulong) my_file_opened, (ulong) my_stream_opened); + + ALARM_INFO alarm_info; + thr_alarm_info(&alarm_info); + printf("\nAlarm status:\n\ +Active alarms: %u\n\ +Max used alarms: %u\n\ +Next alarm time: %lu\n", + alarm_info.active_alarms, + alarm_info.max_used_alarms, + alarm_info.next_alarm_time); + fflush(stdout); if (thd) thd->proc_info="malloc"; |