diff options
author | unknown <monty@narttu.mysql.fi> | 2003-09-29 19:07:51 +0300 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2003-09-29 19:07:51 +0300 |
commit | d5f0f77411f80be53c57fdd7b942230010a1140a (patch) | |
tree | 98a8656e0da3b3d003a40ddfd60a4a44a14bcbf3 /sql | |
parent | a8cd1d277336214680d17b42d8becd58c900eb85 (diff) | |
parent | 3b3b0d3a3d1fc9ec1e5637e94699cba7baf9a0ff (diff) | |
download | mariadb-git-d5f0f77411f80be53c57fdd7b942230010a1140a.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into narttu.mysql.fi:/my/mysql-4.1
sql/mysqld.cc:
Auto merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_myisam.cc | 4 | ||||
-rw-r--r-- | sql/item_subselect.cc | 77 | ||||
-rw-r--r-- | sql/item_subselect.h | 11 | ||||
-rw-r--r-- | sql/mysqld.cc | 8 |
4 files changed, 53 insertions, 47 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index cec1aefa2d5..864ee55a85f 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -898,7 +898,7 @@ int ha_myisam::index_read(byte * buf, const byte * key, uint key_len, enum ha_rkey_function find_flag) { statistic_increment(ha_read_key_count,&LOCK_status); - int error=mi_rkey(file,buf,active_index, key, key_len, (enum ha_rkey_function)find_flag); + int error=mi_rkey(file,buf,active_index, key, key_len, find_flag); table->status=error ? STATUS_NOT_FOUND: 0; return error; } @@ -907,7 +907,7 @@ int ha_myisam::index_read_idx(byte * buf, uint index, const byte * key, uint key_len, enum ha_rkey_function find_flag) { statistic_increment(ha_read_key_count,&LOCK_status); - int error=mi_rkey(file,buf,index, key, key_len, (enum ha_rkey_function)find_flag); + int error=mi_rkey(file,buf,index, key, key_len, find_flag); table->status=error ? STATUS_NOT_FOUND: 0; return error; } diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 7c4fe8621a7..cf79ba1fcc1 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -36,7 +36,7 @@ inline Item * and_items(Item* cond, Item *item) Item_subselect::Item_subselect(): Item_result_field(), engine_owner(1), value_assigned(0), substitution(0), - have_to_be_excluded(0), engine_changed(0) + engine(0), have_to_be_excluded(0), engine_changed(0) { reset(); /* @@ -46,6 +46,7 @@ Item_subselect::Item_subselect(): null_value= 1; } + void Item_subselect::init(THD *thd, st_select_lex *select_lex, select_subselect *result) { @@ -62,6 +63,7 @@ void Item_subselect::init(THD *thd, st_select_lex *select_lex, DBUG_VOID_RETURN; } + Item_subselect::~Item_subselect() { if (engine_owner) @@ -693,6 +695,7 @@ Item_in_subselect::row_value_transformer(JOIN *join, DBUG_RETURN(RES_OK); } + Item_subselect::trans_res Item_in_subselect::select_transformer(JOIN *join) { @@ -702,18 +705,21 @@ Item_in_subselect::select_transformer(JOIN *join) return row_value_transformer(join, left_expr); } + Item_subselect::trans_res Item_allany_subselect::select_transformer(JOIN *join) { return single_value_transformer(join, left_expr, func); } -subselect_single_select_engine::subselect_single_select_engine(THD *thd, - st_select_lex *select, - select_subselect *result, - Item_subselect *item): - subselect_engine(thd, item, result), - prepared(0), optimized(0), executed(0) + +subselect_single_select_engine:: +subselect_single_select_engine(THD *thd, + st_select_lex *select, + select_subselect *result, + Item_subselect *item) + :subselect_engine(thd, item, result), + prepared(0), optimized(0), executed(0) { select_lex= select; SELECT_LEX_UNIT *unit= select_lex->master_unit(); @@ -732,11 +738,12 @@ subselect_single_select_engine::subselect_single_select_engine(THD *thd, this->select_lex= select_lex; } + subselect_union_engine::subselect_union_engine(THD *thd, st_select_lex_unit *u, select_subselect *result, - Item_subselect *item): - subselect_engine(thd, item, result) + Item_subselect *item) + :subselect_engine(thd, item, result) { unit= u; if (!result) @@ -919,6 +926,7 @@ int subselect_union_engine::exec() return res; } + int subselect_uniquesubquery_engine::exec() { DBUG_ENTER("subselect_uniquesubquery_engine::exec"); @@ -940,34 +948,22 @@ int subselect_uniquesubquery_engine::exec() { error= 0; table->null_row= 0; - if (table->status) - ((Item_in_subselect *) item)->value= 0; - else - ((Item_in_subselect *) item)->value= (!cond || cond->val_int()?1:0); + ((Item_in_subselect *) item)->value= (!table->status && + (!cond || cond->val_int()) ? 1 : + 0); } } - DBUG_RETURN(end_exec(table) || (error != 0)); + DBUG_RETURN(error != 0); } -int subselect_uniquesubquery_engine::end_exec(TABLE *table) + +subselect_uniquesubquery_engine::~subselect_uniquesubquery_engine() { - DBUG_ENTER("subselect_uniquesubquery_engine::end_exec"); - int error=0, tmp; - if ((tmp= table->file->extra(HA_EXTRA_NO_CACHE))) - { - DBUG_PRINT("error", ("extra(HA_EXTRA_NO_CACHE) failed")); - error= 1; - } - if ((tmp= table->file->index_end())) - { - DBUG_PRINT("error", ("index_end() failed")); - error= 1; - } - if (error == 1) - table->file->print_error(tmp, MYF(0)); - DBUG_RETURN(error != 0); + /* Tell handler we don't need the index anymore */ + tab->table->file->index_end(); } + int subselect_indexsubquery_engine::exec() { DBUG_ENTER("subselect_indexsubselect_engine::exec"); @@ -976,9 +972,11 @@ int subselect_indexsubquery_engine::exec() TABLE *table= tab->table; ((Item_in_subselect *) item)->value= 0; + if (check_null) { - *tab->null_ref_key= 0; + /* We need to check for NULL if there wasn't a matching value */ + *tab->null_ref_key= 0; // Search first for not null ((Item_in_subselect *) item)->was_null= 0; } @@ -996,7 +994,7 @@ int subselect_indexsubquery_engine::exec() error= report_error(table, error); else { - for(;;) + for (;;) { error= 0; table->null_row= 0; @@ -1008,7 +1006,7 @@ int subselect_indexsubquery_engine::exec() ((Item_in_subselect *) item)->was_null= 1; else ((Item_in_subselect *) item)->value= 1; - goto finish; + break; } error= table->file->index_next_same(table->record[0], tab->ref.key_buff, @@ -1016,25 +1014,26 @@ int subselect_indexsubquery_engine::exec() if (error && error != HA_ERR_END_OF_FILE) { error= report_error(table, error); - goto finish; + break; } } else { if (!check_null || null_finding) - goto finish; + break; /* We don't need to check nulls */ *tab->null_ref_key= 1; null_finding= 1; - if (safe_index_read(tab)) - goto finish; + /* Check if there exists a row with a null value in the index */ + if ((error= safe_index_read(tab))) + break; } } } } -finish: - DBUG_RETURN(end_exec(table) || (error != 0)); + DBUG_RETURN(error != 0); } + uint subselect_single_select_engine::cols() { return select_lex->item_list.elements; diff --git a/sql/item_subselect.h b/sql/item_subselect.h index a17715c57c1..dc4ac8435f4 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -230,6 +230,7 @@ public: friend class subselect_indexsubquery_engine; }; + /* ALL/ANY/SOME subselect */ class Item_allany_subselect :public Item_in_subselect { @@ -244,6 +245,7 @@ public: trans_res select_transformer(JOIN *join); }; + class subselect_engine: public Sql_alloc { protected: @@ -275,6 +277,7 @@ public: bool may_be_null() { return maybe_null; }; }; + class subselect_single_select_engine: public subselect_engine { my_bool prepared; /* simple subselect is prepared */ @@ -295,6 +298,7 @@ public: void exclude(); }; + class subselect_union_engine: public subselect_engine { st_select_lex_unit *unit; /* corresponding unit structure */ @@ -312,6 +316,7 @@ public: void exclude(); }; + struct st_join_table; class subselect_uniquesubquery_engine: public subselect_engine { @@ -324,17 +329,17 @@ public: Item_subselect *subs, Item *where) :subselect_engine(thd, subs, 0), tab(tab_arg), cond(where) {} - + ~subselect_uniquesubquery_engine(); int prepare(); void fix_length_and_dec(Item_cache** row); int exec(); uint cols() { return 1; } bool dependent() { return 1; } bool uncacheable() { return 1; } - void exclude(); - static int end_exec(TABLE *table); + void exclude(); }; + class subselect_indexsubquery_engine: public subselect_uniquesubquery_engine { bool check_null; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 74127a5d19f..7966bd95211 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5614,14 +5614,16 @@ static uint set_maximum_open_files(uint max_file_limit) rlimit.rlim_cur=rlimit.rlim_max=max_file_limit; if (setrlimit(RLIMIT_NOFILE,&rlimit)) { - sql_print_error("Warning: setrlimit couldn't increase number of open files to more than %lu (request: %u)", - old_cur, max_file_limit); /* purecov: inspected */ + if (global_system_variables.log_warnings) + sql_print_error("Warning: setrlimit couldn't increase number of open files to more than %lu (request: %u)", + old_cur, max_file_limit); /* purecov: inspected */ max_file_limit=old_cur; } else { (void) getrlimit(RLIMIT_NOFILE,&rlimit); - if ((uint) rlimit.rlim_cur != max_file_limit) + if ((uint) rlimit.rlim_cur != max_file_limit && + global_system_variables.log_warnings) sql_print_error("Warning: setrlimit returned ok, but didn't change limits. Max open files is %ld (request: %u)", (ulong) rlimit.rlim_cur, max_file_limit); /* purecov: inspected */ |