diff --git a/client/mysqltest.c b/client/mysqltest.c index 5ba4ad7336ca8dead99591a316ca32b9a358e09f..8747f4f82ebb248325ad1b6fb12df2b9501de20c 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -224,7 +224,6 @@ Q_ENABLE_QUERY_LOG, Q_DISABLE_QUERY_LOG, Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG, Q_SERVER_START, Q_SERVER_STOP,Q_REQUIRE_MANAGER, Q_WAIT_FOR_SLAVE_TO_STOP, -Q_REQUIRE_VERSION, Q_REQUIRE_OS, Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS, Q_ENABLE_INFO, Q_DISABLE_INFO, Q_ENABLE_METADATA, Q_DISABLE_METADATA, @@ -297,8 +296,6 @@ const char *command_names[]= "server_stop", "require_manager", "wait_for_slave_to_stop", - "require_version", - "require_os", "enable_warnings", "disable_warnings", "enable_info", @@ -818,63 +815,6 @@ int do_server_op(struct st_query* q,const char* op) } #endif -int do_require_version(struct st_query* q) -{ - MYSQL* mysql = &cur_con->mysql; - MYSQL_RES* res; - MYSQL_ROW row; - char* p=q->first_argument, *ver_arg; - uint ver_arg_len,ver_len; - LINT_INIT(res); - - if (!*p) - die("Missing version argument in require_version\n"); - ver_arg = p; - while (*p && !my_isspace(charset_info,*p)) - p++; - *p = 0; - ver_arg_len = p - ver_arg; - - if (mysql_query(mysql, "select version()") || - !(res=mysql_store_result(mysql))) - die("Query failed while check server version: %s", - mysql_error(mysql)); - if (!(row=mysql_fetch_row(res)) || !row[0]) - { - mysql_free_result(res); - die("Strange result from query while checking version"); - } - ver_len = strlen(row[0]); - if (ver_len < ver_arg_len || memcmp(row[0],ver_arg,ver_arg_len)) - { - mysql_free_result(res); - abort_not_supported_test(); - } - mysql_free_result(res); - return 0; -} - -int do_require_os(struct st_query* q) -{ - char *p=q->first_argument, *os_arg; - DBUG_ENTER("do_require_os"); - - if (!*p) - die("Missing version argument in require_os\n"); - os_arg= p; - while (*p && !my_isspace(charset_info,*p)) - p++; - *p = 0; - - if (strcmp(os_arg, "unix")) - die("For now only testing of os=unix is implemented\n"); - -#if defined(__NETWARE__) || defined(__WIN__) || defined(__OS2__) - abort_not_supported_test(); -#endif - DBUG_RETURN(0); -} - int do_source(struct st_query* q) { char* p=q->first_argument, *name; @@ -2729,15 +2669,13 @@ int main(int argc, char **argv) case Q_DISABLE_RESULT_LOG: disable_result_log=1; break; case Q_ENABLE_WARNINGS: disable_warnings=0; break; case Q_DISABLE_WARNINGS: disable_warnings=1; break; - case Q_ENABLE_INFO: disable_info=0; break; - case Q_DISABLE_INFO: disable_info=1; break; + case Q_ENABLE_INFO: disable_info=0; break; + case Q_DISABLE_INFO: disable_info=1; break; case Q_ENABLE_METADATA: display_metadata=1; break; - case Q_DISABLE_METADATA: display_metadata=0; break; + case Q_DISABLE_METADATA: display_metadata=0; break; case Q_SOURCE: do_source(q); break; case Q_SLEEP: do_sleep(q, 0); break; case Q_REAL_SLEEP: do_sleep(q, 1); break; - case Q_REQUIRE_VERSION: do_require_version(q); break; - case Q_REQUIRE_OS: do_require_os(q); break; case Q_WAIT_FOR_SLAVE_TO_STOP: do_wait_for_slave_to_stop(q); break; case Q_REQUIRE_MANAGER: do_require_manager(q); break; #ifndef EMBEDDED_LIBRARY diff --git a/include/config-win.h b/include/config-win.h index 0298c9012ce1c28e7a95842b7da4aee66a2121d7..b93c5897adfe16cbde6d44825bf4a9b78e8af356 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -348,6 +348,8 @@ inline double ulonglong2double(ulonglong value) #define MYSQL_DEFAULT_CHARSET_NAME "latin1" #define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci" +#define HAVE_SPATIAL 1 + /* Define charsets you want */ /* #undef HAVE_CHARSET_armscii8 */ /* #undef HAVE_CHARSET_ascii */ diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index 52116710726fbf41bc91974ffee80108a6ccd4d5..efc85d3928ea5bf044ba0236ac9019e44d07b035 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -97,8 +97,7 @@ class ha_berkeley: public handler ulong index_flags(uint idx, uint part) const { ulong flags=HA_READ_NEXT | HA_READ_PREV; - if (part == (uint)~0 || - table->key_info[idx].key_part[part].field->key_type() != HA_KEYTYPE_TEXT) + if (table->key_info[idx].key_part[part].field->key_type() != HA_KEYTYPE_TEXT) flags|= HA_READ_ORDER | HA_KEYREAD_ONLY | HA_READ_RANGE; return flags; } diff --git a/sql/handler.h b/sql/handler.h index 506038fccfdf5f3ea910c19ca0975b9837c9bd5b..a3ed1f354959640e77aa2dde0f4e2ca1175994b8 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -449,7 +449,7 @@ public: virtual const char *table_type() const =0; virtual const char **bas_ext() const =0; virtual ulong table_flags(void) const =0; - virtual ulong index_flags(uint idx, uint part=~0) const =0; + virtual ulong index_flags(uint idx, uint part=0) const =0; virtual ulong index_ddl_flags(KEY *wanted_index) const { return (HA_DDL_SUPPORT); } virtual int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 75b00b97ce790288021d438451c177fbb3aa55f3..27f3f476fe7a64b95ff123786ee876c751d27242 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -629,7 +629,7 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref, if (!(field->flags & PART_KEY_FLAG)) return 0; // Not key field *prefix_len= 0; - + TABLE *table= field->table; uint idx= 0; @@ -637,16 +637,17 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref, for (keyinfo= table->key_info, keyinfo_end= keyinfo+table->keys ; keyinfo != keyinfo_end; keyinfo++,idx++) - { - if (!(table->file->index_flags(idx) & HA_READ_ORDER)) - break; - + { KEY_PART_INFO *part,*part_end; key_part_map key_part_to_use= 0; + uint jdx= 0; for (part= keyinfo->key_part, part_end= part+keyinfo->key_parts ; part != part_end ; - part++, key_part_to_use= (key_part_to_use << 1) | 1) + part++, jdx++, key_part_to_use= (key_part_to_use << 1) | 1) { + if (!(table->file->index_flags(idx, jdx) & HA_READ_ORDER)) + return 0; + if (field->eq(part->field)) { ref->key= idx; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 2f8ede4b4cb7c0a3ea6cc9aca7ffe2e2932ddb18..90636364459fa7c3c3aadac4a320a2cc8349633a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2825,7 +2825,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, Set tmp to (previous record count) * (records / combination) */ if ((found_part & 1) && - (!(table->file->index_flags(key) & HA_ONLY_WHOLE_INDEX) || + (!(table->file->index_flags(key,0) & HA_ONLY_WHOLE_INDEX) || found_part == PREV_BITS(uint,keyinfo->key_parts))) { max_key_part=max_part_bit(found_part); @@ -7171,7 +7171,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, */ if (!select->quick->reverse_sorted()) { - if (!(table->file->index_flags(ref_key) & HA_READ_PREV)) + // here used_key_parts >0 + if (!(table->file->index_flags(ref_key,used_key_parts-1) + & HA_READ_PREV)) DBUG_RETURN(0); // Use filesort // ORDER BY range_key DESC QUICK_SELECT_DESC *tmp=new QUICK_SELECT_DESC(select->quick, @@ -7193,8 +7195,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, Use a traversal function that starts by reading the last row with key part (A) and then traverse the index backwards. */ - if (!(table->file->index_flags(ref_key) & HA_READ_PREV)) - DBUG_RETURN(0); // Use filesort + if (!(table->file->index_flags(ref_key,used_key_parts-1) + & HA_READ_PREV)) + DBUG_RETURN(0); // Use filesort tab->read_first_record= join_read_last_key; tab->read_record.read_record= join_read_prev_same; /* fall through */ diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 823552be3a494db707058302192a2c9a18519347..467c774c2e1babdff1779756e92066cde3c807a2 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -995,7 +995,7 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list) str=(key_part->field ? key_part->field->field_name : "?unknown field?"); protocol->store(str, system_charset_info); - if (table->file->index_flags(i) & HA_READ_ORDER) + if (table->file->index_flags(i,j) & HA_READ_ORDER) protocol->store(((key_part->key_part_flag & HA_REVERSE_SORT) ? "D" : "A"), 1, system_charset_info); else diff --git a/sql/table.cc b/sql/table.cc index 5024015c382271de3ef0ddecacf337853daa383d..2b92583e777e8215f7ed5babb39be0f16064db1b 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -167,9 +167,9 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, outparam->keys= keys= disk_buff[0]; outparam->key_parts= key_parts= disk_buff[1]; } - outparam->keys_for_keyread.init(keys); + outparam->keys_for_keyread.init(0); outparam->keys_in_use.init(keys); - outparam->read_only_keys.init(0); + outparam->read_only_keys.init(keys); outparam->quick_keys.init(); outparam->used_keys.init(); outparam->keys_in_use_for_query.init(); @@ -500,13 +500,6 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, if (outparam->key_info[key].flags & HA_FULLTEXT) outparam->key_info[key].algorithm= HA_KEY_ALG_FULLTEXT; - /* This has to be done after the above fulltext correction */ - if (!(outparam->file->index_flags(key) & HA_KEYREAD_ONLY)) - { - outparam->read_only_keys.set_bit(key); - outparam->keys_for_keyread.clear_bit(key); - } - if (primary_key >= MAX_KEY && (keyinfo->flags & HA_NOSAME)) { /* @@ -577,7 +570,11 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, !(field->flags & BLOB_FLAG)) { if (outparam->file->index_flags(key, i) & HA_KEYREAD_ONLY) + { + outparam->read_only_keys.clear_bit(key); + outparam->keys_for_keyread.set_bit(key); field->part_of_key.set_bit(key); + } if (outparam->file->index_flags(key, i) & HA_READ_ORDER) field->part_of_sortkey.set_bit(key); }