diff options
author | unknown <monty@mysql.com> | 2003-12-21 19:39:32 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2003-12-21 19:39:32 +0200 |
commit | d31c6628e1494dd561f96cfb8a1fbfde17fc8ed4 (patch) | |
tree | 82780d2f52e09f3ef112e35fc6f6b3e1dadc3a56 /sql | |
parent | 9e56a0a7711e1f6f2b234db54b3e3d2004069bbf (diff) | |
download | mariadb-git-d31c6628e1494dd561f96cfb8a1fbfde17fc8ed4.tar.gz |
Portability fixes found during 5.0 test compilation
Fixed bug in ORDER BY on a small column (Bug #2147)
Fixed error from pthread_mutex_destroy() when one had wrong errmsg file
client/mysqltest.c:
Added handling of error on query send
(Needed for init_connection.test)
mysql-test/mysql-test-run.sh:
Added tracing of mysqldump and mysqlbinlog
mysql-test/r/init_connect.result:
Updated tests
mysql-test/r/order_by.result:
Added test for bug filesort bug
mysql-test/t/init_connect-master.opt:
Added proper quoting (for Solaris and OSF)
mysql-test/t/init_connect.test:
Portability fix
mysql-test/t/order_by.test:
Added test for bug #2147 (bug in filesort)
sql/filesort.cc:
Fixed bug in filesort (Bug #2147)
sql/item.h:
Clear 'fixed' on cleanup (For prepared statements)
sql/item_func.cc:
Protect mutex destroy.
(Fixed error from pthread_mutex_destroy() when one had wrong errmsg file)
sql/log_event.cc:
Portability fix
sql/sql_class.h:
Fixed compiler warning
sql/sql_prepare.cc:
Portability fix. (Some compilers doesn't support jump over variables declared in for())
Diffstat (limited to 'sql')
-rw-r--r-- | sql/filesort.cc | 14 | ||||
-rw-r--r-- | sql/item.h | 2 | ||||
-rw-r--r-- | sql/item_func.cc | 14 | ||||
-rw-r--r-- | sql/log_event.cc | 4 | ||||
-rw-r--r-- | sql/sql_class.h | 7 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 4 |
6 files changed, 22 insertions, 23 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index 720c059a70b..b69aaf44e46 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -151,8 +151,6 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, records=table->file->estimate_number_of_rows(); selected_records_file= 0; } - if (param.rec_length == param.ref_length && records > param.max_rows) - records=param.max_rows; /* purecov: inspected */ if (multi_byte_charset && !(param.tmp_buffer=my_malloc(param.sort_length,MYF(MY_WME)))) @@ -182,7 +180,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, DISK_BUFFER_SIZE, MYF(MY_WME))) goto err; - param.keys--; + param.keys--; /* TODO: check why we do this */ param.sort_form= table; param.end=(param.local_sortorder=sortorder)+s_length; if ((records=find_all_keys(¶m,select,sort_keys, &buffpek_pointers, @@ -408,16 +406,6 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, if (write_keys(param,sort_keys,idx,buffpek_pointers,tempfile)) DBUG_RETURN(HA_POS_ERROR); idx=0; - if (param->ref_length == param->rec_length && - my_b_tell(tempfile)/param->rec_length >= param->max_rows) - { - /* - We are writing the result index file and have found all - rows that we need. Abort the sort and return the result. - */ - error=HA_ERR_END_OF_FILE; - break; /* Found enough records */ - } indexpos++; } make_sortkey(param,sort_keys[idx++],ref_pos); diff --git a/sql/item.h b/sql/item.h index c6258518213..5def1e2b710 100644 --- a/sql/item.h +++ b/sql/item.h @@ -128,7 +128,7 @@ public: virtual ~Item() { name=0; cleanup(); } /*lint -e1509 */ void set_name(const char *str,uint length, CHARSET_INFO *cs); void init_make_field(Send_field *tmp_field,enum enum_field_types type); - virtual void cleanup() {} + virtual void cleanup() { fixed=0; } virtual void make_field(Send_field *field); virtual bool fix_fields(THD *, struct st_table_list *, Item **); virtual int save_in_field(Field *field, bool no_conversions); diff --git a/sql/item_func.cc b/sql/item_func.cc index 8d8b77e527e..a251be402ce 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1772,17 +1772,25 @@ char *ull_get_key(const ULL *ull,uint *length, return (char*) ull->key; } + +static bool item_user_lock_inited= 0; + void item_user_lock_init(void) { pthread_mutex_init(&LOCK_user_locks,MY_MUTEX_INIT_SLOW); hash_init(&hash_user_locks,system_charset_info, 16,0,0,(hash_get_key) ull_get_key,NULL,0); + item_user_lock_inited= 1; } void item_user_lock_free(void) { - hash_free(&hash_user_locks); - pthread_mutex_destroy(&LOCK_user_locks); + if (item_user_lock_inited) + { + item_user_lock_inited= 0; + hash_free(&hash_user_locks); + pthread_mutex_destroy(&LOCK_user_locks); + } } void item_user_lock_release(ULL *ull) @@ -2442,7 +2450,7 @@ Item_func_get_user_var::val_str(String *str) { DBUG_ENTER("Item_func_get_user_var::val_str"); if (!var_entry) - return (String*) 0; // No such variable + DBUG_RETURN((String*) 0); // No such variable DBUG_RETURN(var_entry->val_str(&null_value, str, decimals)); } diff --git a/sql/log_event.cc b/sql/log_event.cc index b609e6c6b11..1f20948aa82 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2344,13 +2344,13 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli) float8get(real_val, val); it= new Item_real(real_val); val= (char*) &real_val; // Pointer to value in native format - val_len= sizeof(real_val); + val_len= 8; break; case INT_RESULT: int_val= (longlong) uint8korr(val); it= new Item_int(int_val); val= (char*) &int_val; // Pointer to value in native format - val_len= sizeof(int_val); + val_len= 8; break; case STRING_RESULT: it= new Item_string(val, val_len, charset); diff --git a/sql/sql_class.h b/sql/sql_class.h index d663521b296..546a90d2be3 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -801,8 +801,11 @@ public: inline void end_time() { time(&start_time); } inline void set_time(time_t t) { time_after_lock=start_time=user_time=t; } inline void lock_time() { time(&time_after_lock); } - inline void insert_id(ulonglong id) - { last_insert_id=id; insert_id_used=1; } + inline void insert_id(ulonglong id_arg) + { + last_insert_id= id_arg; + insert_id_used=1; + } inline ulonglong insert_id(void) { if (!last_insert_id_used) diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index f60e0db58d0..a513e445db9 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -887,7 +887,7 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length) { LEX *lex; Prepared_statement *stmt= new Prepared_statement(thd); - + SELECT_LEX *sl; DBUG_ENTER("mysql_stmt_prepare"); if (stmt == 0) @@ -918,7 +918,7 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length) my_pthread_setprio(pthread_self(),WAIT_PRIOR); // save WHERE clause pointers to avoid damaging they by optimisation - for (SELECT_LEX *sl= thd->lex->all_selects_list; + for (sl= thd->lex->all_selects_list; sl; sl= sl->next_select_in_list()) { |