Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
2204baa5
Commit
2204baa5
authored
Jan 14, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
parents
249f914c
dcd75689
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
184 additions
and
18 deletions
+184
-18
innobase/os/os0file.c
innobase/os/os0file.c
+15
-9
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+2
-2
mysql-test/r/show_check.result
mysql-test/r/show_check.result
+70
-0
mysql-test/r/type_float.result
mysql-test/r/type_float.result
+15
-0
mysql-test/r/type_float.result.es
mysql-test/r/type_float.result.es
+15
-0
mysql-test/t/show_check.test
mysql-test/t/show_check.test
+32
-0
mysql-test/t/type_float.test
mysql-test/t/type_float.test
+10
-0
sql/field.cc
sql/field.cc
+10
-3
sql/ha_berkeley.cc
sql/ha_berkeley.cc
+2
-0
sql/ha_innodb.cc
sql/ha_innodb.cc
+7
-2
sql/sql_show.cc
sql/sql_show.cc
+6
-2
No files found.
innobase/os/os0file.c
View file @
2204baa5
...
@@ -486,7 +486,7 @@ os_io_init_simple(void)
...
@@ -486,7 +486,7 @@ os_io_init_simple(void)
}
}
}
}
#if
ndef 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
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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
);
...
...
mysql-test/r/ctype_utf8.result
View file @
2204baa5
...
@@ -412,7 +412,7 @@ show create table t1;
...
@@ -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;
...
@@ -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');
...
...
mysql-test/r/show_check.result
View file @
2204baa5
...
@@ -405,3 +405,73 @@ where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
...
@@ -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;
mysql-test/r/type_float.result
View file @
2204baa5
...
@@ -179,3 +179,18 @@ f
...
@@ -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;
mysql-test/r/type_float.result.es
View file @
2204baa5
...
@@ -179,3 +179,18 @@ f
...
@@ -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;
mysql-test/t/show_check.test
View file @
2204baa5
...
@@ -321,3 +321,35 @@ flush privileges;
...
@@ -321,3 +321,35 @@ flush privileges;
#--replace_column 7 # 8 # 9 #
#--replace_column 7 # 8 # 9 #
#show table status from `` LIKE '';
#show table status from `` LIKE '';
#drop database ``;
#drop database ``;
# 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
;
mysql-test/t/type_float.test
View file @
2204baa5
...
@@ -103,3 +103,13 @@ create table t1 (f double(4,3));
...
@@ -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
(
5
e
-
28
);
select
*
from
t1
;
drop
table
t1
;
create
table
t1
(
c
char
(
6
));
insert
into
t1
values
(
2
e5
),(
2
e6
),(
2
e
-
4
),(
2
e
-
5
);
select
*
from
t1
;
drop
table
t1
;
sql/field.cc
View file @
2204baa5
...
@@ -4301,13 +4301,20 @@ int Field_str::store(double nr)
...
@@ -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
));
/*
/*
...
...
sql/ha_berkeley.cc
View file @
2204baa5
...
@@ -165,11 +165,13 @@ bool berkeley_init(void)
...
@@ -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
);
}
}
...
...
sql/ha_innodb.cc
View file @
2204baa5
...
@@ -5265,7 +5265,9 @@ ha_innobase::store_lock(
...
@@ -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(
...
@@ -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
;
...
...
sql/sql_show.cc
View file @
2204baa5
...
@@ -1404,14 +1404,18 @@ store_create_info(THD *thd, TABLE *table, String *packet)
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment