diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_innobase.cc | 2 | ||||
-rw-r--r-- | sql/ha_innobase.h | 4 | ||||
-rw-r--r-- | sql/handler.h | 1 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 10 | ||||
-rw-r--r-- | sql/lock.cc | 4 | ||||
-rw-r--r-- | sql/mysqld.cc | 19 | ||||
-rw-r--r-- | sql/share/english/errmsg.txt | 2 | ||||
-rw-r--r-- | sql/sql_base.cc | 8 | ||||
-rw-r--r-- | sql/sql_select.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 35 | ||||
-rw-r--r-- | sql/table.h | 5 |
11 files changed, 55 insertions, 37 deletions
diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 72857fc953f..8af9de0eaba 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -449,7 +449,7 @@ innobase_init(void) if (!innobase_data_file_path) { fprintf(stderr, - "Can't initialize InnoDB as 'innobase_data_file_path' is not set\n"); + "Can't initialize InnoDB as 'innodb_data_file_path' is not set\n"); innodb_skip=1; DBUG_RETURN(FALSE); // Continue without innobase } diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h index e85d73bdae5..429e47523dd 100644 --- a/sql/ha_innobase.h +++ b/sql/ha_innobase.h @@ -83,14 +83,14 @@ class ha_innobase: public handler HA_NO_WRITE_DELAYED | HA_PRIMARY_KEY_IN_READ_INDEX | HA_DROP_BEFORE_CREATE | - HA_NOT_READ_AFTER_KEY), + HA_NOT_READ_AFTER_KEY | HA_NO_PREFIX_CHAR_KEYS), last_dup_key((uint) -1), start_of_scan(0) { } ~ha_innobase() {} - const char* table_type() const { return("Innobase");} + const char* table_type() const { return("InnoDB");} const char** bas_ext() const; ulong option_flag() const { return int_option_flag; } uint max_record_length() const { return HA_MAX_REC_LENGTH; } diff --git a/sql/handler.h b/sql/handler.h index c7df6e2a915..076bf783f80 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -73,6 +73,7 @@ #define HA_NOT_READ_AFTER_KEY (HA_DROP_BEFORE_CREATE*2) #define HA_NOT_DELETE_WITH_CACHE (HA_NOT_READ_AFTER_KEY*2) #define HA_NO_TEMP_TABLES (HA_NOT_DELETE_WITH_CACHE*2) +#define HA_NO_PREFIX_CHAR_KEYS (HA_NO_TEMP_TABLES*2) /* Parameters for open() (in register form->filestat) */ /* HA_GET_INFO does a implicit HA_ABORT_IF_LOCKED */ diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 82dcb0268b4..80f72c30e57 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -393,12 +393,14 @@ void Item_func_reverse::fix_length_and_dec() String *Item_func_replace::val_str(String *str) { String *res,*res2,*res3; - int offset=0; + int offset; uint from_length,to_length; bool alloced=0; #ifdef USE_MB const char *ptr,*end,*strend,*search,*search_end; register uint32 l; + bool binary_str = (args[0]->binary || args[1]->binary || + !use_mb(default_charset_info)); #endif null_value=0; @@ -415,7 +417,8 @@ String *Item_func_replace::val_str(String *str) if ((offset=res->strstr(*res2)) < 0) return res; #else - if (!use_mb(default_charset_info) && (offset=res->strstr(*res2)) < 0) + offset=0; + if (binary_str && (offset=res->strstr(*res2)) < 0) return res; #endif if (!(res3=args[2]->val_str(&tmp_value2))) @@ -424,7 +427,7 @@ String *Item_func_replace::val_str(String *str) to_length= res3->length(); #ifdef USE_MB - if (use_mb(default_charset_info)) + if (!binary_str) { search=res2->ptr(); search_end=search+from_length; @@ -449,6 +452,7 @@ redo: res=copy_if_not_alloced(str,res,res->length()+to_length); } res->replace((uint) offset,from_length,*res3); + offset+=(int) to_length; goto redo; } skipp: diff --git a/sql/lock.cc b/sql/lock.cc index 915f1831245..23f81c9c164 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -346,7 +346,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, *write_lock_used=0; for (i=tables=lock_count=0 ; i < count ; i++) { - if (!table_ptr[i]->tmp_table) + if (table_ptr[i]->tmp_table != TMP_TABLE) { tables+=table_ptr[i]->file->lock_count(); lock_count++; @@ -366,7 +366,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, for (i=0 ; i < count ; i++) { TABLE *table; - if ((table=table_ptr[i])->tmp_table) + if ((table=table_ptr[i])->tmp_table == TMP_TABLE) continue; *to++=table; enum thr_lock_type lock_type= table->reginfo.lock_type; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3d42f59ff93..7c4b88d0170 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1222,7 +1222,8 @@ stack trace and/or the core file to produce a readable backtrace that may\n\ help in finding out why mysqld died.\n",sig); #if defined(HAVE_LINUXTHREADS) #ifdef __i386__ - trace_stack(); + if (!(test_flags & TEST_NO_STACKTRACE)) + trace_stack(); fflush(stderr); #endif /* __i386__ */ if (test_flags & TEST_CORE_ON_SIGNAL) @@ -1253,7 +1254,7 @@ static void init_signals(void) struct sigaction sa; sa.sa_flags = 0; sigemptyset(&sa.sa_mask); sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL); - if (!(test_flags & TEST_NO_STACKTRACE)) + if (!(test_flags & TEST_NO_STACKTRACE) || (test_flags & TEST_CORE_ON_SIGNAL)) { sa.sa_handler=handle_segfault; sigaction(SIGSEGV, &sa, NULL); @@ -2495,7 +2496,8 @@ enum options { OPT_GEMINI_SKIP, OPT_INNODB_SKIP, OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_GEMINI_FLUSH_LOG, OPT_GEMINI_RECOVER, - OPT_GEMINI_UNBUFFERED_IO, OPT_SKIP_SAFEMALLOC + OPT_GEMINI_UNBUFFERED_IO, OPT_SKIP_SAFEMALLOC, + OPT_SKIP_STACK_TRACE }; static struct option long_options[] = { @@ -2617,11 +2619,12 @@ static struct option long_options[] = { {"skip-locking", no_argument, 0, (int) OPT_SKIP_LOCK}, {"skip-host-cache", no_argument, 0, (int) OPT_SKIP_HOST_CACHE}, {"skip-name-resolve", no_argument, 0, (int) OPT_SKIP_RESOLVE}, + {"skip-networking", no_argument, 0, (int) OPT_SKIP_NETWORKING}, {"skip-new", no_argument, 0, (int) OPT_SKIP_NEW}, {"skip-safemalloc", no_argument, 0, (int) OPT_SKIP_SAFEMALLOC}, {"skip-show-database", no_argument, 0, (int) OPT_SKIP_SHOW_DB}, {"skip-slave-start", no_argument, 0, (int) OPT_SKIP_SLAVE_START}, - {"skip-networking", no_argument, 0, (int) OPT_SKIP_NETWORKING}, + {"skip-stack-trace", no_argument, 0, (int) OPT_SKIP_STACK_TRACE}, {"skip-thread-priority", no_argument, 0, (int) OPT_SKIP_PRIOR}, {"sql-bin-update-same", no_argument, 0, (int) OPT_SQL_BIN_UPDATE_SAME}, #include "sslopt-longopts.h" @@ -3047,15 +3050,16 @@ static void usage(void) Don't use concurrent insert with MyISAM\n\ --skip-delay-key-write\n\ Ignore the delay_key_write option for all tables\n\ + --skip-host-cache Don't cache host names\n\ --skip-locking Don't use system locking. To use isamchk one has\n\ to shut down the server.\n\ --skip-name-resolve Don't resolve hostnames.\n\ All hostnames are IP's or 'localhost'\n\ --skip-networking Don't allow connection with TCP/IP.\n\ - --skip-new Don't use new, possible wrong routines.\n\ - --skip-host-cache Don't cache host names\n"); + --skip-new Don't use new, possible wrong routines.\n"); /* We have to break the string here because of VC++ limits */ puts("\ + --skip-stack-trace Don't print a stack trace on failure\n\ --skip-show-database Don't allow 'SHOW DATABASE' commands\n\ --skip-thread-priority\n\ Don't give threads different priorities.\n\ @@ -3501,6 +3505,9 @@ static void get_options(int argc,char **argv) case (int) OPT_WANT_CORE: test_flags |= TEST_CORE_ON_SIGNAL; break; + case (int) OPT_SKIP_STACK_TRACE: + test_flags|=TEST_NO_STACKTRACE; + break; case (int) OPT_BIND_ADDRESS: if (optarg && isdigit(optarg[0])) { diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 74139b30a85..ff29fffe958 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -90,7 +90,7 @@ "File '%-.80s' already exists", "Records: %ld Deleted: %ld Skipped: %ld Warnings: %ld", "Records: %ld Duplicates: %ld", -"Incorrect sub part key. The used key part isn't a string or the used length is longer than the key part", +"Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the table handler doesn't support unique sub keys", "You can't delete all columns with ALTER TABLE. Use DROP TABLE instead", "Can't DROP '%-.64s'. Check that column/key exists", "Records: %ld Duplicates: %ld Warnings: %ld", diff --git a/sql/sql_base.cc b/sql/sql_base.cc index afff01e9a16..3c81723b61f 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1495,8 +1495,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, DBUG_RETURN(0); /* purecov: inspected */ if (openfrm(path, table_name, - (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX | - HA_TRY_READ_ONLY), + (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX), READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD, ha_open_options, tmp_table)) @@ -1505,8 +1504,9 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, } tmp_table->file->extra(HA_EXTRA_NO_READCHECK); // Not needed in SQL - tmp_table->reginfo.lock_type=TL_WRITE; // Simulate locked - tmp_table->tmp_table = 1; + tmp_table->reginfo.lock_type=TL_WRITE; // Simulate locked + tmp_table->tmp_table = (tmp_table->file->has_transactions() ? + TRANSACTIONAL_TMP_TABLE : TMP_TABLE); tmp_table->table_cache_key=(char*) (tmp_table+1); tmp_table->key_length= (uint) (strmov((tmp_table->real_name= strmov(tmp_table->table_cache_key,db) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 398a2ddeec9..95a87e06f2b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3358,7 +3358,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, table->db_stat=HA_OPEN_KEYFILE+HA_OPEN_RNDFILE; table->blob_ptr_size=mi_portable_sizeof_char_ptr; table->map=1; - table->tmp_table=1; + table->tmp_table= TMP_TABLE; table->db_low_byte_first=1; // True for HEAP and MyISAM table->temp_pool_slot = temp_pool_slot; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 78721c3e8f9..ad39b91a5ca 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -479,12 +479,16 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, } } else if (column->length > length || - (f_is_packed(sql_field->pack_flag) && column->length != length)) + ((f_is_packed(sql_field->pack_flag) || + ((file->option_flag() & HA_NO_PREFIX_CHAR_KEYS) && + (key_info->flags & HA_NOSAME))) && + column->length != length)) { my_error(ER_WRONG_SUB_KEY,MYF(0)); DBUG_RETURN(-1); } - length=column->length; + if (!(file->option_flag() & HA_NO_PREFIX_CHAR_KEYS)) + length=column->length; } else if (length == 0) { @@ -1426,21 +1430,20 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, create_info, create_list,key_list,1,1))) // no logging DBUG_RETURN(error); + + if (table->tmp_table) + new_table=open_table(thd,new_db,tmp_name,tmp_name,0); + else { - if (table->tmp_table) - new_table=open_table(thd,new_db,tmp_name,tmp_name,0); - else - { - char path[FN_REFLEN]; - (void) sprintf(path,"%s/%s/%s",mysql_data_home,new_db,tmp_name); - fn_format(path,path,"","",4); - new_table=open_temporary_table(thd, path, new_db, tmp_name,0); - } - if (!new_table) - { - VOID(quick_rm_table(new_db_type,new_db,tmp_name)); - goto err; - } + char path[FN_REFLEN]; + (void) sprintf(path,"%s/%s/%s",mysql_data_home,new_db,tmp_name); + fn_format(path,path,"","",4); + new_table=open_temporary_table(thd, path, new_db, tmp_name,0); + } + if (!new_table) + { + VOID(quick_rm_table(new_db_type,new_db,tmp_name)); + goto err; } save_time_stamp=new_table->time_stamp; diff --git a/sql/table.h b/sql/table.h index a3b361742c5..b627a158556 100644 --- a/sql/table.h +++ b/sql/table.h @@ -41,6 +41,8 @@ typedef struct st_grant_info uint want_privilege; } GRANT_INFO; +enum tmp_table_type {NO_TMP_TABLE=0, TMP_TABLE=1, TRANSACTIONAL_TMP_TABLE=2}; + /* Table cache entry struct */ class Field_timestamp; @@ -83,10 +85,11 @@ struct st_table { uint blob_ptr_size; /* 4 or 8 */ uint next_number_key_offset; int current_lock; /* Type of lock on table */ + enum tmp_table_type tmp_table; my_bool copy_blobs; /* copy_blobs when storing */ my_bool null_row; /* All columns are null */ my_bool maybe_null,outer_join; /* Used with OUTER JOIN */ - my_bool distinct,tmp_table,const_table; + my_bool distinct,const_table; my_bool key_read; my_bool crypted; my_bool db_low_byte_first; /* Portable row format */ |