mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
This commit is contained in:
@@ -486,7 +486,7 @@ os_io_init_simple(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef UNIV_HOTBACKUP
|
#if !defined(UNIV_HOTBACKUP) && !defined(__NETWARE__)
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
Creates a temporary file. This function is defined in ha_innodb.cc. */
|
Creates a temporary file. This function is defined in ha_innodb.cc. */
|
||||||
|
|
||||||
@@ -494,7 +494,7 @@ int
|
|||||||
innobase_mysql_tmpfile(void);
|
innobase_mysql_tmpfile(void);
|
||||||
/*========================*/
|
/*========================*/
|
||||||
/* out: temporary file descriptor, or < 0 on error */
|
/* out: temporary file descriptor, or < 0 on error */
|
||||||
#endif /* !UNIV_HOTBACKUP */
|
#endif /* !UNIV_HOTBACKUP && !__NETWARE__ */
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
Creates a temporary file. */
|
Creates a temporary file. */
|
||||||
@@ -504,9 +504,12 @@ os_file_create_tmpfile(void)
|
|||||||
/*========================*/
|
/*========================*/
|
||||||
/* out: temporary file handle, or NULL on error */
|
/* out: temporary file handle, or NULL on error */
|
||||||
{
|
{
|
||||||
|
#ifdef __NETWARE__
|
||||||
|
FILE* file = tmpfile();
|
||||||
|
#else /* __NETWARE__ */
|
||||||
FILE* file = NULL;
|
FILE* file = NULL;
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
#ifdef UNIV_HOTBACKUP
|
# ifdef UNIV_HOTBACKUP
|
||||||
int tries;
|
int tries;
|
||||||
for (tries = 10; tries--; ) {
|
for (tries = 10; tries--; ) {
|
||||||
char* name = tempnam(fil_path_to_mysql_datadir, "ib");
|
char* name = tempnam(fil_path_to_mysql_datadir, "ib");
|
||||||
@@ -515,15 +518,15 @@ os_file_create_tmpfile(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fd = open(name,
|
fd = open(name,
|
||||||
# ifdef __WIN__
|
# ifdef __WIN__
|
||||||
O_SEQUENTIAL | O_SHORT_LIVED | O_TEMPORARY |
|
O_SEQUENTIAL | O_SHORT_LIVED | O_TEMPORARY |
|
||||||
# endif /* __WIN__ */
|
# endif /* __WIN__ */
|
||||||
O_CREAT | O_EXCL | O_RDWR,
|
O_CREAT | O_EXCL | O_RDWR,
|
||||||
S_IREAD | S_IWRITE);
|
S_IREAD | S_IWRITE);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
# ifndef __WIN__
|
# ifndef __WIN__
|
||||||
unlink(name);
|
unlink(name);
|
||||||
# endif /* !__WIN__ */
|
# endif /* !__WIN__ */
|
||||||
free(name);
|
free(name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -534,22 +537,25 @@ os_file_create_tmpfile(void)
|
|||||||
name);
|
name);
|
||||||
free(name);
|
free(name);
|
||||||
}
|
}
|
||||||
#else /* UNIV_HOTBACKUP */
|
# else /* UNIV_HOTBACKUP */
|
||||||
fd = innobase_mysql_tmpfile();
|
fd = innobase_mysql_tmpfile();
|
||||||
#endif /* UNIV_HOTBACKUP */
|
# endif /* UNIV_HOTBACKUP */
|
||||||
|
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
file = fdopen(fd, "w+b");
|
file = fdopen(fd, "w+b");
|
||||||
}
|
}
|
||||||
|
#endif /* __NETWARE__ */
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
ut_print_timestamp(stderr);
|
ut_print_timestamp(stderr);
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" InnoDB: Error: unable to create temporary file;"
|
" InnoDB: Error: unable to create temporary file;"
|
||||||
" errno: %d\n", errno);
|
" errno: %d\n", errno);
|
||||||
|
#ifndef __NETWARE__
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
#endif /* !__NETWARE__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
return(file);
|
return(file);
|
||||||
|
@@ -412,7 +412,7 @@ show create table t1;
|
|||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`c` char(10) character set utf8 default NULL,
|
`c` char(10) character set utf8 default NULL,
|
||||||
UNIQUE KEY `a` (`c`(1))
|
UNIQUE KEY `a` TYPE HASH (`c`(1))
|
||||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||||
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
|
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
|
||||||
insert into t1 values ('aa');
|
insert into t1 values ('aa');
|
||||||
@@ -570,7 +570,7 @@ show create table t1;
|
|||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`c` char(10) character set utf8 collate utf8_bin default NULL,
|
`c` char(10) character set utf8 collate utf8_bin default NULL,
|
||||||
UNIQUE KEY `a` (`c`(1))
|
UNIQUE KEY `a` TYPE HASH (`c`(1))
|
||||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||||
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
|
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
|
||||||
insert into t1 values ('aa');
|
insert into t1 values ('aa');
|
||||||
|
@@ -405,3 +405,73 @@ where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
|
|||||||
delete from mysql.db
|
delete from mysql.db
|
||||||
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
|
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
|
||||||
flush privileges;
|
flush privileges;
|
||||||
|
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`i` int(11) default NULL,
|
||||||
|
KEY `i` (`i`)
|
||||||
|
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`i` int(11) default NULL,
|
||||||
|
KEY `i` TYPE HASH (`i`)
|
||||||
|
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`i` int(11) default NULL,
|
||||||
|
KEY `i` TYPE BTREE (`i`)
|
||||||
|
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`i` int(11) default NULL,
|
||||||
|
KEY `i` (`i`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`i` int(11) default NULL,
|
||||||
|
KEY `i` TYPE BTREE (`i`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`i` int(11) default NULL,
|
||||||
|
KEY `i` (`i`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
ALTER TABLE t1 ENGINE=MEMORY;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`i` int(11) default NULL,
|
||||||
|
KEY `i` (`i`)
|
||||||
|
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`i` int(11) default NULL,
|
||||||
|
KEY `i` TYPE BTREE (`i`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
ALTER TABLE t1 ENGINE=MEMORY;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`i` int(11) default NULL,
|
||||||
|
KEY `i` TYPE BTREE (`i`)
|
||||||
|
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
@@ -179,3 +179,18 @@ f
|
|||||||
9.999
|
9.999
|
||||||
9.999
|
9.999
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
|
create table t1 (c char(20));
|
||||||
|
insert into t1 values (5e-28);
|
||||||
|
select * from t1;
|
||||||
|
c
|
||||||
|
5e-28
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (c char(6));
|
||||||
|
insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
|
||||||
|
select * from t1;
|
||||||
|
c
|
||||||
|
200000
|
||||||
|
2e+06
|
||||||
|
0.0002
|
||||||
|
2e-05
|
||||||
|
drop table t1;
|
||||||
|
@@ -179,3 +179,18 @@ f
|
|||||||
9.999
|
9.999
|
||||||
9.999
|
9.999
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
|
create table t1 (c char(20));
|
||||||
|
insert into t1 values (5e-28);
|
||||||
|
select * from t1;
|
||||||
|
c
|
||||||
|
5e-28
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (c char(6));
|
||||||
|
insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
|
||||||
|
select * from t1;
|
||||||
|
c
|
||||||
|
200000
|
||||||
|
2e+06
|
||||||
|
0.0002
|
||||||
|
2e-05
|
||||||
|
drop table t1;
|
||||||
|
@@ -321,3 +321,35 @@ flush privileges;
|
|||||||
#--replace_column 7 # 8 # 9 #
|
#--replace_column 7 # 8 # 9 #
|
||||||
#show table status from `<60>` LIKE '<27>';
|
#show table status from `<60>` LIKE '<27>';
|
||||||
#drop database `<60>`;
|
#drop database `<60>`;
|
||||||
|
|
||||||
|
# Test that USING <keytype> is always shown in SHOW CREATE TABLE when it was
|
||||||
|
# specified during table creation, but not otherwise. (Bug #7235)
|
||||||
|
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
# Test that when an index is created with the default key algorithm and
|
||||||
|
# altered to another storage engine, it gets the default key algorithm
|
||||||
|
# for that storage engine, but when it is specified, the specified type is
|
||||||
|
# preserved.
|
||||||
|
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
ALTER TABLE t1 ENGINE=MEMORY;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
ALTER TABLE t1 ENGINE=MEMORY;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
@@ -103,3 +103,13 @@ create table t1 (f double(4,3));
|
|||||||
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
|
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
|
||||||
select * from t1;
|
select * from t1;
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
|
|
||||||
|
# Check conversion of floats to character field (Bug #7774)
|
||||||
|
create table t1 (c char(20));
|
||||||
|
insert into t1 values (5e-28);
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (c char(6));
|
||||||
|
insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
13
sql/field.cc
13
sql/field.cc
@@ -4301,13 +4301,20 @@ int Field_str::store(double nr)
|
|||||||
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
|
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
|
||||||
uint length;
|
uint length;
|
||||||
bool use_scientific_notation= TRUE;
|
bool use_scientific_notation= TRUE;
|
||||||
use_scientific_notation= TRUE;
|
/*
|
||||||
if (field_length < 32 && fabs(nr) < log_10[field_length]-1)
|
Check fabs(nr) against longest value that can be stored in field,
|
||||||
|
which depends on whether the value is < 1 or not, and negative or not
|
||||||
|
*/
|
||||||
|
double anr= fabs(nr);
|
||||||
|
int neg= (nr < 0.0) ? 1 : 0;
|
||||||
|
if (field_length > 4 && field_length < 32 &&
|
||||||
|
(anr < 1.0 ? anr > 1/(log_10[max(0,field_length-neg-2)]) /* -2 for "0." */
|
||||||
|
: anr < log_10[field_length-neg]-1))
|
||||||
use_scientific_notation= FALSE;
|
use_scientific_notation= FALSE;
|
||||||
|
|
||||||
length= (uint) my_sprintf(buff, (buff, "%-.*g",
|
length= (uint) my_sprintf(buff, (buff, "%-.*g",
|
||||||
(use_scientific_notation ?
|
(use_scientific_notation ?
|
||||||
max(0, (int)field_length-5) :
|
max(0, (int)field_length-neg-5) :
|
||||||
field_length),
|
field_length),
|
||||||
nr));
|
nr));
|
||||||
/*
|
/*
|
||||||
|
@@ -165,11 +165,13 @@ bool berkeley_init(void)
|
|||||||
{
|
{
|
||||||
db_env->close(db_env,0); /* purecov: inspected */
|
db_env->close(db_env,0); /* purecov: inspected */
|
||||||
db_env=0; /* purecov: inspected */
|
db_env=0; /* purecov: inspected */
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) hash_init(&bdb_open_tables,system_charset_info,32,0,0,
|
(void) hash_init(&bdb_open_tables,system_charset_info,32,0,0,
|
||||||
(hash_get_key) bdb_get_key,0,0);
|
(hash_get_key) bdb_get_key,0,0);
|
||||||
pthread_mutex_init(&bdb_mutex,MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&bdb_mutex,MY_MUTEX_INIT_FAST);
|
||||||
|
err:
|
||||||
DBUG_RETURN(db_env == 0);
|
DBUG_RETURN(db_env == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5265,7 +5265,9 @@ ha_innobase::store_lock(
|
|||||||
if ((lock_type == TL_READ && thd->in_lock_tables) ||
|
if ((lock_type == TL_READ && thd->in_lock_tables) ||
|
||||||
(lock_type == TL_READ_HIGH_PRIORITY && thd->in_lock_tables) ||
|
(lock_type == TL_READ_HIGH_PRIORITY && thd->in_lock_tables) ||
|
||||||
lock_type == TL_READ_WITH_SHARED_LOCKS ||
|
lock_type == TL_READ_WITH_SHARED_LOCKS ||
|
||||||
lock_type == TL_READ_NO_INSERT) {
|
lock_type == TL_READ_NO_INSERT ||
|
||||||
|
thd->lex->sql_command != SQLCOM_SELECT) {
|
||||||
|
|
||||||
/* The OR cases above are in this order:
|
/* The OR cases above are in this order:
|
||||||
1) MySQL is doing LOCK TABLES ... READ LOCAL, or
|
1) MySQL is doing LOCK TABLES ... READ LOCAL, or
|
||||||
2) (we do not know when TL_READ_HIGH_PRIORITY is used), or
|
2) (we do not know when TL_READ_HIGH_PRIORITY is used), or
|
||||||
@@ -5273,7 +5275,10 @@ ha_innobase::store_lock(
|
|||||||
4) we are doing a complex SQL statement like
|
4) we are doing a complex SQL statement like
|
||||||
INSERT INTO ... SELECT ... and the logical logging (MySQL
|
INSERT INTO ... SELECT ... and the logical logging (MySQL
|
||||||
binlog) requires the use of a locking read, or
|
binlog) requires the use of a locking read, or
|
||||||
MySQL is doing LOCK TABLES ... READ. */
|
MySQL is doing LOCK TABLES ... READ.
|
||||||
|
5) we let InnoDB do locking reads for all SQL statements that
|
||||||
|
are not simple SELECTs; note that select_lock_type in this
|
||||||
|
case may get strengthened in ::external_lock() to LOCK_X. */
|
||||||
|
|
||||||
prebuilt->select_lock_type = LOCK_S;
|
prebuilt->select_lock_type = LOCK_S;
|
||||||
prebuilt->stored_select_lock_type = LOCK_S;
|
prebuilt->stored_select_lock_type = LOCK_S;
|
||||||
|
@@ -1404,14 +1404,18 @@ store_create_info(THD *thd, TABLE *table, String *packet)
|
|||||||
if (!(thd->variables.sql_mode & MODE_NO_KEY_OPTIONS) &&
|
if (!(thd->variables.sql_mode & MODE_NO_KEY_OPTIONS) &&
|
||||||
!limited_mysql_mode && !foreign_db_mode)
|
!limited_mysql_mode && !foreign_db_mode)
|
||||||
{
|
{
|
||||||
if (table->db_type == DB_TYPE_HEAP &&
|
if (key_info->algorithm == HA_KEY_ALG_BTREE)
|
||||||
key_info->algorithm == HA_KEY_ALG_BTREE)
|
|
||||||
packet->append(" TYPE BTREE", 11);
|
packet->append(" TYPE BTREE", 11);
|
||||||
|
|
||||||
|
if (key_info->algorithm == HA_KEY_ALG_HASH)
|
||||||
|
packet->append(" TYPE HASH", 10);
|
||||||
|
|
||||||
// +BAR: send USING only in non-default case: non-spatial rtree
|
// +BAR: send USING only in non-default case: non-spatial rtree
|
||||||
if ((key_info->algorithm == HA_KEY_ALG_RTREE) &&
|
if ((key_info->algorithm == HA_KEY_ALG_RTREE) &&
|
||||||
!(key_info->flags & HA_SPATIAL))
|
!(key_info->flags & HA_SPATIAL))
|
||||||
packet->append(" TYPE RTREE", 11);
|
packet->append(" TYPE RTREE", 11);
|
||||||
|
|
||||||
|
// No need to send TYPE FULLTEXT, it is sent as FULLTEXT KEY
|
||||||
}
|
}
|
||||||
packet->append(" (", 2);
|
packet->append(" (", 2);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user