Commit beb5867d authored by monty@mysql.com's avatar monty@mysql.com

After merge fixes

parent b4e92e63
...@@ -1509,37 +1509,40 @@ const char * STDCALL mysql_character_set_name(MYSQL *mysql) ...@@ -1509,37 +1509,40 @@ const char * STDCALL mysql_character_set_name(MYSQL *mysql)
return mysql->charset->csname; return mysql->charset->csname;
} }
int STDCALL mysql_set_character_set(MYSQL *mysql, char *cs_name) int STDCALL mysql_set_character_set(MYSQL *mysql, char *cs_name)
{ {
struct charset_info_st *cs; struct charset_info_st *cs;
const char *save_csdir = charsets_dir; const char *save_csdir= charsets_dir;
if (mysql->options.charset_dir) if (mysql->options.charset_dir)
charsets_dir = mysql->options.charset_dir; charsets_dir= mysql->options.charset_dir;
if ( (cs = get_charset_by_csname(cs_name, MY_CS_PRIMARY, MYF(0))) ) if ((cs= get_charset_by_csname(cs_name, MY_CS_PRIMARY, MYF(0))))
{ {
char buff[MY_CS_NAME_SIZE + 10]; char buff[MY_CS_NAME_SIZE + 10];
charsets_dir = save_csdir; charsets_dir= save_csdir;
sprintf(buff, "SET NAMES %s", cs_name); sprintf(buff, "SET NAMES %s", cs_name);
if (!mysql_query(mysql, buff)) { if (!mysql_query(mysql, buff))
mysql->charset = cs; {
mysql->charset= cs;
}
} }
} else { else
{
char cs_dir_name[FN_REFLEN]; char cs_dir_name[FN_REFLEN];
get_charsets_dir(cs_dir_name); get_charsets_dir(cs_dir_name);
mysql->net.last_errno=CR_CANT_READ_CHARSET; mysql->net.last_errno= CR_CANT_READ_CHARSET;
strmov(mysql->net.sqlstate, unknown_sqlstate); strmov(mysql->net.sqlstate, unknown_sqlstate);
my_snprintf(mysql->net.last_error, sizeof(mysql->net.last_error)-1, my_snprintf(mysql->net.last_error, sizeof(mysql->net.last_error) - 1,
ER(mysql->net.last_errno), ER(mysql->net.last_errno), cs_name, cs_dir_name);
cs_name,
cs_dir_name);
} }
charsets_dir = save_csdir; charsets_dir= save_csdir;
return mysql->net.last_errno; return mysql->net.last_errno;
} }
uint STDCALL mysql_thread_safe(void) uint STDCALL mysql_thread_safe(void)
{ {
#ifdef THREAD #ifdef THREAD
......
This diff is collapsed.
...@@ -1645,5 +1645,5 @@ concat(a, b) ...@@ -1645,5 +1645,5 @@ concat(a, b)
drop table t1; drop table t1;
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
The used table type doesn't support FULLTEXT indexes ERROR HY000: The used table type doesn't support FULLTEXT indexes
DROP TABLE t1; DROP TABLE t1;
...@@ -167,7 +167,7 @@ a b c VALUES(a) ...@@ -167,7 +167,7 @@ a b c VALUES(a)
2 1 11 NULL 2 1 11 NULL
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
create table t1 (a int not null unique); create table t1 (a int not null unique) engine=myisam;
insert into t1 values (1),(2); insert into t1 values (1),(2);
insert ignore into t1 select 1 on duplicate key update a=2; insert ignore into t1 select 1 on duplicate key update a=2;
select * from t1; select * from t1;
...@@ -179,4 +179,11 @@ select * from t1; ...@@ -179,4 +179,11 @@ select * from t1;
a a
1 1
3 3
insert into t1 select 1 on duplicate key update a=2;
select * from t1;
a
2
3
insert into t1 select a from t1 on duplicate key update a=a+1 ;
ERROR 23000: Duplicate entry '3' for key 1
drop table t1; drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT);
EXPLAIN
SELECT *
INTO OUTFILE '/tmp/t1.txt'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
DROP TABLE t1;
...@@ -165,56 +165,6 @@ INSERT DELAYED INTO t1 VALUES(1),(2),(3); ...@@ -165,56 +165,6 @@ INSERT DELAYED INTO t1 VALUES(1),(2),(3);
ALTER TABLE t1 ENABLE KEYS; ALTER TABLE t1 ENABLE KEYS;
drop table t1; drop table t1;
#
# Test that data get converted when character set is changed
# Test that data doesn't get converted when src or dst is BINARY/BLOB
#
set names koi8r;
create table t1 (a char(10) character set koi8r);
insert into t1 values ('');
select a,hex(a) from t1;
alter table t1 change a a char(10) character set cp1251;
select a,hex(a) from t1;
alter table t1 change a a binary(10);
select a,hex(a) from t1;
alter table t1 change a a char(10) character set cp1251;
select a,hex(a) from t1;
alter table t1 change a a char(10) character set koi8r;
select a,hex(a) from t1;
alter table t1 change a a varchar(10) character set cp1251;
select a,hex(a) from t1;
alter table t1 change a a char(10) character set koi8r;
select a,hex(a) from t1;
alter table t1 change a a text character set cp1251;
select a,hex(a) from t1;
alter table t1 change a a char(10) character set koi8r;
select a,hex(a) from t1;
delete from t1;
#
# Test ALTER TABLE .. CHARACTER SET ..
#
show create table t1;
alter table t1 DEFAULT CHARACTER SET latin1;
show create table t1;
alter table t1 CONVERT TO CHARACTER SET latin1;
show create table t1;
alter table t1 DEFAULT CHARACTER SET cp1251;
show create table t1;
drop table t1;
#
# Bug#2821
# Test that table CHARACTER SET does not affect blobs
#
create table t1 (myblob longblob,mytext longtext)
default charset latin1 collate latin1_general_cs;
show create table t1;
alter table t1 character set latin2;
show create table t1;
drop table t1;
# #
# Test ALTER TABLE ENABLE/DISABLE keys when things are locked # Test ALTER TABLE ENABLE/DISABLE keys when things are locked
# #
...@@ -317,6 +267,58 @@ insert into t1 (a) values(1); ...@@ -317,6 +267,58 @@ insert into t1 (a) values(1);
--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X --replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
show table status like 't1'; show table status like 't1';
drop table t1; drop table t1;
#
# Test that data get converted when character set is changed
# Test that data doesn't get converted when src or dst is BINARY/BLOB
#
set names koi8r;
create table t1 (a char(10) character set koi8r);
insert into t1 values ('');
select a,hex(a) from t1;
alter table t1 change a a char(10) character set cp1251;
select a,hex(a) from t1;
alter table t1 change a a binary(10);
select a,hex(a) from t1;
alter table t1 change a a char(10) character set cp1251;
select a,hex(a) from t1;
alter table t1 change a a char(10) character set koi8r;
select a,hex(a) from t1;
alter table t1 change a a varchar(10) character set cp1251;
select a,hex(a) from t1;
alter table t1 change a a char(10) character set koi8r;
select a,hex(a) from t1;
alter table t1 change a a text character set cp1251;
select a,hex(a) from t1;
alter table t1 change a a char(10) character set koi8r;
select a,hex(a) from t1;
delete from t1;
#
# Test ALTER TABLE .. CHARACTER SET ..
#
show create table t1;
alter table t1 DEFAULT CHARACTER SET latin1;
show create table t1;
alter table t1 CONVERT TO CHARACTER SET latin1;
show create table t1;
alter table t1 DEFAULT CHARACTER SET cp1251;
show create table t1;
drop table t1;
#
# Bug#2821
# Test that table CHARACTER SET does not affect blobs
#
create table t1 (myblob longblob,mytext longtext)
default charset latin1 collate latin1_general_cs;
show create table t1;
alter table t1 character set latin2;
show create table t1;
drop table t1;
#
# Bug 2361 (Don't drop UNIQUE with DROP PRIMARY KEY) # Bug 2361 (Don't drop UNIQUE with DROP PRIMARY KEY)
# #
......
...@@ -85,10 +85,14 @@ DROP TABLE t2; ...@@ -85,10 +85,14 @@ DROP TABLE t2;
# Bug#9725 - "disapearing query/hang" and "unknown error" with "on duplicate key update" # Bug#9725 - "disapearing query/hang" and "unknown error" with "on duplicate key update"
# INSERT INGORE...UPDATE gives bad error or breaks protocol. # INSERT INGORE...UPDATE gives bad error or breaks protocol.
# #
create table t1 (a int not null unique); create table t1 (a int not null unique) engine=myisam;
insert into t1 values (1),(2); insert into t1 values (1),(2);
insert ignore into t1 select 1 on duplicate key update a=2; insert ignore into t1 select 1 on duplicate key update a=2;
select * from t1; select * from t1;
insert ignore into t1 select a from t1 on duplicate key update a=a+1 ; insert ignore into t1 select a from t1 on duplicate key update a=a+1 ;
select * from t1; select * from t1;
insert into t1 select 1 on duplicate key update a=2;
select * from t1;
--error 1062
insert into t1 select a from t1 on duplicate key update a=a+1 ;
drop table t1; drop table t1;
...@@ -38,6 +38,7 @@ select load_file(concat(@tmpdir,"/outfile-test.3")); ...@@ -38,6 +38,7 @@ select load_file(concat(@tmpdir,"/outfile-test.3"));
#--error 1086 #--error 1086
#eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1; #eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1;
#enable_query_log; #enable_query_log;
--error 13,2
select load_file(concat(@tmpdir,"/outfile-test.not-exist")); select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.1 --exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.1
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.2 --exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.2
......
...@@ -3176,7 +3176,7 @@ bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref) ...@@ -3176,7 +3176,7 @@ bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
table=((Item_field *)item)->field->table; table=((Item_field *)item)->field->table;
if (!(table->file->table_flags() & HA_CAN_FULLTEXT)) if (!(table->file->table_flags() & HA_CAN_FULLTEXT))
{ {
my_error(ER_TABLE_CANT_HANDLE_FULLTEXT, MYF(0)); my_error(ER_TABLE_CANT_HANDLE_FT, MYF(0));
return 1; return 1;
} }
table->fulltext_searched=1; table->fulltext_searched=1;
......
...@@ -1205,6 +1205,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -1205,6 +1205,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
/* Sort keys in optimized order */ /* Sort keys in optimized order */
qsort((gptr) key_info_buffer, *key_count, sizeof(KEY), qsort((gptr) key_info_buffer, *key_count, sizeof(KEY),
(qsort_cmp) sort_keys); (qsort_cmp) sort_keys);
create_info->null_bits= null_fields;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -1392,7 +1393,6 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, ...@@ -1392,7 +1393,6 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)
create_info->data_file_name= create_info->index_file_name= 0; create_info->data_file_name= create_info->index_file_name= 0;
create_info->table_options=db_options; create_info->table_options=db_options;
create_info->null_bits= null_fields;
if (rea_create_table(thd, path, create_info, fields, key_count, if (rea_create_table(thd, path, create_info, fields, key_count,
key_info_buffer)) key_info_buffer))
......
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