diff options
author | unknown <monty@mashka.mysql.fi> | 2003-02-07 15:47:24 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-02-07 15:47:24 +0200 |
commit | d66e60248c9f448b9d251358e0acfd97d1e3f84e (patch) | |
tree | 0661c54a51aa711947173e8a8e27e2e46cfa971c /sql | |
parent | 2ff82a7b152181a49814f5ea125ca8dc6551fbdd (diff) | |
download | mariadb-git-d66e60248c9f448b9d251358e0acfd97d1e3f84e.tar.gz |
After merge fixes & remove compiler warnings
Added lengths for all MYSQL_FIELD string parameters
Changed field length to 2 byte in .frm files
configure.in:
After merge fixes
include/ft_global.h:
Fixed copyright
include/my_sys.h:
Remove compiler warnings
include/mysql.h:
Added lengths for all MYSQL_FIELD string parameters
include/mysql_com.h:
Remove compiler warning
myisam/ft_boolean_search.c:
Removed compiler warnings
myisam/ft_dump.c:
Removed compiler warnings
myisam/ft_stopwords.c:
Copy file from MySQL 4.0
myisam/mi_delete.c:
Fixed compiler warning
myisam/sort.c:
Indentation changes
myisam/sp_test.c:
Remove compiler warnings
mysql-test/r/func_group.result:
After merge fixes
mysql-test/r/group_by.result:
After merge fixes
mysql-test/r/rpl_insert_id.result:
After merge fixes
mysql-test/r/rpl_master_pos_wait.result:
After merge fixes
mysql-test/t/rpl000009.test:
After merge fixes
mysql-test/t/rpl_insert_id.test:
After merge fixes
mysql-test/t/subselect.test:
After merge fixes
sql/item_cmpfunc.cc:
After merge fixes
sql/item_cmpfunc.h:
After merge fixes
sql/item_func.cc:
After merge fixes
sql/item_func.h:
After merge fixes
sql/item_strfunc.cc:
After merge fixes
sql/item_strfunc.h:
After merge fixes
sql/log.cc:
After merge fixes
sql/mysql_priv.h:
After merge fixes
sql/mysqld.cc:
After merge fixes
sql/sql_db.cc:
After merge fixes
sql/sql_handler.cc:
After merge fixes
sql/sql_parse.cc:
After merge fixes
sql/sql_show.cc:
After merge fixes
sql/sql_udf.cc:
After merge fixes
sql/table.cc:
Changed field length to 2 byte in .frm files
sql/unireg.cc:
Changed field length to 2 byte in .frm files
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_cmpfunc.cc | 35 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 3 | ||||
-rw-r--r-- | sql/item_func.cc | 15 | ||||
-rw-r--r-- | sql/item_func.h | 2 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 39 | ||||
-rw-r--r-- | sql/item_strfunc.h | 7 | ||||
-rw-r--r-- | sql/log.cc | 6 | ||||
-rw-r--r-- | sql/mysql_priv.h | 3 | ||||
-rw-r--r-- | sql/mysqld.cc | 6 | ||||
-rw-r--r-- | sql/sql_db.cc | 2 | ||||
-rw-r--r-- | sql/sql_handler.cc | 23 | ||||
-rw-r--r-- | sql/sql_parse.cc | 18 | ||||
-rw-r--r-- | sql/sql_show.cc | 6 | ||||
-rw-r--r-- | sql/sql_udf.cc | 2 | ||||
-rw-r--r-- | sql/table.cc | 47 | ||||
-rw-r--r-- | sql/unireg.cc | 18 |
16 files changed, 120 insertions, 112 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 30dad9d3f18..7bec9983a20 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -421,21 +421,8 @@ void Item_func_interval::fix_length_and_dec() } maybe_null= 0; max_length= 2; - used_tables_cache|= item->used_tables(); - with_sum_func= with_sum_func || item->with_sum_func; -} - - -void Item_func_interval::split_sum_func(List<Item> &fields) -{ - if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) - item->split_sum_func(fields); - else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) - { - fields.push_front(item); - item= new Item_ref((Item**) fields.head_ref(), 0, item->name); - } - Item_int_func::split_sum_func(fields); + used_tables_cache|= row->used_tables(); + with_sum_func= with_sum_func || row->with_sum_func; } @@ -938,30 +925,34 @@ Item_func_case::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) } -void Item_func_case::split_sum_func(List<Item> &fields) +void Item_func_case::split_sum_func(Item **ref_pointer_array, + List<Item> &fields) { if (first_expr) { if (first_expr->with_sum_func && first_expr->type() != SUM_FUNC_ITEM) - first_expr->split_sum_func(fields); + first_expr->split_sum_func(ref_pointer_array, fields); else if (first_expr->used_tables() || first_expr->type() == SUM_FUNC_ITEM) { + uint el= fields.elements; fields.push_front(first_expr); - first_expr= new Item_ref((Item**) fields.head_ref(), 0, - first_expr->name); + ref_pointer_array[el]= first_expr; + first_expr= new Item_ref(ref_pointer_array + el, 0, first_expr->name); } } if (else_expr) { if (else_expr->with_sum_func && else_expr->type() != SUM_FUNC_ITEM) - else_expr->split_sum_func(fields); + else_expr->split_sum_func(ref_pointer_array, fields); else if (else_expr->used_tables() || else_expr->type() == SUM_FUNC_ITEM) { + uint el= fields.elements; fields.push_front(else_expr); - else_expr= new Item_ref((Item**) fields.head_ref(), 0, else_expr->name); + ref_pointer_array[el]= else_expr; + else_expr= new Item_ref(ref_pointer_array + el, 0, else_expr->name); } } - Item_func::split_sum_func(fields); + Item_func::split_sum_func(ref_pointer_array, fields); } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 6e47bbcc3d1..97e69b5dfe6 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -304,7 +304,6 @@ public: args[0]->top_level_item(); return Item_func::fix_fields(thd, tlist, ref); } - void split_sum_func(List<Item> &fields); void fix_length_and_dec(); const char *func_name() const { return "if"; } }; @@ -354,7 +353,7 @@ public: const char *func_name() const { return "case"; } void print(String *str); bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref); - void split_sum_func(List<Item> &fields); + void split_sum_func(Item **ref_pointer_array, List<Item> &fields); Item *find_item(String *str); void set_outer_resolving(); }; diff --git a/sql/item_func.cc b/sql/item_func.cc index b2faae9425c..6494573458c 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1069,18 +1069,23 @@ longlong Item_func_field::val_int() return 0; } -void Item_func_field::split_sum_func(List<Item> &fields) + +void Item_func_field::split_sum_func(Item **ref_pointer_array, + List<Item> &fields) { if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) - item->split_sum_func(fields); + item->split_sum_func(ref_pointer_array, fields); else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) { + uint el= fields.elements; fields.push_front(item); - item= new Item_ref((Item**) fields.head_ref(), 0, item->name); - } - Item_func::split_sum_func(fields); + ref_pointer_array[el]= item; + item= new Item_ref(ref_pointer_array + el, 0, item->name); + } + Item_func::split_sum_func(ref_pointer_array, fields); } + longlong Item_func_ascii::val_int() { String *res=args[0]->val_str(&value); diff --git a/sql/item_func.h b/sql/item_func.h index 9c5982358f8..7fec2467ff1 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -612,7 +612,7 @@ public: return (item->fix_fields(thd, tlist, &item) || item->check_cols(1) || Item_func::fix_fields(thd, tlist, ref)); } - void split_sum_func(List<Item> &fields); + void split_sum_func(Item **ref_pointer_array, List<Item> &fields); void update_used_tables() { item->update_used_tables() ; Item_func::update_used_tables(); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 037bb60de3d..d5d8e6eeb1d 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -597,16 +597,19 @@ null: return 0; } -void Item_func_concat_ws::split_sum_func(List<Item> &fields) +void Item_func_concat_ws::split_sum_func(Item **ref_pointer_array, + List<Item> &fields) { if (separator->with_sum_func && separator->type() != SUM_FUNC_ITEM) - separator->split_sum_func(fields); + separator->split_sum_func(ref_pointer_array, fields); else if (separator->used_tables() || separator->type() == SUM_FUNC_ITEM) { + uint el= fields.elements; fields.push_front(separator); - separator= new Item_ref((Item**) fields.head_ref(), 0, separator->name); - } - Item_str_func::split_sum_func(fields); + ref_pointer_array[el]= separator; + separator= new Item_ref(ref_pointer_array + el, 0, separator->name); + } + Item_str_func::split_sum_func(ref_pointer_array, fields); } void Item_func_concat_ws::fix_length_and_dec() @@ -1583,16 +1586,19 @@ void Item_func_elt::fix_length_and_dec() } -void Item_func_elt::split_sum_func(List<Item> &fields) +void Item_func_elt::split_sum_func(Item **ref_pointer_array, + List<Item> &fields) { if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) - item->split_sum_func(fields); + item->split_sum_func(ref_pointer_array, fields); else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) { + uint el= fields.elements; fields.push_front(item); - item= new Item_ref((Item**) fields.head_ref(), 0, item->name); - } - Item_str_func::split_sum_func(fields); + ref_pointer_array[el]= item; + item= new Item_ref(ref_pointer_array + el, 0, item->name); + } + Item_str_func::split_sum_func(ref_pointer_array, fields); } @@ -1642,16 +1648,19 @@ String *Item_func_elt::val_str(String *str) } -void Item_func_make_set::split_sum_func(List<Item> &fields) +void Item_func_make_set::split_sum_func(Item **ref_pointer_array, + List<Item> &fields) { if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) - item->split_sum_func(fields); + item->split_sum_func(ref_pointer_array, fields); else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) { + uint el= fields.elements; fields.push_front(item); - item= new Item_ref((Item**) fields.head_ref(), 0, item->name); - } - Item_str_func::split_sum_func(fields); + ref_pointer_array[el]= item; + item= new Item_ref(ref_pointer_array + el, 0, item->name); + } + Item_str_func::split_sum_func(ref_pointer_array, fields); } diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 75ef626bbd4..3a7810fa306 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -105,8 +105,7 @@ public: separator->check_cols(1) || Item_func::fix_fields(thd, tlist, ref)); } - void split_sum_func(List<Item> &fields); - const char *func_name() const { return "concat_ws"; } + void split_sum_func(Item **ref_pointer_array, List<Item> &fields); const char *func_name() const { return "concat_ws"; } void set_outer_resolving() { @@ -381,7 +380,7 @@ public: item->check_cols(1) || Item_func::fix_fields(thd, tlist, ref)); } - void split_sum_func(List<Item> &fields); + void split_sum_func(Item **ref_pointer_array, List<Item> &fields); void fix_length_and_dec(); void update_used_tables(); const char *func_name() const { return "elt"; } @@ -408,7 +407,7 @@ public: item->check_cols(1) || Item_func::fix_fields(thd, tlist, ref)); } - void split_sum_func(List<Item> &fields); + void split_sum_func(Item **ref_pointer_array, List<Item> &fields); void fix_length_and_dec(); void update_used_tables(); const char *func_name() const { return "make_set"; } diff --git a/sql/log.cc b/sql/log.cc index 878606f73e0..6b06bd781ce 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -30,8 +30,6 @@ #include <stdarg.h> #include <m_ctype.h> // For test_if_number -#define files_charset_info &my_charset_latin1 - MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log; extern I_List<i_string> binlog_do_db, binlog_ignore_db; @@ -1546,8 +1544,8 @@ static bool test_if_number(register const char *str, while (*str++ == ' ') ; if (*--str == '-' || *str == '+') str++; - while (my_isdigit(files_charset_info,*str) || (allow_wildcards && - (*str == wild_many || *str == wild_one))) + while (my_isdigit(files_charset_info,*str) || + (allow_wildcards && (*str == wild_many || *str == wild_one))) { flag=1; str++; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 5512272d71c..3336a7fa642 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -63,6 +63,7 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); #endif #define my_thd_charset default_charset_info +#define files_charset_info system_charset_info /*************************************************************************** Configuration parameters @@ -518,7 +519,7 @@ int mysqld_show_logs(THD *thd); void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild); int mysqld_dump_create_info(THD *thd, TABLE *table, int fd = -1); int mysqld_show_create(THD *thd, TABLE_LIST *table_list); -int mysqld_show_create_db(THD *thd, const char *dbname, HA_CREATE_INFO *create); +int mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create); void mysqld_list_processes(THD *thd,const char *user,bool verbose); int mysqld_show_status(THD *thd); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 08c5889257b..cc00894633c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -983,7 +983,7 @@ static void clean_up_mutexes() { (void) pthread_mutex_destroy(&LOCK_mysql_create_db); (void) pthread_mutex_destroy(&LOCK_Acl); - (void) pthread_mutex_destroy(&LOCK_grant); + (void) rwlock_destroy(&LOCK_grant); (void) pthread_mutex_destroy(&LOCK_open); (void) pthread_mutex_destroy(&LOCK_thread_count); (void) pthread_mutex_destroy(&LOCK_mapped_file); @@ -998,7 +998,10 @@ static void clean_up_mutexes() (void) pthread_mutex_destroy(&LOCK_bytes_received); (void) pthread_mutex_destroy(&LOCK_timezone); (void) pthread_mutex_destroy(&LOCK_user_conn); +#ifdef HAVE_REPLICATION (void) pthread_mutex_destroy(&LOCK_rpl_status); + (void) pthread_cond_destroy(&COND_rpl_status); +#endif (void) pthread_mutex_destroy(&LOCK_active_mi); (void) pthread_mutex_destroy(&LOCK_global_system_variables); (void) pthread_cond_destroy(&COND_thread_count); @@ -1006,7 +1009,6 @@ static void clean_up_mutexes() (void) pthread_cond_destroy(&COND_thread_cache); (void) pthread_cond_destroy(&COND_flush_thread_cache); (void) pthread_cond_destroy(&COND_manager); - (void) pthread_cond_destroy(&COND_rpl_status); } /**************************************************************************** diff --git a/sql/sql_db.cc b/sql/sql_db.cc index ffc7f3c9ca2..c2efd392495 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -605,7 +605,7 @@ bool mysql_change_db(THD *thd, const char *name) } -int mysqld_show_create_db(THD *thd, const char *dbname, +int mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create_info) { int length; diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 7683abb41fe..954dceff303 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -158,9 +158,11 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, if (!lock) goto err0; // mysql_lock_tables() printed error message already - /* In ::external_lock InnoDB resets the fields which tell it that - the handle is used in the HANDLER interface. Tell it again that - we are using it for HANDLER. */ + /* + In ::external_lock InnoDB resets the fields which tell it that + the handle is used in the HANDLER interface. Tell it again that + we are using it for HANDLER. + */ table->file->init_table_handle_for_HANDLER(); @@ -273,23 +275,15 @@ err0: return -1; } -/************************************************************************** - Monty: It could easily happen, that the following service functions are - already defined somewhere in the code, but I failed to find them. - If this is the case, just say a word and I'll use old functions here. -**************************************************************************/ - -/* - Note: this function differs from find_locked_table() because we're looking - here for alias, not real table name -*/ static TABLE **find_table_ptr_by_name(THD *thd, const char *db, - const char *alias) + const char *table_name, bool is_alias) { int dblen; TABLE **ptr; + if (!db || ! *db) + db= thd->db ? thd->db : ""; dblen=strlen(db)+1; ptr= &(thd->handler_tables); @@ -299,7 +293,6 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db, !my_strcasecmp(system_charset_info, (is_alias ? table->table_name : table->real_name), table_name)) - !my_strcasecmp(system_charset_info,table->table_name,alias)) break; ptr= &(table->next); } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 69e8b68bab0..d9bfc901475 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -22,8 +22,6 @@ #include <myisam.h> #include <my_dir.h> -#define files_charset_info system_charset_info - #ifdef HAVE_INNOBASE_DB #include "ha_innodb.h" #endif @@ -937,7 +935,7 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd) goto err; } if (lower_case_table_names) - casedn_str(tbl_name); + my_casedn_str(files_charset_info, tbl_name); remove_escape(table_list->real_name); if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT))) @@ -953,7 +951,7 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd) thd->query = tbl_name; if ((error = mysqld_dump_create_info(thd, table, -1))) { - my_error(ER_GET_ERRNO, MYF(0)); + my_error(ER_GET_ERRNO, MYF(0), my_errno); goto err; } net_flush(&thd->net); @@ -966,9 +964,9 @@ err: } -#ifndef EMBEDDED_LIBRARY - /* Execute one command from socket (query or simple command) */ + +#ifndef EMBEDDED_LIBRARY bool do_command(THD *thd) { char *packet; @@ -1268,9 +1266,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd, my_casedn_str(files_charset_info, table_list.real_name); remove_escape(table_list.real_name); // This can't have wildcards - if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT))) - DBUG_RETURN(1); - if (check_access(thd,SELECT_ACL,table_list.db,&thd->col_access)) break; table_list.grant.privilege=thd->col_access; @@ -2649,11 +2644,12 @@ mysql_execute_command(THD *thd) do_db/ignore_db. And as this query involves no tables, tables_ok() above was not called. So we have to check rules again here. */ +#ifdef HAVE_REPLICATION if (thd->slave_thread && (!db_ok(lex->name, replicate_do_db, replicate_ignore_db) || !db_ok_with_wild_table(lex->name))) break; - +#endif if (check_access(thd,CREATE_ACL,lex->name,0,1)) break; res=mysql_create_db(thd,lex->name,&lex->create_info,0); @@ -2673,10 +2669,12 @@ mysql_execute_command(THD *thd) do_db/ignore_db. And as this query involves no tables, tables_ok() above was not called. So we have to check rules again here. */ +#ifdef HAVE_REPLICATION if (thd->slave_thread && (!db_ok(lex->name, replicate_do_db, replicate_ignore_db) || !db_ok_with_wild_table(lex->name))) break; +#endif if (check_access(thd,DROP_ACL,lex->name,0,1)) break; if (thd->locked_tables || thd->active_transaction()) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index b084238a3a4..7cda3d59c59 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -528,7 +528,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) table_list.db=(char*) db; table_list.real_name= table_list.alias= file_name; if (lower_case_table_names) - casedn_str(file_name); + my_casedn_str(files_charset_info, file_name); if (!(table = open_ltable(thd, &table_list, TL_READ))) { for (uint i=0 ; i < field_list.elements ; i++) @@ -958,7 +958,7 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild) restore_record(table,2); // Get empty record if (thd->protocol->send_fields(&field_list,2)) DBUG_VOID_RETURN; - VOID(net_flush(&thd->net)); + net_flush(&thd->net); DBUG_VOID_RETURN; } @@ -981,7 +981,7 @@ mysqld_dump_create_info(THD *thd, TABLE *table, int fd) { if (protocol->write()) DBUG_RETURN(-1); - VOID(net_flush(&thd->net)); + net_flush(&thd->net); } else { diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 4cecebfa90c..39800ae6206 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -236,7 +236,7 @@ void udf_free() if (initialized) { initialized= 0; - pthread_mutex_destroy(&THR_LOCK_udf); + rwlock_destroy(&THR_LOCK_udf); } DBUG_VOID_RETURN; } diff --git a/sql/table.cc b/sql/table.cc index 051048b72d1..a54cc4d5a73 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -95,11 +95,11 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, if (my_read(file,(byte*) head,64,MYF(MY_NABP))) goto err_not_open; if (head[0] != (uchar) 254 || head[1] != 1 || - (head[2] != FRM_VER && head[2] > FRM_VER+2)) + (head[2] != FRM_VER && head[2] != FRM_VER+1 && head[2] != FRM_VER+3)) goto err_not_open; /* purecov: inspected */ new_field_pack_flag=head[27]; new_frm_ver= (head[2] - FRM_VER); - field_pack_length= new_frm_ver < 2 ? 11 : 15; + field_pack_length= new_frm_ver < 2 ? 11 : 17; error=3; if (!(pos=get_form_pos(file,head,(TYPELIB*) 0))) @@ -156,7 +156,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, for (i=0 ; i < keys ; i++, keyinfo++) { - if (new_frm_ver == 2) + if (new_frm_ver == 3) { keyinfo->flags= (uint) uint2korr(strpos) ^ HA_NOSAME; keyinfo->key_length= (uint) uint2korr(strpos+2); @@ -348,19 +348,25 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, for (i=0 ; i < outparam->fields; i++, strpos+=field_pack_length, field_ptr++) { - uint pack_flag= uint2korr(strpos+6); - uint interval_nr= (uint) strpos[10]; + uint pack_flag, interval_nr, unireg_type, recpos, field_length; enum_field_types field_type; CHARSET_INFO *charset=NULL; LEX_STRING comment; - if (new_frm_ver == 2) + if (new_frm_ver == 3) { /* new frm file in 4.1 */ - uint comment_length=uint2korr(strpos+13); - field_type=(enum_field_types) (uint) strpos[11]; - if (!(charset=get_charset((uint) strpos[12], MYF(0)))) - charset=outparam->table_charset?outparam->table_charset:default_charset_info; + field_length= uint2korr(strpos+3); + recpos= uint3korr(strpos+5); + pack_flag= uint2korr(strpos+8); + unireg_type= (uint) strpos[10]; + interval_nr= (uint) strpos[12]; + + uint comment_length=uint2korr(strpos+15); + field_type=(enum_field_types) (uint) strpos[13]; + if (!(charset=get_charset((uint) strpos[14], MYF(0)))) + charset= (outparam->table_charset ? outparam->table_charset: + default_charset_info); if (!comment_length) { comment.str= (char*) ""; @@ -375,19 +381,26 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, } else { + field_length= (uint) strpos[3]; + recpos= uint2korr(strpos+4), + pack_flag= uint2korr(strpos+6); + unireg_type= (uint) strpos[8]; + interval_nr= (uint) strpos[10]; + /* old frm file */ field_type= (enum_field_types) f_packtype(pack_flag); - charset=outparam->table_charset?outparam->table_charset:default_charset_info; + charset=(outparam->table_charset ? outparam->table_charset : + default_charset_info); bzero((char*) &comment, sizeof(comment)); } *field_ptr=reg_field= - make_field(record+uint2korr(strpos+4), - (uint32) strpos[3], // field_length + make_field(record+recpos, + (uint32) field_length, null_pos,null_bit, pack_flag, field_type, charset, - (Field::utype) MTYP_TYPENR((uint) strpos[8]), + (Field::utype) MTYP_TYPENR(unireg_type), (interval_nr ? outparam->intervals+interval_nr-1 : (TYPELIB*) 0), @@ -1052,7 +1065,7 @@ File create_frm(register my_string name, uint reclength, uchar *fileinfo, if ((file=my_create(name,CREATE_MODE,O_RDWR | O_TRUNC,MYF(MY_WME))) >= 0) { bzero((char*) fileinfo,64); - fileinfo[0]=(uchar) 254; fileinfo[1]= 1; fileinfo[2]= FRM_VER+2; // Header + fileinfo[0]=(uchar) 254; fileinfo[1]= 1; fileinfo[2]= FRM_VER+3; // Header fileinfo[3]= (uchar) ha_checktype(create_info->db_type); fileinfo[4]=1; int2store(fileinfo+6,IO_SIZE); /* Next block starts here */ @@ -1154,7 +1167,7 @@ bool check_db_name(char *name) char *start=name; if (lower_case_table_names) - casedn_str(name); + my_casedn_str(files_charset_info, name); while (*name) { @@ -1250,7 +1263,7 @@ db_type get_table_type(const char *name) error=my_read(file,(byte*) head,4,MYF(MY_NABP)); my_close(file,MYF(0)); if (error || head[0] != (uchar) 254 || head[1] != 1 || - (head[2] < FRM_VER && head[2] > FRM_VER+2)) + (head[2] != FRM_VER && head[2] != FRM_VER+1 && head[2] != FRM_VER+3)) DBUG_RETURN(DB_TYPE_UNKNOWN); DBUG_RETURN(ha_checktype((enum db_type) (uint) *(head+3))); } diff --git a/sql/unireg.cc b/sql/unireg.cc index a171ba42ff3..1cd38d4d161 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -28,7 +28,7 @@ #include "mysql_priv.h" #include <m_ctype.h> -#define FCOMP 15 /* Bytes for a packed field */ +#define FCOMP 17 /* Bytes for a packed field */ static uchar * pack_screens(List<create_field> &create_fields, uint *info_length, uint *screens, bool small_file); @@ -451,15 +451,15 @@ static bool pack_fields(File file,List<create_field> &create_fields) buff[0]= (uchar) field->row; buff[1]= (uchar) field->col; buff[2]= (uchar) field->sc_length; - buff[3]= (uchar) field->length; + int2store(buff+3, field->length); uint recpos=(uint) field->offset+1; - int2store(buff+4,recpos); - int2store(buff+6,field->pack_flag); - int2store(buff+8,field->unireg_check); - buff[10]= (uchar) field->interval_id; - buff[11]= (uchar) field->sql_type; - buff[12]= (uchar) field->charset->number; - int2store(buff+13, field->comment.length); + int3store(buff+5,recpos); + int2store(buff+8,field->pack_flag); + int2store(buff+10,field->unireg_check); + buff[12]= (uchar) field->interval_id; + buff[13]= (uchar) field->sql_type; + buff[14]= (uchar) field->charset->number; + int2store(buff+15, field->comment.length); comment_length+= field->comment.length; set_if_bigger(int_count,field->interval_id); if (my_write(file,(byte*) buff,FCOMP,MYF_RW)) |