Commit 6a93aa52 authored by unknown's avatar unknown

Merge work:/home/bk/mysql into donna.mysql.fi:/home/my/bk/mysql


Docs/manual.texi:
  Auto merged
parents b187dda8 53011a88
This diff is collapsed.
...@@ -198,6 +198,7 @@ struct __fname { ...@@ -198,6 +198,7 @@ struct __fname {
*/ */
typedef enum { typedef enum {
DB_LV_INCOMPLETE, DB_LV_INCOMPLETE,
DB_LV_NONEXISTENT,
DB_LV_NORMAL, DB_LV_NORMAL,
DB_LV_OLD_READABLE, DB_LV_OLD_READABLE,
DB_LV_OLD_UNREADABLE DB_LV_OLD_UNREADABLE
......
...@@ -309,13 +309,13 @@ __log_find(dblp, find_first, valp, statusp) ...@@ -309,13 +309,13 @@ __log_find(dblp, find_first, valp, statusp)
int find_first, *valp; int find_first, *valp;
logfile_validity *statusp; logfile_validity *statusp;
{ {
logfile_validity clv_status, status; logfile_validity logval_status, status;
u_int32_t clv, logval; u_int32_t clv, logval;
int cnt, fcnt, ret; int cnt, fcnt, ret;
const char *dir; const char *dir;
char **names, *p, *q, savech; char **names, *p, *q, savech;
clv_status = status = DB_LV_NORMAL; logval_status = status = DB_LV_NONEXISTENT;
/* Return a value of 0 as the log file number on failure. */ /* Return a value of 0 as the log file number on failure. */
*valp = 0; *valp = 0;
...@@ -385,10 +385,14 @@ __log_find(dblp, find_first, valp, statusp) ...@@ -385,10 +385,14 @@ __log_find(dblp, find_first, valp, statusp)
* as a valid log file. * as a valid log file.
*/ */
break; break;
case DB_LV_NONEXISTENT:
/* Should never happen. */
DB_ASSERT(0);
break;
case DB_LV_NORMAL: case DB_LV_NORMAL:
case DB_LV_OLD_READABLE: case DB_LV_OLD_READABLE:
logval = clv; logval = clv;
clv_status = status; logval_status = status;
break; break;
case DB_LV_OLD_UNREADABLE: case DB_LV_OLD_UNREADABLE:
/* /*
...@@ -410,7 +414,7 @@ __log_find(dblp, find_first, valp, statusp) ...@@ -410,7 +414,7 @@ __log_find(dblp, find_first, valp, statusp)
*/ */
if (!find_first) { if (!find_first) {
logval = clv; logval = clv;
clv_status = status; logval_status = status;
} }
break; break;
} }
...@@ -420,7 +424,7 @@ __log_find(dblp, find_first, valp, statusp) ...@@ -420,7 +424,7 @@ __log_find(dblp, find_first, valp, statusp)
err: __os_dirfree(names, fcnt); err: __os_dirfree(names, fcnt);
__os_freestr(p); __os_freestr(p);
*statusp = clv_status; *statusp = logval_status;
return (ret); return (ret);
} }
......
...@@ -430,7 +430,7 @@ __log_add_logid(dbenv, logp, dbp, ndx) ...@@ -430,7 +430,7 @@ __log_add_logid(dbenv, logp, dbp, ndx)
TAILQ_INIT(&logp->dbentry[i].dblist); TAILQ_INIT(&logp->dbentry[i].dblist);
else else
TAILQ_REINSERT_HEAD( TAILQ_REINSERT_HEAD(
&logp->dbentry[i].dblist, dbp, links); &logp->dbentry[i].dblist, dbtmp, links);
} }
/* Initialize the new entries. */ /* Initialize the new entries. */
......
...@@ -417,7 +417,6 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -417,7 +417,6 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
} }
case ADMIN_DROP: case ADMIN_DROP:
{ {
char buff[FN_REFLEN+20];
if (argc < 2) if (argc < 2)
{ {
my_printf_error(0,"Too few arguments to drop",MYF(ME_BELL)); my_printf_error(0,"Too few arguments to drop",MYF(ME_BELL));
......
...@@ -9,7 +9,7 @@ Created 1/20/1994 Heikki Tuuri ...@@ -9,7 +9,7 @@ Created 1/20/1994 Heikki Tuuri
#ifndef univ_i #ifndef univ_i
#define univ_i #define univ_i
#if (defined(_WIN32) || defined(_WIN64)) #if (defined(_WIN32) || defined(_WIN64)) && !defined(MYSQL_SERVER)
#define __WIN__ #define __WIN__
#include <windows.h> #include <windows.h>
...@@ -28,7 +28,7 @@ be defined: ...@@ -28,7 +28,7 @@ be defined:
/* The Unix version */ /* The Unix version */
/* Most C compilers other than gcc do not know 'extern inline' */ /* Most C compilers other than gcc do not know 'extern inline' */
#ifndef __GNUC__ #if !defined(__GNUC__) && !defined(__WIN__)
#define UNIV_MUST_NOT_INLINE #define UNIV_MUST_NOT_INLINE
#endif #endif
...@@ -38,8 +38,10 @@ subdirectory of 'mysql'. */ ...@@ -38,8 +38,10 @@ subdirectory of 'mysql'. */
#include <global.h> #include <global.h>
#include <my_pthread.h> #include <my_pthread.h>
#ifndef __WIN__
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */ /* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
#include <sys/stat.h> #include <sys/stat.h>
#endif
#undef PACKAGE #undef PACKAGE
#undef VERSION #undef VERSION
......
...@@ -167,7 +167,6 @@ os_file_handle_error( ...@@ -167,7 +167,6 @@ os_file_handle_error(
err = os_file_get_last_error(); err = os_file_get_last_error();
if (err == OS_FILE_DISK_FULL) { if (err == OS_FILE_DISK_FULL) {
ask_again:
fprintf(stderr, "\n"); fprintf(stderr, "\n");
if (name) { if (name) {
fprintf(stderr, fprintf(stderr,
......
...@@ -10,9 +10,10 @@ Created 12/14/1997 Heikki Tuuri ...@@ -10,9 +10,10 @@ Created 12/14/1997 Heikki Tuuri
/* The value of the semantic attribute is a pointer to a query tree node /* The value of the semantic attribute is a pointer to a query tree node
que_node_t */ que_node_t */
#define YYSTYPE que_node_t* #define YYSTYPE que_node_t*
#define alloca mem_alloc
#include "univ.i" #include "univ.i"
#undef alloca
#define alloca mem_alloc
#include <math.h> #include <math.h>
#include "pars0pars.h" #include "pars0pars.h"
#include "mem0mem.h" #include "mem0mem.h"
......
...@@ -466,3 +466,12 @@ id id3 ...@@ -466,3 +466,12 @@ id id3
1 1 1 1
2 2 2 2
100 2 100 2
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(20) default NULL,
KEY `a` (`a`)
) TYPE=InnoDB
a
1
2
3
...@@ -456,3 +456,23 @@ commit; ...@@ -456,3 +456,23 @@ commit;
select id,id3 from t1; select id,id3 from t1;
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t1; DROP TABLE t1;
#
# Test prefix key
#
--error 1089
create table t1 (a char(20), unique (a(5))) type=innodb;
create table t1 (a char(20), index (a(5))) type=innodb;
show create table t1;
drop table t1;
#
# Test using temporary table and auto_increment
#
create temporary table t1 (a int not null auto_increment, primary key(a)) type=innodb;
insert into t1 values (NULL),(NULL),(NULL);
delete from t1 where a=3;
insert into t1 values (NULL);
select * from t1;
drop table t1;
...@@ -449,7 +449,7 @@ innobase_init(void) ...@@ -449,7 +449,7 @@ innobase_init(void)
if (!innobase_data_file_path) if (!innobase_data_file_path)
{ {
fprintf(stderr, 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; innodb_skip=1;
DBUG_RETURN(FALSE); // Continue without innobase DBUG_RETURN(FALSE); // Continue without innobase
} }
......
...@@ -83,14 +83,14 @@ class ha_innobase: public handler ...@@ -83,14 +83,14 @@ class ha_innobase: public handler
HA_NO_WRITE_DELAYED | HA_NO_WRITE_DELAYED |
HA_PRIMARY_KEY_IN_READ_INDEX | HA_PRIMARY_KEY_IN_READ_INDEX |
HA_DROP_BEFORE_CREATE | HA_DROP_BEFORE_CREATE |
HA_NOT_READ_AFTER_KEY), HA_NOT_READ_AFTER_KEY | HA_NO_PREFIX_CHAR_KEYS),
last_dup_key((uint) -1), last_dup_key((uint) -1),
start_of_scan(0) start_of_scan(0)
{ {
} }
~ha_innobase() {} ~ha_innobase() {}
const char* table_type() const { return("Innobase");} const char* table_type() const { return("InnoDB");}
const char** bas_ext() const; const char** bas_ext() const;
ulong option_flag() const { return int_option_flag; } ulong option_flag() const { return int_option_flag; }
uint max_record_length() const { return HA_MAX_REC_LENGTH; } uint max_record_length() const { return HA_MAX_REC_LENGTH; }
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define HA_NOT_READ_AFTER_KEY (HA_DROP_BEFORE_CREATE*2) #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_NOT_DELETE_WITH_CACHE (HA_NOT_READ_AFTER_KEY*2)
#define HA_NO_TEMP_TABLES (HA_NOT_DELETE_WITH_CACHE*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) */ /* Parameters for open() (in register form->filestat) */
/* HA_GET_INFO does a implicit HA_ABORT_IF_LOCKED */ /* HA_GET_INFO does a implicit HA_ABORT_IF_LOCKED */
......
...@@ -393,12 +393,14 @@ void Item_func_reverse::fix_length_and_dec() ...@@ -393,12 +393,14 @@ void Item_func_reverse::fix_length_and_dec()
String *Item_func_replace::val_str(String *str) String *Item_func_replace::val_str(String *str)
{ {
String *res,*res2,*res3; String *res,*res2,*res3;
int offset=0; int offset;
uint from_length,to_length; uint from_length,to_length;
bool alloced=0; bool alloced=0;
#ifdef USE_MB #ifdef USE_MB
const char *ptr,*end,*strend,*search,*search_end; const char *ptr,*end,*strend,*search,*search_end;
register uint32 l; register uint32 l;
bool binary_str = (args[0]->binary || args[1]->binary ||
!use_mb(default_charset_info));
#endif #endif
null_value=0; null_value=0;
...@@ -415,7 +417,8 @@ String *Item_func_replace::val_str(String *str) ...@@ -415,7 +417,8 @@ String *Item_func_replace::val_str(String *str)
if ((offset=res->strstr(*res2)) < 0) if ((offset=res->strstr(*res2)) < 0)
return res; return res;
#else #else
if (!use_mb(default_charset_info) && (offset=res->strstr(*res2)) < 0) offset=0;
if (binary_str && (offset=res->strstr(*res2)) < 0)
return res; return res;
#endif #endif
if (!(res3=args[2]->val_str(&tmp_value2))) if (!(res3=args[2]->val_str(&tmp_value2)))
...@@ -424,7 +427,7 @@ String *Item_func_replace::val_str(String *str) ...@@ -424,7 +427,7 @@ String *Item_func_replace::val_str(String *str)
to_length= res3->length(); to_length= res3->length();
#ifdef USE_MB #ifdef USE_MB
if (use_mb(default_charset_info)) if (!binary_str)
{ {
search=res2->ptr(); search=res2->ptr();
search_end=search+from_length; search_end=search+from_length;
...@@ -449,6 +452,7 @@ String *Item_func_replace::val_str(String *str) ...@@ -449,6 +452,7 @@ String *Item_func_replace::val_str(String *str)
res=copy_if_not_alloced(str,res,res->length()+to_length); res=copy_if_not_alloced(str,res,res->length()+to_length);
} }
res->replace((uint) offset,from_length,*res3); res->replace((uint) offset,from_length,*res3);
offset+=(int) to_length;
goto redo; goto redo;
} }
skipp: skipp:
......
...@@ -346,7 +346,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, ...@@ -346,7 +346,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
*write_lock_used=0; *write_lock_used=0;
for (i=tables=lock_count=0 ; i < count ; i++) 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(); tables+=table_ptr[i]->file->lock_count();
lock_count++; lock_count++;
...@@ -366,7 +366,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, ...@@ -366,7 +366,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
for (i=0 ; i < count ; i++) for (i=0 ; i < count ; i++)
{ {
TABLE *table; TABLE *table;
if ((table=table_ptr[i])->tmp_table) if ((table=table_ptr[i])->tmp_table == TMP_TABLE)
continue; continue;
*to++=table; *to++=table;
enum thr_lock_type lock_type= table->reginfo.lock_type; enum thr_lock_type lock_type= table->reginfo.lock_type;
......
...@@ -1222,7 +1222,8 @@ stack trace and/or the core file to produce a readable backtrace that may\n\ ...@@ -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); help in finding out why mysqld died.\n",sig);
#if defined(HAVE_LINUXTHREADS) #if defined(HAVE_LINUXTHREADS)
#ifdef __i386__ #ifdef __i386__
trace_stack(); if (!(test_flags & TEST_NO_STACKTRACE))
trace_stack();
fflush(stderr); fflush(stderr);
#endif /* __i386__ */ #endif /* __i386__ */
if (test_flags & TEST_CORE_ON_SIGNAL) if (test_flags & TEST_CORE_ON_SIGNAL)
...@@ -1253,7 +1254,7 @@ static void init_signals(void) ...@@ -1253,7 +1254,7 @@ static void init_signals(void)
struct sigaction sa; sa.sa_flags = 0; struct sigaction sa; sa.sa_flags = 0;
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL); 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; sa.sa_handler=handle_segfault;
sigaction(SIGSEGV, &sa, NULL); sigaction(SIGSEGV, &sa, NULL);
...@@ -2495,7 +2496,8 @@ enum options { ...@@ -2495,7 +2496,8 @@ enum options {
OPT_GEMINI_SKIP, OPT_INNODB_SKIP, OPT_GEMINI_SKIP, OPT_INNODB_SKIP,
OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_TEMP_POOL, OPT_TX_ISOLATION,
OPT_GEMINI_FLUSH_LOG, OPT_GEMINI_RECOVER, 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[] = { static struct option long_options[] = {
...@@ -2617,11 +2619,12 @@ static struct option long_options[] = { ...@@ -2617,11 +2619,12 @@ static struct option long_options[] = {
{"skip-locking", no_argument, 0, (int) OPT_SKIP_LOCK}, {"skip-locking", no_argument, 0, (int) OPT_SKIP_LOCK},
{"skip-host-cache", no_argument, 0, (int) OPT_SKIP_HOST_CACHE}, {"skip-host-cache", no_argument, 0, (int) OPT_SKIP_HOST_CACHE},
{"skip-name-resolve", no_argument, 0, (int) OPT_SKIP_RESOLVE}, {"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-new", no_argument, 0, (int) OPT_SKIP_NEW},
{"skip-safemalloc", no_argument, 0, (int) OPT_SKIP_SAFEMALLOC}, {"skip-safemalloc", no_argument, 0, (int) OPT_SKIP_SAFEMALLOC},
{"skip-show-database", no_argument, 0, (int) OPT_SKIP_SHOW_DB}, {"skip-show-database", no_argument, 0, (int) OPT_SKIP_SHOW_DB},
{"skip-slave-start", no_argument, 0, (int) OPT_SKIP_SLAVE_START}, {"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}, {"skip-thread-priority", no_argument, 0, (int) OPT_SKIP_PRIOR},
{"sql-bin-update-same", no_argument, 0, (int) OPT_SQL_BIN_UPDATE_SAME}, {"sql-bin-update-same", no_argument, 0, (int) OPT_SQL_BIN_UPDATE_SAME},
#include "sslopt-longopts.h" #include "sslopt-longopts.h"
...@@ -3047,15 +3050,16 @@ static void usage(void) ...@@ -3047,15 +3050,16 @@ static void usage(void)
Don't use concurrent insert with MyISAM\n\ Don't use concurrent insert with MyISAM\n\
--skip-delay-key-write\n\ --skip-delay-key-write\n\
Ignore the delay_key_write option for all tables\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\ --skip-locking Don't use system locking. To use isamchk one has\n\
to shut down the server.\n\ to shut down the server.\n\
--skip-name-resolve Don't resolve hostnames.\n\ --skip-name-resolve Don't resolve hostnames.\n\
All hostnames are IP's or 'localhost'\n\ All hostnames are IP's or 'localhost'\n\
--skip-networking Don't allow connection with TCP/IP.\n\ --skip-networking Don't allow connection with TCP/IP.\n\
--skip-new Don't use new, possible wrong routines.\n\ --skip-new Don't use new, possible wrong routines.\n");
--skip-host-cache Don't cache host names\n");
/* We have to break the string here because of VC++ limits */ /* We have to break the string here because of VC++ limits */
puts("\ puts("\
--skip-stack-trace Don't print a stack trace on failure\n\
--skip-show-database Don't allow 'SHOW DATABASE' commands\n\ --skip-show-database Don't allow 'SHOW DATABASE' commands\n\
--skip-thread-priority\n\ --skip-thread-priority\n\
Don't give threads different priorities.\n\ Don't give threads different priorities.\n\
...@@ -3501,6 +3505,9 @@ static void get_options(int argc,char **argv) ...@@ -3501,6 +3505,9 @@ static void get_options(int argc,char **argv)
case (int) OPT_WANT_CORE: case (int) OPT_WANT_CORE:
test_flags |= TEST_CORE_ON_SIGNAL; test_flags |= TEST_CORE_ON_SIGNAL;
break; break;
case (int) OPT_SKIP_STACK_TRACE:
test_flags|=TEST_NO_STACKTRACE;
break;
case (int) OPT_BIND_ADDRESS: case (int) OPT_BIND_ADDRESS:
if (optarg && isdigit(optarg[0])) if (optarg && isdigit(optarg[0]))
{ {
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
"File '%-.80s' already exists", "File '%-.80s' already exists",
"Records: %ld Deleted: %ld Skipped: %ld Warnings: %ld", "Records: %ld Deleted: %ld Skipped: %ld Warnings: %ld",
"Records: %ld Duplicates: %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", "You can't delete all columns with ALTER TABLE. Use DROP TABLE instead",
"Can't DROP '%-.64s'. Check that column/key exists", "Can't DROP '%-.64s'. Check that column/key exists",
"Records: %ld Duplicates: %ld Warnings: %ld", "Records: %ld Duplicates: %ld Warnings: %ld",
......
...@@ -1495,8 +1495,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, ...@@ -1495,8 +1495,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
DBUG_RETURN(0); /* purecov: inspected */ DBUG_RETURN(0); /* purecov: inspected */
if (openfrm(path, table_name, if (openfrm(path, table_name,
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX | (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX),
HA_TRY_READ_ONLY),
READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD, READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
ha_open_options, ha_open_options,
tmp_table)) tmp_table))
...@@ -1505,8 +1504,9 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, ...@@ -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->file->extra(HA_EXTRA_NO_READCHECK); // Not needed in SQL
tmp_table->reginfo.lock_type=TL_WRITE; // Simulate locked tmp_table->reginfo.lock_type=TL_WRITE; // Simulate locked
tmp_table->tmp_table = 1; 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->table_cache_key=(char*) (tmp_table+1);
tmp_table->key_length= (uint) (strmov((tmp_table->real_name= tmp_table->key_length= (uint) (strmov((tmp_table->real_name=
strmov(tmp_table->table_cache_key,db) strmov(tmp_table->table_cache_key,db)
......
...@@ -3358,7 +3358,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, ...@@ -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->db_stat=HA_OPEN_KEYFILE+HA_OPEN_RNDFILE;
table->blob_ptr_size=mi_portable_sizeof_char_ptr; table->blob_ptr_size=mi_portable_sizeof_char_ptr;
table->map=1; table->map=1;
table->tmp_table=1; table->tmp_table= TMP_TABLE;
table->db_low_byte_first=1; // True for HEAP and MyISAM table->db_low_byte_first=1; // True for HEAP and MyISAM
table->temp_pool_slot = temp_pool_slot; table->temp_pool_slot = temp_pool_slot;
......
...@@ -479,12 +479,16 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, ...@@ -479,12 +479,16 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
} }
} }
else if (column->length > length || 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)); my_error(ER_WRONG_SUB_KEY,MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
length=column->length; if (!(file->option_flag() & HA_NO_PREFIX_CHAR_KEYS))
length=column->length;
} }
else if (length == 0) else if (length == 0)
{ {
...@@ -1426,21 +1430,20 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1426,21 +1430,20 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
create_info, create_info,
create_list,key_list,1,1))) // no logging create_list,key_list,1,1))) // no logging
DBUG_RETURN(error); DBUG_RETURN(error);
if (table->tmp_table)
new_table=open_table(thd,new_db,tmp_name,tmp_name,0);
else
{ {
if (table->tmp_table) char path[FN_REFLEN];
new_table=open_table(thd,new_db,tmp_name,tmp_name,0); (void) sprintf(path,"%s/%s/%s",mysql_data_home,new_db,tmp_name);
else fn_format(path,path,"","",4);
{ new_table=open_temporary_table(thd, path, new_db, tmp_name,0);
char path[FN_REFLEN]; }
(void) sprintf(path,"%s/%s/%s",mysql_data_home,new_db,tmp_name); if (!new_table)
fn_format(path,path,"","",4); {
new_table=open_temporary_table(thd, path, new_db, tmp_name,0); VOID(quick_rm_table(new_db_type,new_db,tmp_name));
} goto err;
if (!new_table)
{
VOID(quick_rm_table(new_db_type,new_db,tmp_name));
goto err;
}
} }
save_time_stamp=new_table->time_stamp; save_time_stamp=new_table->time_stamp;
......
...@@ -41,6 +41,8 @@ typedef struct st_grant_info ...@@ -41,6 +41,8 @@ typedef struct st_grant_info
uint want_privilege; uint want_privilege;
} GRANT_INFO; } GRANT_INFO;
enum tmp_table_type {NO_TMP_TABLE=0, TMP_TABLE=1, TRANSACTIONAL_TMP_TABLE=2};
/* Table cache entry struct */ /* Table cache entry struct */
class Field_timestamp; class Field_timestamp;
...@@ -83,10 +85,11 @@ struct st_table { ...@@ -83,10 +85,11 @@ struct st_table {
uint blob_ptr_size; /* 4 or 8 */ uint blob_ptr_size; /* 4 or 8 */
uint next_number_key_offset; uint next_number_key_offset;
int current_lock; /* Type of lock on table */ int current_lock; /* Type of lock on table */
enum tmp_table_type tmp_table;
my_bool copy_blobs; /* copy_blobs when storing */ my_bool copy_blobs; /* copy_blobs when storing */
my_bool null_row; /* All columns are null */ my_bool null_row; /* All columns are null */
my_bool maybe_null,outer_join; /* Used with OUTER JOIN */ 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 key_read;
my_bool crypted; my_bool crypted;
my_bool db_low_byte_first; /* Portable row format */ my_bool db_low_byte_first; /* Portable row format */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment