mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
Merge bk-internal:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0 BitKeeper/etc/logging_ok: auto-union
This commit is contained in:
commit
50ff727405
26 changed files with 459 additions and 262 deletions
|
@ -1495,37 +1495,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
|
||||||
|
|
|
@ -218,7 +218,8 @@ or
|
||||||
), mysqldump will create rows up to net_buffer_length length. If you increase this variable, you should also ensure that the max_allowed_packet variable in the MySQL server is bigger than the net_buffer_length.
|
), mysqldump will create rows up to net_buffer_length length. If you increase this variable, you should also ensure that the max_allowed_packet variable in the MySQL server is bigger than the net_buffer_length.
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
.TP
|
.TP
|
||||||
The most normal use of mysqldump is probably for making a backup of whole databases. See Mysql Manual section 21.2 Database Backups.
|
The most normal use of mysqldump is probably for making a backup of whole
|
||||||
|
databases. See the section on Database Backups in the MySQL Reference Manual.
|
||||||
.TP
|
.TP
|
||||||
mysqldump \-\-opt \fP\fIdatabase\fP > backup-file.sql
|
mysqldump \-\-opt \fP\fIdatabase\fP > backup-file.sql
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -329,8 +329,25 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
|
||||||
} /* _mi_pack_key */
|
} /* _mi_pack_key */
|
||||||
|
|
||||||
|
|
||||||
/* Put a key in record */
|
|
||||||
/* Used when only-keyread is wanted */
|
/*
|
||||||
|
Store found key in record
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
_mi_put_key_in_record()
|
||||||
|
info MyISAM handler
|
||||||
|
keynr Key number that was used
|
||||||
|
record Store key here
|
||||||
|
|
||||||
|
Last read key is in info->lastkey
|
||||||
|
|
||||||
|
NOTES
|
||||||
|
Used when only-keyread is wanted
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
0 ok
|
||||||
|
1 error
|
||||||
|
*/
|
||||||
|
|
||||||
static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
|
static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
|
||||||
byte *record)
|
byte *record)
|
||||||
|
@ -341,14 +358,8 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
|
||||||
byte *blob_ptr;
|
byte *blob_ptr;
|
||||||
DBUG_ENTER("_mi_put_key_in_record");
|
DBUG_ENTER("_mi_put_key_in_record");
|
||||||
|
|
||||||
if (info->s->base.blobs && info->s->keyinfo[keynr].flag & HA_VAR_LENGTH_KEY)
|
blob_ptr= info->lastkey2; /* Place to put blob parts */
|
||||||
{
|
key=(byte*) info->lastkey; /* KEy that was read */
|
||||||
if (!(blob_ptr=
|
|
||||||
mi_alloc_rec_buff(info, info->s->keyinfo[keynr].keylength,
|
|
||||||
&info->rec_buff)))
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
key=(byte*) info->lastkey;
|
|
||||||
key_end=key+info->lastkey_length;
|
key_end=key+info->lastkey_length;
|
||||||
for (keyseg=info->s->keyinfo[keynr].seg ; keyseg->type ;keyseg++)
|
for (keyseg=info->s->keyinfo[keynr].seg ; keyseg->type ;keyseg++)
|
||||||
{
|
{
|
||||||
|
|
5
mysql-test/include/have_outfile.inc
Normal file
5
mysql-test/include/have_outfile.inc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
-- require r/have_outfile.require
|
||||||
|
disable_query_log;
|
||||||
|
select load_file(concat(@tmpdir,"/outfile.test"));
|
||||||
|
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile.test
|
||||||
|
enable_query_log;
|
1
mysql-test/include/test_outfile.inc
Normal file
1
mysql-test/include/test_outfile.inc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
eval select "Outfile OK" into outfile "$MYSQL_TEST_DIR/var/tmp/outfile.test";
|
|
@ -303,6 +303,129 @@ ALTER TABLE t1 DISABLE KEYS;
|
||||||
INSERT DELAYED INTO t1 VALUES(1),(2),(3);
|
INSERT DELAYED INTO t1 VALUES(1),(2),(3);
|
||||||
ALTER TABLE t1 ENABLE KEYS;
|
ALTER TABLE t1 ENABLE KEYS;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
Host varchar(16) binary NOT NULL default '',
|
||||||
|
User varchar(16) binary NOT NULL default '',
|
||||||
|
PRIMARY KEY (Host,User)
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
ALTER TABLE t1 DISABLE KEYS;
|
||||||
|
LOCK TABLES t1 WRITE;
|
||||||
|
INSERT INTO t1 VALUES ('localhost','root'),('localhost',''),('games','monty');
|
||||||
|
SHOW INDEX FROM t1;
|
||||||
|
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||||
|
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
|
||||||
|
t1 0 PRIMARY 2 User A 3 NULL NULL BTREE
|
||||||
|
ALTER TABLE t1 ENABLE KEYS;
|
||||||
|
UNLOCK TABLES;
|
||||||
|
CHECK TABLES t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
Host varchar(16) binary NOT NULL default '',
|
||||||
|
User varchar(16) binary NOT NULL default '',
|
||||||
|
PRIMARY KEY (Host,User),
|
||||||
|
KEY (Host)
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
ALTER TABLE t1 DISABLE KEYS;
|
||||||
|
SHOW INDEX FROM t1;
|
||||||
|
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||||
|
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
|
||||||
|
t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
|
||||||
|
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
|
||||||
|
LOCK TABLES t1 WRITE;
|
||||||
|
INSERT INTO t1 VALUES ('localhost','root'),('localhost','');
|
||||||
|
SHOW INDEX FROM t1;
|
||||||
|
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||||
|
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
|
||||||
|
t1 0 PRIMARY 2 User A 2 NULL NULL BTREE
|
||||||
|
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
|
||||||
|
ALTER TABLE t1 ENABLE KEYS;
|
||||||
|
SHOW INDEX FROM t1;
|
||||||
|
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||||
|
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
|
||||||
|
t1 0 PRIMARY 2 User A 2 NULL NULL BTREE
|
||||||
|
t1 1 Host 1 Host A 1 NULL NULL BTREE
|
||||||
|
UNLOCK TABLES;
|
||||||
|
CHECK TABLES t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
LOCK TABLES t1 WRITE;
|
||||||
|
ALTER TABLE t1 RENAME t2;
|
||||||
|
UNLOCK TABLES;
|
||||||
|
select * from t2;
|
||||||
|
Host User
|
||||||
|
localhost
|
||||||
|
localhost root
|
||||||
|
DROP TABLE t2;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
Host varchar(16) binary NOT NULL default '',
|
||||||
|
User varchar(16) binary NOT NULL default '',
|
||||||
|
PRIMARY KEY (Host,User),
|
||||||
|
KEY (Host)
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
LOCK TABLES t1 WRITE;
|
||||||
|
ALTER TABLE t1 DISABLE KEYS;
|
||||||
|
SHOW INDEX FROM t1;
|
||||||
|
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||||
|
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
|
||||||
|
t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
|
||||||
|
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
|
||||||
|
DROP TABLE t1;
|
||||||
|
create table t1 (a int);
|
||||||
|
alter table t1 rename to `t1\\`;
|
||||||
|
ERROR 42000: Incorrect table name 't1\\'
|
||||||
|
rename table t1 to `t1\\`;
|
||||||
|
ERROR 42000: Incorrect table name 't1\\'
|
||||||
|
drop table t1;
|
||||||
|
drop table if exists t1, t2;
|
||||||
|
Warnings:
|
||||||
|
Note 1051 Unknown table 't1'
|
||||||
|
Note 1051 Unknown table 't2'
|
||||||
|
create table t1 ( a varchar(10) not null primary key ) engine=myisam;
|
||||||
|
create table t2 ( a varchar(10) not null primary key ) engine=merge union=(t1);
|
||||||
|
flush tables;
|
||||||
|
alter table t1 modify a varchar(10);
|
||||||
|
show create table t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TABLE `t2` (
|
||||||
|
`a` varchar(10) NOT NULL,
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`)
|
||||||
|
flush tables;
|
||||||
|
alter table t1 modify a varchar(10) not null;
|
||||||
|
show create table t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TABLE `t2` (
|
||||||
|
`a` varchar(10) NOT NULL,
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`)
|
||||||
|
drop table if exists t1, t2;
|
||||||
|
create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
|
||||||
|
insert into t1 (a) values(1);
|
||||||
|
show table status like 't1';
|
||||||
|
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||||
|
t1 MyISAM 10 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL
|
||||||
|
alter table t1 modify a int;
|
||||||
|
show table status like 't1';
|
||||||
|
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||||
|
t1 MyISAM 10 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a int not null, b int not null, c int not null, d int not null, e int not null, f int not null, g int not null, h int not null,i int not null, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
|
||||||
|
insert into t1 (a) values(1);
|
||||||
|
Warnings:
|
||||||
|
Warning 1364 Field 'b' doesn't have a default value
|
||||||
|
Warning 1364 Field 'c' doesn't have a default value
|
||||||
|
Warning 1364 Field 'd' doesn't have a default value
|
||||||
|
Warning 1364 Field 'e' doesn't have a default value
|
||||||
|
Warning 1364 Field 'f' doesn't have a default value
|
||||||
|
Warning 1364 Field 'g' doesn't have a default value
|
||||||
|
Warning 1364 Field 'h' doesn't have a default value
|
||||||
|
Warning 1364 Field 'i' doesn't have a default value
|
||||||
|
show table status like 't1';
|
||||||
|
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||||
|
t1 MyISAM 10 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL
|
||||||
|
drop table t1;
|
||||||
set names koi8r;
|
set names koi8r;
|
||||||
create table t1 (a char(10) character set koi8r);
|
create table t1 (a char(10) character set koi8r);
|
||||||
insert into t1 values ('ÔÅÓÔ');
|
insert into t1 values ('ÔÅÓÔ');
|
||||||
|
@ -382,75 +505,6 @@ t1 CREATE TABLE `t1` (
|
||||||
`mytext` longtext character set latin1 collate latin1_general_cs
|
`mytext` longtext character set latin1 collate latin1_general_cs
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin2
|
) ENGINE=MyISAM DEFAULT CHARSET=latin2
|
||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE TABLE t1 (
|
|
||||||
Host varchar(16) binary NOT NULL default '',
|
|
||||||
User varchar(16) binary NOT NULL default '',
|
|
||||||
PRIMARY KEY (Host,User)
|
|
||||||
) ENGINE=MyISAM;
|
|
||||||
ALTER TABLE t1 DISABLE KEYS;
|
|
||||||
LOCK TABLES t1 WRITE;
|
|
||||||
INSERT INTO t1 VALUES ('localhost','root'),('localhost',''),('games','monty');
|
|
||||||
SHOW INDEX FROM t1;
|
|
||||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
|
||||||
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
|
|
||||||
t1 0 PRIMARY 2 User A 3 NULL NULL BTREE
|
|
||||||
ALTER TABLE t1 ENABLE KEYS;
|
|
||||||
UNLOCK TABLES;
|
|
||||||
CHECK TABLES t1;
|
|
||||||
Table Op Msg_type Msg_text
|
|
||||||
test.t1 check status OK
|
|
||||||
DROP TABLE t1;
|
|
||||||
CREATE TABLE t1 (
|
|
||||||
Host varchar(16) binary NOT NULL default '',
|
|
||||||
User varchar(16) binary NOT NULL default '',
|
|
||||||
PRIMARY KEY (Host,User),
|
|
||||||
KEY (Host)
|
|
||||||
) ENGINE=MyISAM;
|
|
||||||
ALTER TABLE t1 DISABLE KEYS;
|
|
||||||
SHOW INDEX FROM t1;
|
|
||||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
|
||||||
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
|
|
||||||
t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
|
|
||||||
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
|
|
||||||
LOCK TABLES t1 WRITE;
|
|
||||||
INSERT INTO t1 VALUES ('localhost','root'),('localhost','');
|
|
||||||
SHOW INDEX FROM t1;
|
|
||||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
|
||||||
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
|
|
||||||
t1 0 PRIMARY 2 User A 2 NULL NULL BTREE
|
|
||||||
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
|
|
||||||
ALTER TABLE t1 ENABLE KEYS;
|
|
||||||
SHOW INDEX FROM t1;
|
|
||||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
|
||||||
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
|
|
||||||
t1 0 PRIMARY 2 User A 2 NULL NULL BTREE
|
|
||||||
t1 1 Host 1 Host A 1 NULL NULL BTREE
|
|
||||||
UNLOCK TABLES;
|
|
||||||
CHECK TABLES t1;
|
|
||||||
Table Op Msg_type Msg_text
|
|
||||||
test.t1 check status OK
|
|
||||||
LOCK TABLES t1 WRITE;
|
|
||||||
ALTER TABLE t1 RENAME t2;
|
|
||||||
UNLOCK TABLES;
|
|
||||||
select * from t2;
|
|
||||||
Host User
|
|
||||||
localhost
|
|
||||||
localhost root
|
|
||||||
DROP TABLE t2;
|
|
||||||
CREATE TABLE t1 (
|
|
||||||
Host varchar(16) binary NOT NULL default '',
|
|
||||||
User varchar(16) binary NOT NULL default '',
|
|
||||||
PRIMARY KEY (Host,User),
|
|
||||||
KEY (Host)
|
|
||||||
) ENGINE=MyISAM;
|
|
||||||
LOCK TABLES t1 WRITE;
|
|
||||||
ALTER TABLE t1 DISABLE KEYS;
|
|
||||||
SHOW INDEX FROM t1;
|
|
||||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
|
||||||
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
|
|
||||||
t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
|
|
||||||
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
|
|
||||||
DROP TABLE t1;
|
|
||||||
CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
|
CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
|
||||||
ALTER TABLE t1 DROP PRIMARY KEY;
|
ALTER TABLE t1 DROP PRIMARY KEY;
|
||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
|
@ -469,12 +523,6 @@ alter table t1 drop key no_such_key;
|
||||||
ERROR 42000: Can't DROP 'no_such_key'; check that column/key exists
|
ERROR 42000: Can't DROP 'no_such_key'; check that column/key exists
|
||||||
alter table t1 drop key a;
|
alter table t1 drop key a;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a int);
|
|
||||||
alter table t1 rename to `t1\\`;
|
|
||||||
ERROR 42000: Incorrect table name 't1\\'
|
|
||||||
rename table t1 to `t1\\`;
|
|
||||||
ERROR 42000: Incorrect table name 't1\\'
|
|
||||||
drop table t1;
|
|
||||||
create table t1 (a text) character set koi8r;
|
create table t1 (a text) character set koi8r;
|
||||||
insert into t1 values (_koi8r'ÔÅÓÔ');
|
insert into t1 values (_koi8r'ÔÅÓÔ');
|
||||||
select hex(a) from t1;
|
select hex(a) from t1;
|
||||||
|
|
|
@ -341,3 +341,17 @@ a b
|
||||||
2 3
|
2 3
|
||||||
3 4
|
3 4
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 ( a INT AUTO_INCREMENT, b BLOB, PRIMARY KEY (a,b(10)));
|
||||||
|
INSERT INTO t1 (b) VALUES ('aaaa');
|
||||||
|
CHECK TABLE t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
INSERT INTO t1 (b) VALUES ('');
|
||||||
|
CHECK TABLE t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
INSERT INTO t1 (b) VALUES ('bbbb');
|
||||||
|
CHECK TABLE t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
|
3
mysql-test/r/have_outfile.require
Normal file
3
mysql-test/r/have_outfile.require
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
load_file(concat(@tmpdir,"/outfile.test"))
|
||||||
|
Outfile OK
|
||||||
|
|
|
@ -2397,3 +2397,7 @@ select distinct concat(a, b) from t1;
|
||||||
concat(a, b)
|
concat(a, b)
|
||||||
11113333
|
11113333
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
|
||||||
|
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
|
||||||
|
ERROR HY000: The used table type doesn't support FULLTEXT indexes
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
|
@ -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;
|
||||||
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;
|
||||||
|
|
Binary file not shown.
|
@ -2482,7 +2482,7 @@ a
|
||||||
select distinct distinct * from t1;
|
select distinct distinct * from t1;
|
||||||
a
|
a
|
||||||
select all distinct * from t1;
|
select all distinct * from t1;
|
||||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'distinct * from t1' at line 1
|
ERROR HY000: Incorrect usage of ALL and DISTINCT
|
||||||
select distinct all * from t1;
|
select distinct all * from t1;
|
||||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'all * from t1' at line 1
|
ERROR HY000: Incorrect usage of ALL and DISTINCT
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
|
@ -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
|
||||||
#
|
#
|
||||||
|
@ -277,6 +227,97 @@ ALTER TABLE t1 DISABLE KEYS;
|
||||||
SHOW INDEX FROM t1;
|
SHOW INDEX FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#4717 - check for valid table names
|
||||||
|
#
|
||||||
|
create table t1 (a int);
|
||||||
|
--error 1103
|
||||||
|
alter table t1 rename to `t1\\`;
|
||||||
|
--error 1103
|
||||||
|
rename table t1 to `t1\\`;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#6236 - ALTER TABLE MODIFY should set implicit NOT NULL on PK columns
|
||||||
|
#
|
||||||
|
drop table if exists t1, t2;
|
||||||
|
create table t1 ( a varchar(10) not null primary key ) engine=myisam;
|
||||||
|
create table t2 ( a varchar(10) not null primary key ) engine=merge union=(t1);
|
||||||
|
flush tables;
|
||||||
|
alter table t1 modify a varchar(10);
|
||||||
|
show create table t2;
|
||||||
|
flush tables;
|
||||||
|
alter table t1 modify a varchar(10) not null;
|
||||||
|
show create table t2;
|
||||||
|
drop table if exists t1, t2;
|
||||||
|
|
||||||
|
# The following is also part of bug #6236 (CREATE TABLE didn't properly count
|
||||||
|
# not null columns for primary keys)
|
||||||
|
|
||||||
|
create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
|
||||||
|
insert into t1 (a) values(1);
|
||||||
|
--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
|
||||||
|
show table status like 't1';
|
||||||
|
alter table t1 modify a int;
|
||||||
|
--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
|
||||||
|
show table status like 't1';
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a int not null, b int not null, c int not null, d int not null, e int not null, f int not null, g int not null, h int not null,i int not null, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
|
||||||
|
insert into t1 (a) values(1);
|
||||||
|
--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
|
||||||
|
show table status like '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)
|
||||||
#
|
#
|
||||||
|
@ -296,16 +337,6 @@ alter table t1 drop key no_such_key;
|
||||||
alter table t1 drop key a;
|
alter table t1 drop key a;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
|
||||||
# BUG#4717 - check for valid table names
|
|
||||||
#
|
|
||||||
create table t1 (a int);
|
|
||||||
--error 1103
|
|
||||||
alter table t1 rename to `t1\\`;
|
|
||||||
--error 1103
|
|
||||||
rename table t1 to `t1\\`;
|
|
||||||
drop table t1;
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #6479 ALTER TABLE ... changing charset fails for TEXT columns
|
# Bug #6479 ALTER TABLE ... changing charset fails for TEXT columns
|
||||||
#
|
#
|
||||||
|
|
|
@ -206,3 +206,15 @@ alter table t1 modify b varchar(255);
|
||||||
insert into t1 values (0,4);
|
insert into t1 values (0,4);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG #10045: Problem with composite AUTO_INCREMENT + BLOB key
|
||||||
|
|
||||||
|
CREATE TABLE t1 ( a INT AUTO_INCREMENT, b BLOB, PRIMARY KEY (a,b(10)));
|
||||||
|
INSERT INTO t1 (b) VALUES ('aaaa');
|
||||||
|
CHECK TABLE t1;
|
||||||
|
INSERT INTO t1 (b) VALUES ('');
|
||||||
|
CHECK TABLE t1;
|
||||||
|
INSERT INTO t1 (b) VALUES ('bbbb');
|
||||||
|
CHECK TABLE t1;
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
|
|
@ -1309,3 +1309,13 @@ create table t1(a int(1) , b int(1)) engine=innodb;
|
||||||
insert into t1 values ('1111', '3333');
|
insert into t1 values ('1111', '3333');
|
||||||
select distinct concat(a, b) from t1;
|
select distinct concat(a, b) from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#7709 test case - Boolean fulltext query against unsupported
|
||||||
|
# engines does not fail
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
|
||||||
|
--error 1214;
|
||||||
|
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
disable_query_log;
|
||||||
|
-- source include/test_outfile.inc
|
||||||
|
eval set @tmpdir="$MYSQL_TEST_DIR/var/tmp";
|
||||||
|
enable_query_log;
|
||||||
|
-- source include/have_outfile.inc
|
||||||
|
|
||||||
#
|
#
|
||||||
# test of into outfile|dumpfile
|
# test of into outfile|dumpfile
|
||||||
#
|
#
|
||||||
|
@ -6,29 +12,45 @@
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
# We need to check that we have 'file' privilege.
|
create table t1 (`a` blob);
|
||||||
|
insert into t1 values("hello world"),("Hello mars"),(NULL);
|
||||||
|
disable_query_log;
|
||||||
|
eval select * into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.1" from t1;
|
||||||
|
enable_query_log;
|
||||||
|
select load_file(concat(@tmpdir,"/outfile-test.1"));
|
||||||
|
disable_query_log;
|
||||||
|
eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.2" from t1 limit 1;
|
||||||
|
enable_query_log;
|
||||||
|
select load_file(concat(@tmpdir,"/outfile-test.2"));
|
||||||
|
disable_query_log;
|
||||||
|
eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1 where a is null;
|
||||||
|
enable_query_log;
|
||||||
|
select load_file(concat(@tmpdir,"/outfile-test.3"));
|
||||||
|
|
||||||
#create table t1 (`a` blob);
|
# the following should give errors
|
||||||
#insert into t1 values("hello world"),("Hello mars"),(NULL);
|
|
||||||
#select * into outfile "/tmp/select-test.1" from t1;
|
#disabled as error message has variable path
|
||||||
#select load_file("/tmp/select-test.1");
|
#disable_query_log;
|
||||||
#select * into dumpfile "/tmp/select-test.2" from t1 limit 1;
|
#--error 1086
|
||||||
#select load_file("/tmp/select-test.2");
|
#eval select * into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.1" from t1;
|
||||||
#select * into dumpfile "/tmp/select-test.3" from t1 where a is null;
|
#--error 1086
|
||||||
#select load_file("/tmp/select-test.3");
|
#eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.2" from t1;
|
||||||
#
|
#--error 1086
|
||||||
## the following should give errors
|
#eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1;
|
||||||
#
|
#enable_query_log;
|
||||||
#select * into outfile "/tmp/select-test.1" from t1;
|
--error 13,2
|
||||||
#select * into dumpfile "/tmp/select-test.1" from t1;
|
select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
|
||||||
#select * into dumpfile "/tmp/select-test.99" from t1;
|
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.1
|
||||||
#select load_file("/tmp/select-test.not-exist");
|
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.2
|
||||||
#drop table t1;
|
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.3
|
||||||
#drop table if exists t;
|
drop table t1;
|
||||||
#CREATE TABLE t ( t timestamp NOT NULL, c char(200) character set latin1 NOT NULL default '', i int(11), v varchar(200), b blob, KEY t (t)) ENGINE=MyISAM;
|
|
||||||
#INSERT INTO t VALUES ('2002-12-20 12:01:20','',1,"aaa","bbb");
|
# Bug#8191
|
||||||
#select * from t into outfile "check";
|
disable_query_log;
|
||||||
#drop table if exists t;
|
eval select 1 into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.4";
|
||||||
|
enable_query_log;
|
||||||
|
select load_file(concat(@tmpdir,"/outfile-test.4"));
|
||||||
|
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.4
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #5382: 'explain select into outfile' crashes the server
|
# Bug #5382: 'explain select into outfile' crashes the server
|
||||||
|
|
|
@ -2064,9 +2064,9 @@ drop table t1;
|
||||||
create table t1 (a int(11));
|
create table t1 (a int(11));
|
||||||
select all all * from t1;
|
select all all * from t1;
|
||||||
select distinct distinct * from t1;
|
select distinct distinct * from t1;
|
||||||
--error 1064
|
--error 1221
|
||||||
select all distinct * from t1;
|
select all distinct * from t1;
|
||||||
--error 1064
|
--error 1221
|
||||||
select distinct all * from t1;
|
select distinct all * from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
|
|
@ -1420,6 +1420,7 @@ void handler::update_auto_increment()
|
||||||
ulonglong nr;
|
ulonglong nr;
|
||||||
THD *thd= table->in_use;
|
THD *thd= table->in_use;
|
||||||
struct system_variables *variables= &thd->variables;
|
struct system_variables *variables= &thd->variables;
|
||||||
|
bool auto_increment_field_not_null;
|
||||||
DBUG_ENTER("handler::update_auto_increment");
|
DBUG_ENTER("handler::update_auto_increment");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1427,13 +1428,14 @@ void handler::update_auto_increment()
|
||||||
row was not inserted
|
row was not inserted
|
||||||
*/
|
*/
|
||||||
thd->prev_insert_id= thd->next_insert_id;
|
thd->prev_insert_id= thd->next_insert_id;
|
||||||
|
auto_increment_field_not_null= table->auto_increment_field_not_null;
|
||||||
|
table->auto_increment_field_not_null= FALSE;
|
||||||
|
|
||||||
if ((nr= table->next_number_field->val_int()) != 0 ||
|
if ((nr= table->next_number_field->val_int()) != 0 ||
|
||||||
table->auto_increment_field_not_null &&
|
auto_increment_field_not_null &&
|
||||||
thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO)
|
thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO)
|
||||||
{
|
{
|
||||||
/* Clear flag for next row */
|
/* Clear flag for next row */
|
||||||
table->auto_increment_field_not_null= FALSE;
|
|
||||||
/* Mark that we didn't generate a new value **/
|
/* Mark that we didn't generate a new value **/
|
||||||
auto_increment_column_changed=0;
|
auto_increment_column_changed=0;
|
||||||
|
|
||||||
|
@ -1449,7 +1451,6 @@ void handler::update_auto_increment()
|
||||||
}
|
}
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
table->auto_increment_field_not_null= FALSE;
|
|
||||||
if (!(nr= thd->next_insert_id))
|
if (!(nr= thd->next_insert_id))
|
||||||
{
|
{
|
||||||
nr= get_auto_increment();
|
nr= get_auto_increment();
|
||||||
|
|
|
@ -378,6 +378,7 @@ typedef struct st_ha_create_information
|
||||||
SQL_LIST merge_list;
|
SQL_LIST merge_list;
|
||||||
enum db_type db_type;
|
enum db_type db_type;
|
||||||
enum row_type row_type;
|
enum row_type row_type;
|
||||||
|
uint null_bits; /* NULL bits at start of record */
|
||||||
uint options; /* OR of HA_CREATE_ options */
|
uint options; /* OR of HA_CREATE_ options */
|
||||||
uint raid_type,raid_chunks;
|
uint raid_type,raid_chunks;
|
||||||
uint merge_insert_method;
|
uint merge_insert_method;
|
||||||
|
|
|
@ -209,8 +209,8 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
|
||||||
DBUG_PRINT("error",("gethostbyaddr returned %d",errno));
|
DBUG_PRINT("error",("gethostbyaddr returned %d",errno));
|
||||||
|
|
||||||
if (errno == HOST_NOT_FOUND || errno == NO_DATA)
|
if (errno == HOST_NOT_FOUND || errno == NO_DATA)
|
||||||
add_wrong_ip(in); /* only cache negative responses, not failures */
|
goto add_wrong_ip_and_return;
|
||||||
|
/* Failure, don't cache responce */
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
if (!hp->h_name[0]) // Don't allow empty hostnames
|
if (!hp->h_name[0]) // Don't allow empty hostnames
|
||||||
|
|
|
@ -4311,6 +4311,11 @@ bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
table=((Item_field *)item)->field->table;
|
table=((Item_field *)item)->field->table;
|
||||||
|
if (!(table->file->table_flags() & HA_CAN_FULLTEXT))
|
||||||
|
{
|
||||||
|
my_error(ER_TABLE_CANT_HANDLE_FT, MYF(0));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
table->fulltext_searched=1;
|
table->fulltext_searched=1;
|
||||||
return agg_arg_collations_for_comparison(cmp_collation, args+1, arg_count-1);
|
return agg_arg_collations_for_comparison(cmp_collation, args+1, arg_count-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -640,9 +640,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||||
{
|
{
|
||||||
const char *key_name;
|
const char *key_name;
|
||||||
create_field *sql_field,*dup_field;
|
create_field *sql_field,*dup_field;
|
||||||
uint field,null_fields,blob_columns;
|
uint field,null_fields,blob_columns,max_key_length;
|
||||||
uint max_key_length= file->max_key_length();
|
ulong record_offset= 0;
|
||||||
ulong pos;
|
|
||||||
KEY *key_info;
|
KEY *key_info;
|
||||||
KEY_PART_INFO *key_part_info;
|
KEY_PART_INFO *key_part_info;
|
||||||
int timestamps= 0, timestamps_with_niladic= 0;
|
int timestamps= 0, timestamps_with_niladic= 0;
|
||||||
|
@ -655,6 +654,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||||
select_field_pos= fields->elements - select_field_count;
|
select_field_pos= fields->elements - select_field_count;
|
||||||
null_fields=blob_columns=0;
|
null_fields=blob_columns=0;
|
||||||
create_info->varchar= 0;
|
create_info->varchar= 0;
|
||||||
|
max_key_length= file->max_key_length();
|
||||||
|
|
||||||
for (field_no=0; (sql_field=it++) ; field_no++)
|
for (field_no=0; (sql_field=it++) ; field_no++)
|
||||||
{
|
{
|
||||||
|
@ -836,10 +836,10 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||||
(*db_options)|= HA_OPTION_PACK_RECORD;
|
(*db_options)|= HA_OPTION_PACK_RECORD;
|
||||||
it2.rewind();
|
it2.rewind();
|
||||||
}
|
}
|
||||||
/* If fixed row records, we need one bit to check for deleted rows */
|
|
||||||
if (!((*db_options) & HA_OPTION_PACK_RECORD))
|
/* record_offset will be increased with 'length-of-null-bits' later */
|
||||||
null_fields++;
|
record_offset= 0;
|
||||||
pos= (null_fields + total_uneven_bit_length + 7) / 8;
|
null_fields+= total_uneven_bit_length;
|
||||||
|
|
||||||
it.rewind();
|
it.rewind();
|
||||||
while ((sql_field=it++))
|
while ((sql_field=it++))
|
||||||
|
@ -852,10 +852,10 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
if (sql_field->sql_type == MYSQL_TYPE_VARCHAR)
|
if (sql_field->sql_type == MYSQL_TYPE_VARCHAR)
|
||||||
create_info->varchar= 1;
|
create_info->varchar= 1;
|
||||||
sql_field->offset= pos;
|
sql_field->offset= record_offset;
|
||||||
if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER)
|
if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER)
|
||||||
auto_increment++;
|
auto_increment++;
|
||||||
pos+=sql_field->pack_length;
|
record_offset+= sql_field->pack_length;
|
||||||
}
|
}
|
||||||
if (timestamps_with_niladic > 1)
|
if (timestamps_with_niladic > 1)
|
||||||
{
|
{
|
||||||
|
@ -1159,6 +1159,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||||
/* Implicitly set primary key fields to NOT NULL for ISO conf. */
|
/* Implicitly set primary key fields to NOT NULL for ISO conf. */
|
||||||
sql_field->flags|= NOT_NULL_FLAG;
|
sql_field->flags|= NOT_NULL_FLAG;
|
||||||
sql_field->pack_flag&= ~FIELDFLAG_MAYBE_NULL;
|
sql_field->pack_flag&= ~FIELDFLAG_MAYBE_NULL;
|
||||||
|
null_fields--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
key_info->flags|= HA_NULL_PART_KEY;
|
key_info->flags|= HA_NULL_PART_KEY;
|
||||||
|
@ -1190,10 +1191,10 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||||
{
|
{
|
||||||
if (f_is_blob(sql_field->pack_flag))
|
if (f_is_blob(sql_field->pack_flag))
|
||||||
{
|
{
|
||||||
if ((length=column->length) > file->max_key_length() ||
|
if ((length=column->length) > max_key_length ||
|
||||||
length > file->max_key_part_length())
|
length > file->max_key_part_length())
|
||||||
{
|
{
|
||||||
length=min(file->max_key_length(), file->max_key_part_length());
|
length=min(max_key_length, file->max_key_part_length());
|
||||||
if (key->type == Key::MULTIPLE)
|
if (key->type == Key::MULTIPLE)
|
||||||
{
|
{
|
||||||
/* not a critical problem */
|
/* not a critical problem */
|
||||||
|
@ -1317,6 +1318,7 @@ static 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);
|
||||||
}
|
}
|
||||||
|
@ -3417,12 +3419,14 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
better have a negative test here, instead of positive, like
|
better have a negative test here, instead of positive, like
|
||||||
alter_info->flags & ALTER_ADD_COLUMN|ALTER_ADD_INDEX|...
|
alter_info->flags & ALTER_ADD_COLUMN|ALTER_ADD_INDEX|...
|
||||||
so that ALTER TABLE won't break when somebody will add new flag
|
so that ALTER TABLE won't break when somebody will add new flag
|
||||||
*/
|
*/
|
||||||
need_copy_table=(alter_info->flags & ~(ALTER_CHANGE_COLUMN_DEFAULT|ALTER_OPTIONS) ||
|
need_copy_table= (alter_info->flags &
|
||||||
create_info->used_fields & ~(HA_CREATE_USED_COMMENT|HA_CREATE_USED_PASSWORD) ||
|
~(ALTER_CHANGE_COLUMN_DEFAULT|ALTER_OPTIONS) ||
|
||||||
table->s->tmp_table);
|
(create_info->used_fields &
|
||||||
|
~(HA_CREATE_USED_COMMENT|HA_CREATE_USED_PASSWORD)) ||
|
||||||
|
table->s->tmp_table);
|
||||||
create_info->frm_only= !need_copy_table;
|
create_info->frm_only= !need_copy_table;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3827,8 +3831,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
||||||
!(sortorder=make_unireg_sortorder(order, &length)) ||
|
!(sortorder=make_unireg_sortorder(order, &length)) ||
|
||||||
(from->sort.found_records = filesort(thd, from, sortorder, length,
|
(from->sort.found_records = filesort(thd, from, sortorder, length,
|
||||||
(SQL_SELECT *) 0, HA_POS_ERROR,
|
(SQL_SELECT *) 0, HA_POS_ERROR,
|
||||||
&examined_rows))
|
&examined_rows)) ==
|
||||||
== HA_POS_ERROR)
|
HA_POS_ERROR)
|
||||||
goto err;
|
goto err;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3986,7 +3986,14 @@ select_from:
|
||||||
|
|
||||||
select_options:
|
select_options:
|
||||||
/* empty*/
|
/* empty*/
|
||||||
| select_option_list;
|
| select_option_list
|
||||||
|
{
|
||||||
|
if (test_all_bits(Select->options, SELECT_ALL | SELECT_DISTINCT))
|
||||||
|
{
|
||||||
|
my_error(ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT");
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
select_option_list:
|
select_option_list:
|
||||||
select_option_list select_option
|
select_option_list select_option
|
||||||
|
@ -4000,15 +4007,7 @@ select_option:
|
||||||
YYABORT;
|
YYABORT;
|
||||||
Lex->lock_option= TL_READ_HIGH_PRIORITY;
|
Lex->lock_option= TL_READ_HIGH_PRIORITY;
|
||||||
}
|
}
|
||||||
| DISTINCT
|
| DISTINCT { Select->options|= SELECT_DISTINCT; }
|
||||||
{
|
|
||||||
if (Select->options & SELECT_ALL)
|
|
||||||
{
|
|
||||||
yyerror(ER(ER_SYNTAX_ERROR));
|
|
||||||
YYABORT;
|
|
||||||
}
|
|
||||||
Select->options|= SELECT_DISTINCT;
|
|
||||||
}
|
|
||||||
| SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; }
|
| SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; }
|
||||||
| SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; }
|
| SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; }
|
||||||
| SQL_BUFFER_RESULT
|
| SQL_BUFFER_RESULT
|
||||||
|
@ -4028,15 +4027,7 @@ select_option:
|
||||||
{
|
{
|
||||||
Lex->select_lex.options|= OPTION_TO_QUERY_CACHE;
|
Lex->select_lex.options|= OPTION_TO_QUERY_CACHE;
|
||||||
}
|
}
|
||||||
| ALL
|
| ALL { Select->options|= SELECT_ALL; }
|
||||||
{
|
|
||||||
if (Select->options & SELECT_DISTINCT)
|
|
||||||
{
|
|
||||||
yyerror(ER(ER_SYNTAX_ERROR));
|
|
||||||
YYABORT;
|
|
||||||
}
|
|
||||||
Select->options|= SELECT_ALL;
|
|
||||||
}
|
|
||||||
;
|
;
|
||||||
|
|
||||||
select_lock_type:
|
select_lock_type:
|
||||||
|
|
|
@ -32,18 +32,20 @@
|
||||||
|
|
||||||
static uchar * pack_screens(List<create_field> &create_fields,
|
static uchar * pack_screens(List<create_field> &create_fields,
|
||||||
uint *info_length, uint *screens, bool small_file);
|
uint *info_length, uint *screens, bool small_file);
|
||||||
static uint pack_keys(uchar *keybuff,uint key_count, KEY *key_info);
|
static uint pack_keys(uchar *keybuff,uint key_count, KEY *key_info,
|
||||||
|
ulong data_offset);
|
||||||
static bool pack_header(uchar *forminfo,enum db_type table_type,
|
static bool pack_header(uchar *forminfo,enum db_type table_type,
|
||||||
List<create_field> &create_fields,
|
List<create_field> &create_fields,
|
||||||
uint info_length, uint screens, uint table_options,
|
uint info_length, uint screens, uint table_options,
|
||||||
handler *file);
|
ulong data_offset, handler *file);
|
||||||
static uint get_interval_id(uint *int_count,List<create_field> &create_fields,
|
static uint get_interval_id(uint *int_count,List<create_field> &create_fields,
|
||||||
create_field *last_field);
|
create_field *last_field);
|
||||||
static bool pack_fields(File file, List<create_field> &create_fields);
|
static bool pack_fields(File file, List<create_field> &create_fields,
|
||||||
|
ulong data_offset);
|
||||||
static bool make_empty_rec(THD *thd, int file, enum db_type table_type,
|
static bool make_empty_rec(THD *thd, int file, enum db_type table_type,
|
||||||
uint table_options,
|
uint table_options,
|
||||||
List<create_field> &create_fields,
|
List<create_field> &create_fields,
|
||||||
uint reclength,uint null_fields);
|
uint reclength, ulong data_offset);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Create a frm (table definition) file
|
Create a frm (table definition) file
|
||||||
|
@ -69,9 +71,9 @@ bool mysql_create_frm(THD *thd, my_string file_name,
|
||||||
uint keys, KEY *key_info,
|
uint keys, KEY *key_info,
|
||||||
handler *db_file)
|
handler *db_file)
|
||||||
{
|
{
|
||||||
uint reclength,info_length,screens,key_info_length,maxlength,null_fields;
|
uint reclength,info_length,screens,key_info_length,maxlength;
|
||||||
File file;
|
File file;
|
||||||
ulong filepos;
|
ulong filepos, data_offset;
|
||||||
uchar fileinfo[64],forminfo[288],*keybuff;
|
uchar fileinfo[64],forminfo[288],*keybuff;
|
||||||
TYPELIB formnames;
|
TYPELIB formnames;
|
||||||
uchar *screen_buff;
|
uchar *screen_buff;
|
||||||
|
@ -81,9 +83,16 @@ bool mysql_create_frm(THD *thd, my_string file_name,
|
||||||
if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,0)))
|
if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,0)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
if (db_file == NULL)
|
if (db_file == NULL)
|
||||||
db_file=get_new_handler((TABLE*) 0, create_info->db_type);
|
db_file= get_new_handler((TABLE*) 0, create_info->db_type);
|
||||||
|
|
||||||
|
/* If fixed row records, we need one bit to check for deleted rows */
|
||||||
|
if (!(create_info->table_options & HA_OPTION_PACK_RECORD))
|
||||||
|
create_info->null_bits++;
|
||||||
|
data_offset= (create_info->null_bits + 7) / 8;
|
||||||
|
|
||||||
if (pack_header(forminfo, create_info->db_type,create_fields,info_length,
|
if (pack_header(forminfo, create_info->db_type,create_fields,info_length,
|
||||||
screens, create_info->table_options, db_file))
|
screens, create_info->table_options,
|
||||||
|
data_offset, db_file))
|
||||||
{
|
{
|
||||||
my_free((gptr) screen_buff,MYF(0));
|
my_free((gptr) screen_buff,MYF(0));
|
||||||
if (thd->net.last_errno != ER_TOO_MANY_FIELDS)
|
if (thd->net.last_errno != ER_TOO_MANY_FIELDS)
|
||||||
|
@ -94,14 +103,13 @@ bool mysql_create_frm(THD *thd, my_string file_name,
|
||||||
if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,1)))
|
if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,1)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
if (pack_header(forminfo, create_info->db_type, create_fields,info_length,
|
if (pack_header(forminfo, create_info->db_type, create_fields,info_length,
|
||||||
screens, create_info->table_options, db_file))
|
screens, create_info->table_options, data_offset, db_file))
|
||||||
{
|
{
|
||||||
my_free((gptr) screen_buff,MYF(0));
|
my_free((gptr) screen_buff,MYF(0));
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reclength=uint2korr(forminfo+266);
|
reclength=uint2korr(forminfo+266);
|
||||||
null_fields=uint2korr(forminfo+282);
|
|
||||||
|
|
||||||
if ((file=create_frm(file_name, reclength, fileinfo,
|
if ((file=create_frm(file_name, reclength, fileinfo,
|
||||||
create_info, keys)) < 0)
|
create_info, keys)) < 0)
|
||||||
|
@ -112,7 +120,7 @@ bool mysql_create_frm(THD *thd, my_string file_name,
|
||||||
|
|
||||||
uint key_buff_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16;
|
uint key_buff_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16;
|
||||||
keybuff=(uchar*) my_malloc(key_buff_length, MYF(0));
|
keybuff=(uchar*) my_malloc(key_buff_length, MYF(0));
|
||||||
key_info_length=pack_keys(keybuff,keys,key_info);
|
key_info_length= pack_keys(keybuff, keys, key_info, data_offset);
|
||||||
VOID(get_form_pos(file,fileinfo,&formnames));
|
VOID(get_form_pos(file,fileinfo,&formnames));
|
||||||
if (!(filepos=make_new_entry(file,fileinfo,&formnames,"")))
|
if (!(filepos=make_new_entry(file,fileinfo,&formnames,"")))
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -135,13 +143,13 @@ bool mysql_create_frm(THD *thd, my_string file_name,
|
||||||
(ulong) uint2korr(fileinfo+6)+ (ulong) key_buff_length,
|
(ulong) uint2korr(fileinfo+6)+ (ulong) key_buff_length,
|
||||||
MY_SEEK_SET,MYF(0)));
|
MY_SEEK_SET,MYF(0)));
|
||||||
if (make_empty_rec(thd,file,create_info->db_type,create_info->table_options,
|
if (make_empty_rec(thd,file,create_info->db_type,create_info->table_options,
|
||||||
create_fields,reclength,null_fields))
|
create_fields,reclength, data_offset))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
|
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
|
||||||
if (my_write(file,(byte*) forminfo,288,MYF_RW) ||
|
if (my_write(file,(byte*) forminfo,288,MYF_RW) ||
|
||||||
my_write(file,(byte*) screen_buff,info_length,MYF_RW) ||
|
my_write(file,(byte*) screen_buff,info_length,MYF_RW) ||
|
||||||
pack_fields(file,create_fields))
|
pack_fields(file, create_fields, data_offset))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
#ifdef HAVE_CRYPTED_FRM
|
#ifdef HAVE_CRYPTED_FRM
|
||||||
|
@ -313,7 +321,8 @@ static uchar * pack_screens(List<create_field> &create_fields,
|
||||||
|
|
||||||
/* Pack keyinfo and keynames to keybuff for save in form-file. */
|
/* Pack keyinfo and keynames to keybuff for save in form-file. */
|
||||||
|
|
||||||
static uint pack_keys(uchar *keybuff,uint key_count,KEY *keyinfo)
|
static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo,
|
||||||
|
ulong data_offset)
|
||||||
{
|
{
|
||||||
uint key_parts,length;
|
uint key_parts,length;
|
||||||
uchar *pos, *keyname_pos;
|
uchar *pos, *keyname_pos;
|
||||||
|
@ -340,10 +349,13 @@ static uint pack_keys(uchar *keybuff,uint key_count,KEY *keyinfo)
|
||||||
key_part++)
|
key_part++)
|
||||||
|
|
||||||
{
|
{
|
||||||
DBUG_PRINT("loop",("field: %d startpos: %ld length: %ld",
|
uint offset;
|
||||||
key_part->fieldnr,key_part->offset,key_part->length));
|
DBUG_PRINT("loop",("field: %d startpos: %lu length: %ld",
|
||||||
|
key_part->fieldnr, key_part->offset + data_offset,
|
||||||
|
key_part->length));
|
||||||
int2store(pos,key_part->fieldnr+1+FIELD_NAME_USED);
|
int2store(pos,key_part->fieldnr+1+FIELD_NAME_USED);
|
||||||
int2store(pos+2,key_part->offset+1);
|
offset= (uint) (key_part->offset+data_offset+1);
|
||||||
|
int2store(pos+2, offset);
|
||||||
pos[4]=0; // Sort order
|
pos[4]=0; // Sort order
|
||||||
int2store(pos+5,key_part->key_type);
|
int2store(pos+5,key_part->key_type);
|
||||||
int2store(pos+7,key_part->length);
|
int2store(pos+7,key_part->length);
|
||||||
|
@ -384,8 +396,8 @@ static uint pack_keys(uchar *keybuff,uint key_count,KEY *keyinfo)
|
||||||
|
|
||||||
static bool pack_header(uchar *forminfo, enum db_type table_type,
|
static bool pack_header(uchar *forminfo, enum db_type table_type,
|
||||||
List<create_field> &create_fields,
|
List<create_field> &create_fields,
|
||||||
uint info_length, uint screens,uint table_options,
|
uint info_length, uint screens, uint table_options,
|
||||||
handler *file)
|
ulong data_offset, handler *file)
|
||||||
{
|
{
|
||||||
uint length,int_count,int_length,no_empty, int_parts;
|
uint length,int_count,int_length,no_empty, int_parts;
|
||||||
uint time_stamp_pos,null_fields;
|
uint time_stamp_pos,null_fields;
|
||||||
|
@ -425,10 +437,10 @@ static bool pack_header(uchar *forminfo, enum db_type table_type,
|
||||||
if (field->sql_type == FIELD_TYPE_TIMESTAMP &&
|
if (field->sql_type == FIELD_TYPE_TIMESTAMP &&
|
||||||
MTYP_TYPENR(field->unireg_check) != Field::NONE &&
|
MTYP_TYPENR(field->unireg_check) != Field::NONE &&
|
||||||
!time_stamp_pos)
|
!time_stamp_pos)
|
||||||
time_stamp_pos=(int) field->offset+1;
|
time_stamp_pos= (uint) field->offset+ (uint) data_offset + 1;
|
||||||
length=field->pack_length;
|
length=field->pack_length;
|
||||||
if ((int) field->offset+length > reclength)
|
if ((uint) field->offset+ (uint) data_offset+ length > reclength)
|
||||||
reclength=(int) field->offset+length;
|
reclength=(uint) (field->offset+ data_offset + length);
|
||||||
n_length+= (ulong) strlen(field->field_name)+1;
|
n_length+= (ulong) strlen(field->field_name)+1;
|
||||||
field->interval_id=0;
|
field->interval_id=0;
|
||||||
if (field->interval)
|
if (field->interval)
|
||||||
|
@ -539,7 +551,8 @@ static uint get_interval_id(uint *int_count,List<create_field> &create_fields,
|
||||||
|
|
||||||
/* Save fields, fieldnames and intervals */
|
/* Save fields, fieldnames and intervals */
|
||||||
|
|
||||||
static bool pack_fields(File file,List<create_field> &create_fields)
|
static bool pack_fields(File file, List<create_field> &create_fields,
|
||||||
|
ulong data_offset)
|
||||||
{
|
{
|
||||||
reg2 uint i;
|
reg2 uint i;
|
||||||
uint int_count, comment_length=0;
|
uint int_count, comment_length=0;
|
||||||
|
@ -554,11 +567,13 @@ static bool pack_fields(File file,List<create_field> &create_fields)
|
||||||
int_count=0;
|
int_count=0;
|
||||||
while ((field=it++))
|
while ((field=it++))
|
||||||
{
|
{
|
||||||
|
uint recpos;
|
||||||
buff[0]= (uchar) field->row;
|
buff[0]= (uchar) field->row;
|
||||||
buff[1]= (uchar) field->col;
|
buff[1]= (uchar) field->col;
|
||||||
buff[2]= (uchar) field->sc_length;
|
buff[2]= (uchar) field->sc_length;
|
||||||
int2store(buff+3, field->length);
|
int2store(buff+3, field->length);
|
||||||
uint recpos=(uint) field->offset+1;
|
/* The +1 is here becasue the col offset in .frm file have offset 1 */
|
||||||
|
recpos= field->offset+1 + (uint) data_offset;
|
||||||
int3store(buff+5,recpos);
|
int3store(buff+5,recpos);
|
||||||
int2store(buff+8,field->pack_flag);
|
int2store(buff+8,field->pack_flag);
|
||||||
int2store(buff+10,field->unireg_check);
|
int2store(buff+10,field->unireg_check);
|
||||||
|
@ -644,11 +659,12 @@ static bool pack_fields(File file,List<create_field> &create_fields)
|
||||||
static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
|
static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
|
||||||
uint table_options,
|
uint table_options,
|
||||||
List<create_field> &create_fields,
|
List<create_field> &create_fields,
|
||||||
uint reclength, uint null_fields)
|
uint reclength,
|
||||||
|
ulong data_offset)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
Field::utype type;
|
Field::utype type;
|
||||||
uint null_count;
|
uint firstpos, null_count;
|
||||||
uchar *buff,*null_pos;
|
uchar *buff,*null_pos;
|
||||||
TABLE table;
|
TABLE table;
|
||||||
create_field *field;
|
create_field *field;
|
||||||
|
@ -675,8 +691,7 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
|
||||||
null_count=0;
|
null_count=0;
|
||||||
if (!(table_options & HA_OPTION_PACK_RECORD))
|
if (!(table_options & HA_OPTION_PACK_RECORD))
|
||||||
{
|
{
|
||||||
null_fields++; // Need one bit for delete mark
|
null_count++; // Need one bit for delete mark
|
||||||
null_count++;
|
|
||||||
*buff|= 1;
|
*buff|= 1;
|
||||||
}
|
}
|
||||||
null_pos= buff;
|
null_pos= buff;
|
||||||
|
@ -688,7 +703,8 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
|
||||||
/*
|
/*
|
||||||
regfield don't have to be deleted as it's allocated with sql_alloc()
|
regfield don't have to be deleted as it's allocated with sql_alloc()
|
||||||
*/
|
*/
|
||||||
Field *regfield=make_field((char*) buff+field->offset,field->length,
|
Field *regfield=make_field((char*) buff+field->offset + data_offset,
|
||||||
|
field->length,
|
||||||
null_pos + null_count / 8,
|
null_pos + null_count / 8,
|
||||||
null_count & 7,
|
null_count & 7,
|
||||||
field->pack_flag,
|
field->pack_flag,
|
||||||
|
@ -737,12 +753,13 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
|
||||||
else
|
else
|
||||||
regfield->reset();
|
regfield->reset();
|
||||||
}
|
}
|
||||||
|
DBUG_ASSERT(data_offset == ((null_count + 7) / 8));
|
||||||
|
|
||||||
/* Fill not used startpos */
|
/* Fill not used startpos */
|
||||||
if (null_count)
|
if (null_count)
|
||||||
*(null_pos + null_count / 8)|= ~(((uchar) 1 << (null_count & 7)) - 1);
|
*(null_pos + null_count / 8)|= ~(((uchar) 1 << (null_count & 7)) - 1);
|
||||||
|
|
||||||
error=(int) my_write(file,(byte*) buff,(uint) reclength,MYF_RW);
|
error=(int) my_write(file,(byte*) buff, (uint) reclength,MYF_RW);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
my_free((gptr) buff,MYF(MY_FAE));
|
my_free((gptr) buff,MYF(MY_FAE));
|
||||||
|
|
|
@ -1257,7 +1257,7 @@ static
|
||||||
uint my_numchars_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
uint my_numchars_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
||||||
const char *b, const char *e)
|
const char *b, const char *e)
|
||||||
{
|
{
|
||||||
return (e-b)/2;
|
return (uint) (e-b)/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1267,7 +1267,8 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
||||||
const char *e __attribute__((unused)),
|
const char *e __attribute__((unused)),
|
||||||
uint pos)
|
uint pos)
|
||||||
{
|
{
|
||||||
return pos > e - b ? e - b + 2 : pos * 2;
|
uint string_length= (uint) (e - b);
|
||||||
|
return pos > string_length ? string_length + 2 : pos * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1276,7 +1277,8 @@ uint my_well_formed_len_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
||||||
const char *b, const char *e,
|
const char *b, const char *e,
|
||||||
uint nchars, int *error)
|
uint nchars, int *error)
|
||||||
{
|
{
|
||||||
uint nbytes= (e-b) & ~ (uint)1;
|
/* Ensure string length is dividable with 2 */
|
||||||
|
uint nbytes= ((uint) (e-b)) & ~(uint) 1;
|
||||||
*error= 0;
|
*error= 0;
|
||||||
nchars*= 2;
|
nchars*= 2;
|
||||||
return min(nbytes, nchars);
|
return min(nbytes, nchars);
|
||||||
|
|
Loading…
Reference in a new issue