Loading Docs/manual.texi +12 −1 Original line number Diff line number Diff line Loading @@ -17683,7 +17683,7 @@ using @code{myisampack}. @xref{Compressed format}. @section @code{ALTER TABLE} Syntax @example ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...] ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...] [ORDER BY col] alter_specification: ADD [COLUMN] create_definition [FIRST | AFTER column_name ] Loading Loading @@ -17832,6 +17832,14 @@ index exists, it drops the first @code{UNIQUE} index in the table. (@strong{MySQL} marks the first @code{UNIQUE} key as the @code{PRIMARY KEY} if no @code{PRIMARY KEY} was specified explicitly.) @findex ORDER BY @item @code {ORDER BY} allows you to create the new table with the rows in a specific order. Note that the table will not remain in this order after inserts and deletes. In some cases, it may make sorting easier for @strong{MySQL} if the table is in order by the column that you wish to order it by later. @findex ALTER TABLE @item If you use @code{ALTER TABLE} on a @code{MyISAM} table, all non-unique Loading Loading @@ -38312,6 +38320,9 @@ a temporary table @item @code{CHANGE MASTER TO} without specifying @code{MASTER_LOG_POS} would set it to 0 instead of 4 and hit the magic number in the master binlog. @item @code{ALTER TABLE ... ORDER BY ...} syntax added. This will create the new table with the rows in a specific order. @end itemize sql/mysql_priv.h +5 −0 Original line number Diff line number Diff line Loading @@ -281,6 +281,10 @@ bool net_store_data(String *packet,const char *from,uint length); bool net_store_data(String *packet,struct tm *tmp); bool net_store_data(String* packet, I_List<i_string>* str_list); SORT_FIELD * make_unireg_sortorder(ORDER *order, uint *length); int setup_order(THD *thd,TABLE_LIST *tables, List<Item> &fields, List <Item> &all_fields, ORDER *order); int mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &list,COND *conds, List<Item_func_match> &ftfuncs, ORDER *order, ORDER *group,Item *having,ORDER *proc_param, Loading @@ -307,6 +311,7 @@ int mysql_alter_table(THD *thd, char *new_db, char *new_name, List<create_field> &fields, List<Key> &keys,List<Alter_drop> &drop_list, List<Alter_column> &alter_list, ORDER *order, bool drop_primary, enum enum_duplicates handle_duplicates); bool mysql_rename_table(enum db_type base, Loading sql/sql_base.cc +2 −2 Original line number Diff line number Diff line Loading @@ -1905,7 +1905,7 @@ int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys) create_info.db_type=DB_TYPE_DEFAULT; DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name, &create_info, table_list, fields, keys, drop, alter, FALSE, DUP_ERROR)); fields, keys, drop, alter, (ORDER*)0, FALSE, DUP_ERROR)); } Loading @@ -1920,7 +1920,7 @@ int mysql_drop_index(THD *thd, TABLE_LIST *table_list, List<Alter_drop> &drop) create_info.db_type=DB_TYPE_DEFAULT; DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name, &create_info, table_list, fields, keys, drop, alter, FALSE, DUP_ERROR)); fields, keys, drop, alter, (ORDER*)0, FALSE, DUP_ERROR)); } /***************************************************************************** Loading sql/sql_parse.cc +2 −0 Original line number Diff line number Diff line Loading @@ -1158,6 +1158,7 @@ mysql_execute_command(void) &lex->create_info, tables, lex->create_list, lex->key_list, lex->drop_list, lex->alter_list, (ORDER *) lex->order_list.first, lex->drop_primary, lex->duplicates); break; } Loading Loading @@ -1262,6 +1263,7 @@ mysql_execute_command(void) res= mysql_alter_table(thd, NullS, NullS, &create_info, tables, lex->create_list, lex->key_list, lex->drop_list, lex->alter_list, (ORDER *) 0, 0,DUP_ERROR); } else Loading sql/sql_select.cc +2 −7 Original line number Diff line number Diff line Loading @@ -112,15 +112,12 @@ static int remove_dup_with_compare(THD *thd, TABLE *entry, Field **field, static int remove_dup_with_hash_index(THD *thd, TABLE *table, uint field_count, Field **first_field, ulong key_length); static SORT_FIELD * make_unireg_sortorder(ORDER *order, uint *length); static int join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count); static ulong used_blob_length(CACHE_FIELD **ptr); static bool store_record_in_cache(JOIN_CACHE *cache); static void reset_cache(JOIN_CACHE *cache); static void read_cached_record(JOIN_TAB *tab); static bool cmp_buffer_with_ref(JOIN_TAB *tab); static int setup_order(THD *thd,TABLE_LIST *tables, List<Item> &fields, List <Item> &all_fields, ORDER *order); static int setup_group(THD *thd,TABLE_LIST *tables,List<Item> &fields, List<Item> &all_fields, ORDER *order, bool *hidden); static bool setup_new_fields(THD *thd,TABLE_LIST *tables,List<Item> &fields, Loading Loading @@ -5409,8 +5406,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, } static SORT_FIELD * make_unireg_sortorder(ORDER *order, uint *length) SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length) { uint count; SORT_FIELD *sort,*pos; Loading Loading @@ -5752,8 +5748,7 @@ find_order_in_list(THD *thd,TABLE_LIST *tables,ORDER *order,List<Item> &fields, ** and doesn't exits in the select list, add it the the field list. */ static int setup_order(THD *thd,TABLE_LIST *tables,List<Item> &fields, int setup_order(THD *thd,TABLE_LIST *tables,List<Item> &fields, List<Item> &all_fields, ORDER *order) { thd->where="order clause"; Loading Loading
Docs/manual.texi +12 −1 Original line number Diff line number Diff line Loading @@ -17683,7 +17683,7 @@ using @code{myisampack}. @xref{Compressed format}. @section @code{ALTER TABLE} Syntax @example ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...] ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...] [ORDER BY col] alter_specification: ADD [COLUMN] create_definition [FIRST | AFTER column_name ] Loading Loading @@ -17832,6 +17832,14 @@ index exists, it drops the first @code{UNIQUE} index in the table. (@strong{MySQL} marks the first @code{UNIQUE} key as the @code{PRIMARY KEY} if no @code{PRIMARY KEY} was specified explicitly.) @findex ORDER BY @item @code {ORDER BY} allows you to create the new table with the rows in a specific order. Note that the table will not remain in this order after inserts and deletes. In some cases, it may make sorting easier for @strong{MySQL} if the table is in order by the column that you wish to order it by later. @findex ALTER TABLE @item If you use @code{ALTER TABLE} on a @code{MyISAM} table, all non-unique Loading Loading @@ -38312,6 +38320,9 @@ a temporary table @item @code{CHANGE MASTER TO} without specifying @code{MASTER_LOG_POS} would set it to 0 instead of 4 and hit the magic number in the master binlog. @item @code{ALTER TABLE ... ORDER BY ...} syntax added. This will create the new table with the rows in a specific order. @end itemize
sql/mysql_priv.h +5 −0 Original line number Diff line number Diff line Loading @@ -281,6 +281,10 @@ bool net_store_data(String *packet,const char *from,uint length); bool net_store_data(String *packet,struct tm *tmp); bool net_store_data(String* packet, I_List<i_string>* str_list); SORT_FIELD * make_unireg_sortorder(ORDER *order, uint *length); int setup_order(THD *thd,TABLE_LIST *tables, List<Item> &fields, List <Item> &all_fields, ORDER *order); int mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &list,COND *conds, List<Item_func_match> &ftfuncs, ORDER *order, ORDER *group,Item *having,ORDER *proc_param, Loading @@ -307,6 +311,7 @@ int mysql_alter_table(THD *thd, char *new_db, char *new_name, List<create_field> &fields, List<Key> &keys,List<Alter_drop> &drop_list, List<Alter_column> &alter_list, ORDER *order, bool drop_primary, enum enum_duplicates handle_duplicates); bool mysql_rename_table(enum db_type base, Loading
sql/sql_base.cc +2 −2 Original line number Diff line number Diff line Loading @@ -1905,7 +1905,7 @@ int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys) create_info.db_type=DB_TYPE_DEFAULT; DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name, &create_info, table_list, fields, keys, drop, alter, FALSE, DUP_ERROR)); fields, keys, drop, alter, (ORDER*)0, FALSE, DUP_ERROR)); } Loading @@ -1920,7 +1920,7 @@ int mysql_drop_index(THD *thd, TABLE_LIST *table_list, List<Alter_drop> &drop) create_info.db_type=DB_TYPE_DEFAULT; DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name, &create_info, table_list, fields, keys, drop, alter, FALSE, DUP_ERROR)); fields, keys, drop, alter, (ORDER*)0, FALSE, DUP_ERROR)); } /***************************************************************************** Loading
sql/sql_parse.cc +2 −0 Original line number Diff line number Diff line Loading @@ -1158,6 +1158,7 @@ mysql_execute_command(void) &lex->create_info, tables, lex->create_list, lex->key_list, lex->drop_list, lex->alter_list, (ORDER *) lex->order_list.first, lex->drop_primary, lex->duplicates); break; } Loading Loading @@ -1262,6 +1263,7 @@ mysql_execute_command(void) res= mysql_alter_table(thd, NullS, NullS, &create_info, tables, lex->create_list, lex->key_list, lex->drop_list, lex->alter_list, (ORDER *) 0, 0,DUP_ERROR); } else Loading
sql/sql_select.cc +2 −7 Original line number Diff line number Diff line Loading @@ -112,15 +112,12 @@ static int remove_dup_with_compare(THD *thd, TABLE *entry, Field **field, static int remove_dup_with_hash_index(THD *thd, TABLE *table, uint field_count, Field **first_field, ulong key_length); static SORT_FIELD * make_unireg_sortorder(ORDER *order, uint *length); static int join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count); static ulong used_blob_length(CACHE_FIELD **ptr); static bool store_record_in_cache(JOIN_CACHE *cache); static void reset_cache(JOIN_CACHE *cache); static void read_cached_record(JOIN_TAB *tab); static bool cmp_buffer_with_ref(JOIN_TAB *tab); static int setup_order(THD *thd,TABLE_LIST *tables, List<Item> &fields, List <Item> &all_fields, ORDER *order); static int setup_group(THD *thd,TABLE_LIST *tables,List<Item> &fields, List<Item> &all_fields, ORDER *order, bool *hidden); static bool setup_new_fields(THD *thd,TABLE_LIST *tables,List<Item> &fields, Loading Loading @@ -5409,8 +5406,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, } static SORT_FIELD * make_unireg_sortorder(ORDER *order, uint *length) SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length) { uint count; SORT_FIELD *sort,*pos; Loading Loading @@ -5752,8 +5748,7 @@ find_order_in_list(THD *thd,TABLE_LIST *tables,ORDER *order,List<Item> &fields, ** and doesn't exits in the select list, add it the the field list. */ static int setup_order(THD *thd,TABLE_LIST *tables,List<Item> &fields, int setup_order(THD *thd,TABLE_LIST *tables,List<Item> &fields, List<Item> &all_fields, ORDER *order) { thd->where="order clause"; Loading