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
8c192e2d
Commit
8c192e2d
authored
Oct 03, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge neptunus.(none):/home/msvensson/mysql/mysql-4.1
into neptunus.(none):/home/msvensson/mysql/mysql-4.1-maint
parents
9076d70e
c71ecd92
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
287 additions
and
97 deletions
+287
-97
client/mysql.cc
client/mysql.cc
+2
-2
include/m_ctype.h
include/m_ctype.h
+3
-2
include/m_string.h
include/m_string.h
+2
-1
include/my_global.h
include/my_global.h
+30
-2
include/my_sys.h
include/my_sys.h
+2
-2
mysql-test/r/analyse.result
mysql-test/r/analyse.result
+13
-0
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+12
-0
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+12
-0
mysql-test/r/type_float.result
mysql-test/r/type_float.result
+7
-0
mysql-test/t/analyse.test
mysql-test/t/analyse.test
+13
-1
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8.test
+11
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+19
-0
mysql-test/t/lowercase_fs_off.test
mysql-test/t/lowercase_fs_off.test
+1
-0
mysql-test/t/type_float.test
mysql-test/t/type_float.test
+10
-1
ndb/config/common.mk.am
ndb/config/common.mk.am
+1
-1
ndb/config/type_ndbapitools.mk.am
ndb/config/type_ndbapitools.mk.am
+1
-1
ndb/src/common/portlib/Makefile.am
ndb/src/common/portlib/Makefile.am
+2
-1
ndb/src/kernel/Makefile.am
ndb/src/kernel/Makefile.am
+2
-1
sql/Makefile.am
sql/Makefile.am
+6
-2
sql/item_strfunc.cc
sql/item_strfunc.cc
+2
-1
sql/item_subselect.cc
sql/item_subselect.cc
+1
-1
sql/item_timefunc.cc
sql/item_timefunc.cc
+2
-2
sql/mysql_priv.h
sql/mysql_priv.h
+6
-5
sql/mysqld.cc
sql/mysqld.cc
+12
-11
sql/opt_range.cc
sql/opt_range.cc
+4
-3
sql/set_var.cc
sql/set_var.cc
+6
-6
sql/slave.cc
sql/slave.cc
+1
-1
sql/slave.h
sql/slave.h
+2
-1
sql/sql_acl.cc
sql/sql_acl.cc
+2
-2
sql/sql_analyse.cc
sql/sql_analyse.cc
+4
-4
sql/sql_class.h
sql/sql_class.h
+1
-1
sql/sql_string.cc
sql/sql_string.cc
+6
-1
sql/stacktrace.c
sql/stacktrace.c
+40
-15
sql/stacktrace.h
sql/stacktrace.h
+6
-2
strings/strtod.c
strings/strtod.c
+43
-24
No files found.
client/mysql.cc
View file @
8c192e2d
...
...
@@ -2629,7 +2629,7 @@ com_connect(String *buffer, char *line)
bzero
(
buff
,
sizeof
(
buff
));
if
(
buffer
)
{
strm
ov
(
buff
,
line
);
strm
ake
(
buff
,
line
,
sizeof
(
buff
)
-
1
);
tmp
=
get_arg
(
buff
,
0
);
if
(
tmp
&&
*
tmp
)
{
...
...
@@ -2743,7 +2743,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
char
*
tmp
,
buff
[
FN_REFLEN
+
1
];
bzero
(
buff
,
sizeof
(
buff
));
strm
ov
(
buff
,
line
);
strm
ake
(
buff
,
line
,
sizeof
(
buff
)
-
1
);
tmp
=
get_arg
(
buff
,
0
);
if
(
!
tmp
||
!*
tmp
)
{
...
...
include/m_ctype.h
View file @
8c192e2d
...
...
@@ -175,7 +175,7 @@ typedef struct my_charset_handler_st
/* Charset dependant snprintf() */
int
(
*
snprintf
)(
struct
charset_info_st
*
,
char
*
to
,
uint
n
,
const
char
*
fmt
,
...);
...)
ATTRIBUTE_FORMAT
(
printf
,
4
,
5
)
;
int
(
*
long10_to_str
)(
struct
charset_info_st
*
,
char
*
to
,
uint
n
,
int
radix
,
long
int
val
);
int
(
*
longlong10_to_str
)(
struct
charset_info_st
*
,
char
*
to
,
uint
n
,
...
...
@@ -300,7 +300,8 @@ int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
ulong
my_scan_8bit
(
CHARSET_INFO
*
cs
,
const
char
*
b
,
const
char
*
e
,
int
sq
);
int
my_snprintf_8bit
(
struct
charset_info_st
*
,
char
*
to
,
uint
n
,
const
char
*
fmt
,
...);
const
char
*
fmt
,
...)
ATTRIBUTE_FORMAT
(
printf
,
4
,
5
);
long
my_strntol_8bit
(
CHARSET_INFO
*
,
const
char
*
s
,
uint
l
,
int
base
,
char
**
e
,
int
*
err
);
...
...
include/m_string.h
View file @
8c192e2d
...
...
@@ -247,7 +247,8 @@ extern ulonglong strtoull(const char *str, char **ptr, int base);
extern
int
my_vsnprintf
(
char
*
str
,
size_t
n
,
const
char
*
format
,
va_list
ap
);
extern
int
my_snprintf
(
char
*
to
,
size_t
n
,
const
char
*
fmt
,
...);
extern
int
my_snprintf
(
char
*
to
,
size_t
n
,
const
char
*
fmt
,
...)
ATTRIBUTE_FORMAT
(
printf
,
3
,
4
);
#if defined(__cplusplus) && !defined(OS2)
}
...
...
include/my_global.h
View file @
8c192e2d
...
...
@@ -414,12 +414,40 @@ typedef unsigned short ushort;
#define function_volatile volatile
#define my_reinterpret_cast(A) reinterpret_cast<A>
#define my_const_cast(A) const_cast<A>
# ifndef GCC_VERSION
# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
# endif
#elif !defined(my_reinterpret_cast)
#define my_reinterpret_cast(A) (A)
#define my_const_cast(A) (A)
#endif
#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
#define __attribute__(A)
/*
Disable __attribute__() on gcc < 2.7, g++ < 3.4, and non-gcc compilers.
Some forms of __attribute__ are actually supported in earlier versions of
g++, but we just disable them all because we only use them to generate
compilation warnings.
*/
#ifndef __attribute__
# if !defined(__GNUC__)
# define __attribute__(A)
# elif defined (__QNXNTO__)
/* qcc defines GNUC */
# define __attribute__(A)
# elif GCC_VERSION < 2008
# define __attribute__(A)
# elif defined(__cplusplus) && GCC_VERSION < 3004
# define __attribute__(A)
# endif
#endif
/*
__attribute__((format(...))) is only supported in gcc >= 2.8 and g++ >= 3.4
But that's already covered by the __attribute__ tests above, so this is
just a convenience macro.
*/
#ifndef ATTRIBUTE_FORMAT
# define ATTRIBUTE_FORMAT(style, m, n) __attribute__((format(style, m, n)))
#endif
/* From old s-system.h */
...
...
include/my_sys.h
View file @
8c192e2d
...
...
@@ -588,8 +588,8 @@ extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
extern
int
my_sync
(
File
fd
,
myf
my_flags
);
extern
int
my_error
_VARARGS
((
int
nr
,
myf
MyFlags
,
...));
extern
int
my_printf_error
_VARARGS
((
uint
my_err
,
const
char
*
format
,
myf
MyFlags
,
...)
__attribute__
((
format
(
printf
,
2
,
4
)))
);
myf
MyFlags
,
...)
)
ATTRIBUTE_FORMAT
(
printf
,
2
,
4
);
extern
int
my_message
(
uint
my_err
,
const
char
*
str
,
myf
MyFlags
);
extern
int
my_message_no_curses
(
uint
my_err
,
const
char
*
str
,
myf
MyFlags
);
extern
int
my_message_curses
(
uint
my_err
,
const
char
*
str
,
myf
MyFlags
);
...
...
mysql-test/r/analyse.result
View file @
8c192e2d
...
...
@@ -134,3 +134,16 @@ test.t1.product Computer TV 2 8 0 0 4.2500 NULL ENUM('Computer','Phone','TV') NO
sum(profit) 10 6900 2 4 0 0 1946 2868 ENUM('10','275','600','6900') NOT NULL
avg(profit) 10.0000 1380.0000 7 9 0 0 394.6875 570.2003 ENUM('10.0000','68.7500','120.0000','1380.0000') NOT NULL
drop table t1,t2;
create table t1 (f1 double(10,5), f2 char(10), f3 double(10,5));
insert into t1 values (5.999, "5.9999", 5.99999), (9.555, "9.5555", 9.55555);
select f1 from t1 procedure analyse(1, 1);
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.f1 5.99900 9.55500 7 7 0 0 7.77700 1.77800 FLOAT(4,3) NOT NULL
select f2 from t1 procedure analyse(1, 1);
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.f2 5.9999 9.5555 6 6 0 0 6.0000 NULL FLOAT(5,4) UNSIGNED NOT NULL
select f3 from t1 procedure analyse(1, 1);
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.f3 5.99999 9.55555 7 7 0 0 7.77777 1.77778 FLOAT(6,5) NOT NULL
drop table t1;
End of 4.1 tests
mysql-test/r/ctype_utf8.result
View file @
8c192e2d
...
...
@@ -1340,3 +1340,15 @@ select a from t1 group by a;
a
e
drop table t1;
create table t1(a char(10)) default charset utf8;
insert into t1 values ('123'), ('456');
explain
select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Y ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
1 SIMPLE Z ALL NULL NULL NULL NULL 2 Using where
select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
substr(Z.a,-1) a
3 123
6 456
drop table t1;
mysql-test/r/func_time.result
View file @
8c192e2d
...
...
@@ -694,6 +694,18 @@ t1 CREATE TABLE `t1` (
`from_unixtime(1) + 0` double(23,6) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
SET NAMES latin1;
SET character_set_results = NULL;
SHOW VARIABLES LIKE 'character_set_results';
Variable_name Value
character_set_results
CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
fmtddate field2
Sep-4 12:00AM abcd
DROP TABLE testBug8868;
SET NAMES DEFAULT;
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
...
...
mysql-test/r/type_float.result
View file @
8c192e2d
...
...
@@ -272,3 +272,10 @@ desc t3;
Field Type Null Key Default Extra
a double 0
drop table t1,t2,t3;
select 1e-308, 1.00000001e-300, 100000000e-300;
1e-308 1.00000001e-300 100000000e-300
0 1.00000001e-300 1e-292
select 10e307;
10e307
1e+308
End of 4.1 tests
mysql-test/t/analyse.test
View file @
8c192e2d
...
...
@@ -82,4 +82,16 @@ create table t2 (country_id int primary key, country char(20) not null);
insert
into
t2
values
(
1
,
'USA'
),(
2
,
'India'
),
(
3
,
'Finland'
);
select
product
,
sum
(
profit
),
avg
(
profit
)
from
t1
group
by
product
with
rollup
procedure
analyse
();
drop
table
t1
,
t2
;
# End of 4.1 tests
#
# Bug #20305 PROCEDURE ANALYSE() returns wrong M for FLOAT(M, D) and DOUBLE(M, D)
#
create
table
t1
(
f1
double
(
10
,
5
),
f2
char
(
10
),
f3
double
(
10
,
5
));
insert
into
t1
values
(
5.999
,
"5.9999"
,
5.99999
),
(
9.555
,
"9.5555"
,
9.55555
);
select
f1
from
t1
procedure
analyse
(
1
,
1
);
select
f2
from
t1
procedure
analyse
(
1
,
1
);
select
f3
from
t1
procedure
analyse
(
1
,
1
);
drop
table
t1
;
--
echo
End
of
4.1
tests
mysql-test/t/ctype_utf8.test
View file @
8c192e2d
...
...
@@ -1072,4 +1072,15 @@ explain select a from t1 group by a;
select
a
from
t1
group
by
a
;
drop
table
t1
;
#
# Bug #20204: "order by" changes the results returned
#
create
table
t1
(
a
char
(
10
))
default
charset
utf8
;
insert
into
t1
values
(
'123'
),
(
'456'
);
explain
select
substr
(
Z
.
a
,
-
1
),
Z
.
a
from
t1
as
Y
join
t1
as
Z
on
Y
.
a
=
Z
.
a
order
by
1
;
select
substr
(
Z
.
a
,
-
1
),
Z
.
a
from
t1
as
Y
join
t1
as
Z
on
Y
.
a
=
Z
.
a
order
by
1
;
drop
table
t1
;
# End of 4.1 tests
mysql-test/t/func_time.test
View file @
8c192e2d
...
...
@@ -368,6 +368,25 @@ create table t1 select now() - now(), curtime() - curtime(),
show
create
table
t1
;
drop
table
t1
;
#
# 21913: DATE_FORMAT() Crashes mysql server if I use it through
# mysql-connector-j driver.
#
SET
NAMES
latin1
;
SET
character_set_results
=
NULL
;
SHOW
VARIABLES
LIKE
'character_set_results'
;
CREATE
TABLE
testBug8868
(
field1
DATE
,
field2
VARCHAR
(
32
)
CHARACTER
SET
BINARY
);
INSERT
INTO
testBug8868
VALUES
(
'2006-09-04'
,
'abcd'
);
SELECT
DATE_FORMAT
(
field1
,
'%b-%e %l:%i%p'
)
as
fmtddate
,
field2
FROM
testBug8868
;
DROP
TABLE
testBug8868
;
SET
NAMES
DEFAULT
;
#
# Bug #19844 time_format in Union truncates values
#
...
...
mysql-test/t/lowercase_fs_off.test
View file @
8c192e2d
...
...
@@ -3,6 +3,7 @@
# i.e. lower_case_filesystem=OFF
#
--
source
include
/
have_case_sensitive_file_system
.
inc
--
source
include
/
not_embedded
.
inc
connect
(
master
,
localhost
,
root
,,);
connection
master
;
...
...
mysql-test/t/type_float.test
View file @
8c192e2d
...
...
@@ -179,4 +179,13 @@ show warnings;
desc
t3
;
drop
table
t1
,
t2
,
t3
;
# End of 4.1 tests
#
# Bug #22129: A small double precision number becomes zero
#
# check if underflows are detected correctly
select
1
e
-
308
,
1.00000001e-300
,
100000000
e
-
300
;
# check if overflows are detected correctly
select
10
e307
;
--
echo
End
of
4.1
tests
ndb/config/common.mk.am
View file @
8c192e2d
...
...
@@ -7,6 +7,6 @@ ndbapiincludedir = "$(pkgincludedir)/ndb/ndbapi"
mgmapiincludedir = "$(pkgincludedir)/ndb/mgmapi"
INCLUDES = $(INCLUDES_LOC)
LDADD = $(
top_srcdir)/ndb/src/common/portlib/gcc.cpp $(LDADD_LOC)
LDADD = $(
LDADD_LOC) -L$(top_srcdir)/ndb/src/common/portlib -lmygcc
DEFS = @DEFS@ @NDB_DEFS@ $(DEFS_LOC) $(NDB_EXTRA_FLAGS)
NDB_CXXFLAGS=@ndb_cxxflags_fix@ $(NDB_CXXFLAGS_LOC)
ndb/config/type_ndbapitools.mk.am
View file @
8c192e2d
...
...
@@ -3,7 +3,7 @@ LDADD += \
$(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
$(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
-lmygcc
INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \
-I$(top_srcdir)/ndb/include \
...
...
ndb/src/common/portlib/Makefile.am
View file @
8c192e2d
noinst_HEADERS
=
gcc.cpp
noinst_LIBRARIES
=
libmygcc.a
libmygcc_a_SOURCES
=
gcc.cpp
noinst_LTLIBRARIES
=
libportlib.la
...
...
ndb/src/kernel/Makefile.am
View file @
8c192e2d
...
...
@@ -53,7 +53,8 @@ LDADD += \
$(top_builddir)
/ndb/src/common/util/libgeneral.la
\
$(top_builddir)
/dbug/libdbug.a
\
$(top_builddir)
/mysys/libmysys.a
\
$(top_builddir)
/strings/libmystrings.a @NDB_SCI_LIBS@
$(top_builddir)
/strings/libmystrings.a @NDB_SCI_LIBS@
-lmygcc
# Don't update the files from bitkeeper
%
::
SCCS/s.%
...
...
sql/Makefile.am
View file @
8c192e2d
...
...
@@ -26,7 +26,7 @@ INCLUDES = @MT_INCLUDES@ @ZLIB_INCLUDES@ \
WRAPLIBS
=
@WRAPLIBS@
SUBDIRS
=
share
libexec_PROGRAMS
=
mysqld
noinst
_PROGRAMS
=
gen_lex_hash
EXTRA
_PROGRAMS
=
gen_lex_hash
bin_PROGRAMS
=
mysql_tzinfo_to_sql
gen_lex_hash_LDFLAGS
=
@NOINST_LDFLAGS@
LDADD
=
@isam_libs@
\
...
...
@@ -137,7 +137,11 @@ sql_yacc.o: sql_yacc.cc sql_yacc.h $(HEADERS)
@
echo
"If it fails, re-run configure with --with-low-memory"
$(CXXCOMPILE)
$(LM_CFLAGS)
-c
$<
lex_hash.h
:
gen_lex_hash$(EXEEXT)
# This generates lex_hash.h
# NOTE Built sources should depend on their sources not the tool
# this avoid the rebuild of the built files in a source dist
lex_hash.h
:
gen_lex_hash.cc lex.h
$(MAKE)
$(AM_MAKEFLAGS)
gen_lex_hash
$(EXEEXT)
./gen_lex_hash
$(EXEEXT)
>
$@
# For testing of udf_example.so; Works on platforms with gcc
...
...
sql/item_strfunc.cc
View file @
8c192e2d
...
...
@@ -1109,12 +1109,13 @@ void Item_func_substr::fix_length_and_dec()
}
if
(
arg_count
==
3
&&
args
[
2
]
->
const_item
())
{
int32
length
=
(
int32
)
args
[
2
]
->
val_int
()
*
collation
.
collation
->
mbmaxlen
;
int32
length
=
(
int32
)
args
[
2
]
->
val_int
();
if
(
length
<=
0
)
max_length
=
0
;
/* purecov: inspected */
else
set_if_smaller
(
max_length
,(
uint
)
length
);
}
max_length
*=
collation
.
collation
->
mbmaxlen
;
}
...
...
sql/item_subselect.cc
View file @
8c192e2d
...
...
@@ -545,7 +545,7 @@ Item_allany_subselect::Item_allany_subselect(Item * left_exp,
chooser_compare_func_creator
fc
,
st_select_lex
*
select_lex
,
bool
all_arg
)
:
Item_in_subselect
(),
all
(
all_arg
),
func_creator
(
fc
)
:
Item_in_subselect
(),
func_creator
(
fc
),
all
(
all_arg
)
{
DBUG_ENTER
(
"Item_in_subselect::Item_in_subselect"
);
left_expr
=
left_exp
;
...
...
sql/item_timefunc.cc
View file @
8c192e2d
...
...
@@ -65,7 +65,7 @@ static bool make_datetime(date_time_format_types format, TIME *ltime,
ltime
->
hour
,
ltime
->
minute
,
ltime
->
second
);
break
;
case
TIME_MICROSECOND
:
length
=
cs
->
cset
->
snprintf
(
cs
,
buff
,
length
,
"%s%02d:%02d:%02d.%06d"
,
length
=
cs
->
cset
->
snprintf
(
cs
,
buff
,
length
,
"%s%02d:%02d:%02d.%06
l
d"
,
ltime
->
neg
?
"-"
:
""
,
ltime
->
hour
,
ltime
->
minute
,
ltime
->
second
,
ltime
->
second_part
);
...
...
@@ -82,7 +82,7 @@ static bool make_datetime(date_time_format_types format, TIME *ltime,
break
;
case
DATE_TIME_MICROSECOND
:
length
=
cs
->
cset
->
snprintf
(
cs
,
buff
,
length
,
"%04d-%02d-%02d %02d:%02d:%02d.%06d"
,
"%04d-%02d-%02d %02d:%02d:%02d.%06
l
d"
,
ltime
->
year
,
ltime
->
month
,
ltime
->
day
,
ltime
->
hour
,
ltime
->
minute
,
ltime
->
second
,
ltime
->
second_part
);
...
...
sql/mysql_priv.h
View file @
8c192e2d
...
...
@@ -713,7 +713,8 @@ void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length);
MYSQL_ERROR
*
push_warning
(
THD
*
thd
,
MYSQL_ERROR
::
enum_warning_level
level
,
uint
code
,
const
char
*
msg
);
void
push_warning_printf
(
THD
*
thd
,
MYSQL_ERROR
::
enum_warning_level
level
,
uint
code
,
const
char
*
format
,
...);
uint
code
,
const
char
*
format
,
...)
ATTRIBUTE_FORMAT
(
printf
,
4
,
5
);
void
mysql_reset_errors
(
THD
*
thd
);
my_bool
mysqld_show_warnings
(
THD
*
thd
,
ulong
levels_to_show
);
...
...
@@ -848,10 +849,10 @@ bool init_errmessage(void);
void
sql_perror
(
const
char
*
message
);
void
vprint_msg_to_log
(
enum
loglevel
level
,
const
char
*
format
,
va_list
args
);
void
sql_print_error
(
const
char
*
format
,
...);
void
sql_print_warning
(
const
char
*
format
,
...);
void
sql_print_information
(
const
char
*
format
,
...)
;
void
sql_print_error
(
const
char
*
format
,
...)
ATTRIBUTE_FORMAT
(
printf
,
1
,
2
)
;
void
sql_print_warning
(
const
char
*
format
,
...)
ATTRIBUTE_FORMAT
(
printf
,
1
,
2
)
;
void
sql_print_information
(
const
char
*
format
,
...)
ATTRIBUTE_FORMAT
(
printf
,
1
,
2
);
bool
fn_format_relative_to_data_home
(
my_string
to
,
const
char
*
name
,
...
...
sql/mysqld.cc
View file @
8c192e2d
...
...
@@ -953,8 +953,8 @@ extern "C" sig_handler print_signal_warning(int sig)
if
(
!
DBUG_IN_USE
)
{
if
(
global_system_variables
.
log_warnings
)
sql_print_warning
(
"Got signal %d from thread %d"
,
sig
,
my_thread_id
());
sql_print_warning
(
"Got signal %d from thread %
l
d"
,
sig
,
my_thread_id
());
}
#ifdef DONT_REMEMBER_SIGNAL
my_sigset
(
sig
,
print_signal_warning
);
/* int. thread system calls */
...
...
@@ -1444,8 +1444,8 @@ static void server_init(void)
if
(
strlen
(
mysqld_unix_port
)
>
(
sizeof
(
UNIXaddr
.
sun_path
)
-
1
))
{
sql_print_error
(
"The socket file path is too long (> %
d
): %s"
,
sizeof
(
UNIXaddr
.
sun_path
)
-
1
,
mysqld_unix_port
);
sql_print_error
(
"The socket file path is too long (> %
lu
): %s"
,
sizeof
(
UNIXaddr
.
sun_path
)
-
1
,
mysqld_unix_port
);
unireg_abort
(
1
);
}
if
((
unix_sock
=
socket
(
AF_UNIX
,
SOCK_STREAM
,
0
))
<
0
)
...
...
@@ -2787,9 +2787,9 @@ static void openssl_lock(int mode, openssl_lock_t *lock, const char *file,
sql_print_error
(
"Fatal: OpenSSL interface problem (mode=0x%x)"
,
mode
);
abort
();
}
if
(
err
)
if
(
err
)
{
sql_print_error
(
"Fatal: can't %s OpenSSL
%s
lock"
,
what
);
sql_print_error
(
"Fatal: can't %s OpenSSL lock"
,
what
);
abort
();
}
}
...
...
@@ -6551,14 +6551,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
exit
(
1
);
}
switch
(
method
-
1
)
{
case
0
:
method_conv
=
MI_STATS_METHOD_
NULLS_EQUAL
;
case
2
:
method_conv
=
MI_STATS_METHOD_
IGNORE_NULLS
;
break
;
case
1
:
method_conv
=
MI_STATS_METHOD_NULLS_
NOT_
EQUAL
;
method_conv
=
MI_STATS_METHOD_NULLS_EQUAL
;
break
;
case
2
:
method_conv
=
MI_STATS_METHOD_IGNORE_NULLS
;
case
0
:
default:
method_conv
=
MI_STATS_METHOD_NULLS_NOT_EQUAL
;
break
;
}
global_system_variables
.
myisam_stats_method
=
method_conv
;
...
...
sql/opt_range.cc
View file @
8c192e2d
...
...
@@ -2513,8 +2513,9 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
ulong
count
=
count_key_part_usage
(
root
,
pos
->
next_key_part
);
if
(
count
>
pos
->
next_key_part
->
use_count
)
{
sql_print_information
(
"Use_count: Wrong count for key at %lx, %lu should be %lu"
,
pos
,
pos
->
next_key_part
->
use_count
,
count
);
sql_print_information
(
"Use_count: Wrong count for key at %lx, %lu "
"should be %lu"
,
(
long
unsigned
int
)
pos
,
pos
->
next_key_part
->
use_count
,
count
);
return
;
}
pos
->
next_key_part
->
test_use_count
(
root
);
...
...
@@ -2522,7 +2523,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
}
if
(
e_count
!=
elements
)
sql_print_warning
(
"Wrong use count: %u (should be %u) for tree at %lx"
,
e_count
,
elements
,
(
gptr
)
this
);
e_count
,
elements
,
(
long
unsigned
int
)
this
);
}
#endif
...
...
sql/set_var.cc
View file @
8c192e2d
...
...
@@ -1150,14 +1150,14 @@ static void fix_net_retry_count(THD *thd, enum_var_type type)
thd
->
net
.
retry_count
=
thd
->
variables
.
net_retry_count
;
}
#else
/* HAVE_REPLICATION */
static
void
fix_net_read_timeout
(
THD
*
thd
__attribute__
(
unused
),
enum_var_type
type
__attribute__
(
unused
))
static
void
fix_net_read_timeout
(
THD
*
thd
__attribute__
(
(
unused
)
),
enum_var_type
type
__attribute__
(
(
unused
)
))
{}
static
void
fix_net_write_timeout
(
THD
*
thd
__attribute__
(
unused
),
enum_var_type
type
__attribute__
(
unused
))
static
void
fix_net_write_timeout
(
THD
*
thd
__attribute__
(
(
unused
)
),
enum_var_type
type
__attribute__
(
(
unused
)
))
{}
static
void
fix_net_retry_count
(
THD
*
thd
__attribute__
(
unused
),
enum_var_type
type
__attribute__
(
unused
))
static
void
fix_net_retry_count
(
THD
*
thd
__attribute__
(
(
unused
)
),
enum_var_type
type
__attribute__
(
(
unused
)
))
{}
#endif
/* HAVE_REPLICATION */
...
...
sql/slave.cc
View file @
8c192e2d
...
...
@@ -4073,7 +4073,7 @@ static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi,
suppress_warnings
=
0
;
sql_print_error
(
"Slave I/O thread: error %s to master \
'%s@%s:%d': \
Error: '%s' errno: %d retry-time: %d retries: %
d
"
,
Error: '%s' errno: %d retry-time: %d retries: %
lu
"
,
(
reconnect
?
"reconnecting"
:
"connecting"
),
mi
->
user
,
mi
->
host
,
mi
->
port
,
mysql_error
(
mysql
),
last_errno
,
...
...
sql/slave.h
View file @
8c192e2d
...
...
@@ -551,7 +551,8 @@ const char *rewrite_db(const char* db, uint32 *new_db_len);
const
char
*
print_slave_db_safe
(
const
char
*
db
);
int
check_expected_error
(
THD
*
thd
,
RELAY_LOG_INFO
*
rli
,
int
error_code
);
void
skip_load_data_infile
(
NET
*
net
);
void
slave_print_error
(
RELAY_LOG_INFO
*
rli
,
int
err_code
,
const
char
*
msg
,
...);
void
slave_print_error
(
RELAY_LOG_INFO
*
rli
,
int
err_code
,
const
char
*
msg
,
...)
ATTRIBUTE_FORMAT
(
printf
,
3
,
4
);
void
end_slave
();
/* clean up */
void
init_master_info_with_options
(
MASTER_INFO
*
mi
);
...
...
sql/sql_acl.cc
View file @
8c192e2d
...
...
@@ -426,7 +426,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
"case that has been forced to lowercase because "
"lower_case_table_names is set. It will not be "
"possible to remove this privilege using REVOKE."
,
db
.
db
,
db
.
user
,
db
.
host
.
hostname
,
db
.
host
.
hostname
);
db
.
db
,
db
.
user
,
db
.
host
.
hostname
);
}
}
db
.
sort
=
get_sort
(
3
,
db
.
host
.
hostname
,
db
.
db
,
db
.
user
);
...
...
@@ -2778,7 +2778,7 @@ static my_bool grant_load(TABLE_LIST *tables)
sql_print_warning
(
"'tables_priv' entry '%s %s@%s' "
"ignored in --skip-name-resolve mode."
,
mem_check
->
tname
,
mem_check
->
user
,
mem_check
->
host
);
mem_check
->
host
.
hostname
);
continue
;
}
}
...
...
sql/sql_analyse.cc
View file @
8c192e2d
...
...
@@ -709,9 +709,9 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows)
else
if
(
num_info
.
decimals
)
// DOUBLE(%d,%d) sometime
{
if
(
num_info
.
dval
>
-
FLT_MAX
&&
num_info
.
dval
<
FLT_MAX
)
sprintf
(
buff
,
"FLOAT(%d,%d)"
,
num_info
.
integers
,
num_info
.
decimals
);
sprintf
(
buff
,
"FLOAT(%d,%d)"
,
(
num_info
.
integers
+
num_info
.
decimals
)
,
num_info
.
decimals
);
else
sprintf
(
buff
,
"DOUBLE(%d,%d)"
,
num_info
.
integers
,
num_info
.
decimals
);
sprintf
(
buff
,
"DOUBLE(%d,%d)"
,
(
num_info
.
integers
+
num_info
.
decimals
)
,
num_info
.
decimals
);
}
else
if
(
ev_num_info
.
llval
>=
-
128
&&
ev_num_info
.
ullval
<=
...
...
@@ -818,10 +818,10 @@ void field_real::get_opt_type(String *answer,
else
{
if
(
min_arg
>=
-
FLT_MAX
&&
max_arg
<=
FLT_MAX
)
sprintf
(
buff
,
"FLOAT(%d,%d)"
,
(
int
)
max_length
-
(
item
->
decimals
+
1
),
sprintf
(
buff
,
"FLOAT(%d,%d)"
,
(
int
)
max_length
-
(
item
->
decimals
+
1
)
+
max_notzero_dec_len
,
max_notzero_dec_len
);
else
sprintf
(
buff
,
"DOUBLE(%d,%d)"
,
(
int
)
max_length
-
(
item
->
decimals
+
1
),
sprintf
(
buff
,
"DOUBLE(%d,%d)"
,
(
int
)
max_length
-
(
item
->
decimals
+
1
)
+
max_notzero_dec_len
,
max_notzero_dec_len
);
answer
->
append
(
buff
,
(
uint
)
strlen
(
buff
));
}
...
...
sql/sql_class.h
View file @
8c192e2d
...
...
@@ -145,7 +145,7 @@ public:
bool
no_auto_events_arg
,
ulong
max_size
);
void
new_file
(
bool
need_lock
=
1
);
bool
write
(
THD
*
thd
,
enum
enum_server_command
command
,
const
char
*
format
,
...
);
const
char
*
format
,
...)
ATTRIBUTE_FORMAT
(
printf
,
4
,
5
);
bool
write
(
THD
*
thd
,
const
char
*
query
,
uint
query_length
,
time_t
query_start
=
0
);
bool
write
(
Log_event
*
event_info
);
// binary log write
...
...
sql/sql_string.cc
View file @
8c192e2d
...
...
@@ -248,6 +248,10 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
0 No conversion needed
1 Either character set conversion or adding leading zeros
(e.g. for UCS-2) must be done
NOTE
to_cs may be NULL for "no conversion" if the system variable
character_set_results is NULL.
*/
bool
String
::
needs_conversion
(
uint32
arg_length
,
...
...
@@ -256,7 +260,8 @@ bool String::needs_conversion(uint32 arg_length,
uint32
*
offset
)
{
*
offset
=
0
;
if
((
to_cs
==
&
my_charset_bin
)
||
if
(
!
to_cs
||
(
to_cs
==
&
my_charset_bin
)
||
(
to_cs
==
from_cs
)
||
my_charset_same
(
from_cs
,
to_cs
)
||
((
from_cs
==
&
my_charset_bin
)
&&
...
...
sql/stacktrace.c
View file @
8c192e2d
...
...
@@ -21,6 +21,7 @@
#ifdef HAVE_STACKTRACE
#include <unistd.h>
#include <strings.h>
#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end)
...
...
@@ -44,7 +45,29 @@ void safe_print_str(const char* name, const char* val, int max_len)
}
#ifdef TARGET_OS_LINUX
#define SIGRETURN_FRAME_COUNT 2
#ifdef __i386__
#define SIGRETURN_FRAME_OFFSET 17
#endif
#ifdef __x86_64__
#define SIGRETURN_FRAME_OFFSET 23
#endif
static
my_bool
is_nptl
;
/* Check if we are using NPTL or LinuxThreads on Linux */
void
check_thread_lib
(
void
)
{
char
buf
[
5
];
#ifdef _CS_GNU_LIBPTHREAD_VERSION
confstr
(
_CS_GNU_LIBPTHREAD_VERSION
,
buf
,
sizeof
(
buf
));
is_nptl
=
!
strncasecmp
(
buf
,
"NPTL"
,
sizeof
(
buf
));
#else
is_nptl
=
0
;
#endif
}
#if defined(__alpha__) && defined(__GNUC__)
/*
...
...
@@ -90,7 +113,7 @@ inline uint32* find_prev_pc(uint32* pc, uchar** fp)
void
print_stacktrace
(
gptr
stack_bottom
,
ulong
thread_stack
)
{
uchar
**
fp
;
uint
frame_count
=
0
;
uint
frame_count
=
0
,
sigreturn_frame_count
;
#if defined(__alpha__) && defined(__GNUC__)
uint32
*
pc
;
#endif
...
...
@@ -100,28 +123,27 @@ void print_stacktrace(gptr stack_bottom, ulong thread_stack)
Attempting backtrace. You can use the following information to find out
\n
\
where mysqld died. If you see no messages after this, something went
\n
\
terribly wrong...
\n
"
);
#ifdef __i386__
#ifdef __i386__
__asm
__volatile__
(
"movl %%ebp,%0"
:
"=r"
(
fp
)
:
"r"
(
fp
));
if
(
!
fp
)
{
fprintf
(
stderr
,
"frame pointer (ebp) is NULL, did you compile with
\n
\
-fomit-frame-pointer? Aborting backtrace!
\n
"
);
return
;
}
#endif
#ifdef __x86_64__
__asm
__volatile__
(
"movq %%rbp,%0"
:
"=r"
(
fp
)
:
"r"
(
fp
));
#endif
#if defined(__alpha__) && defined(__GNUC__)
__asm
__volatile__
(
"mov $30,%0"
:
"=r"
(
fp
)
:
"r"
(
fp
));
#endif
if
(
!
fp
)
{
fprintf
(
stderr
,
"frame pointer
(fp)
is NULL, did you compile with
\n
\
fprintf
(
stderr
,
"frame pointer is NULL, did you compile with
\n
\
-fomit-frame-pointer? Aborting backtrace!
\n
"
);
return
;
}
#endif
/* __alpha__ */
if
(
!
stack_bottom
||
(
gptr
)
stack_bottom
>
(
gptr
)
&
fp
)
{
...
...
@@ -151,13 +173,16 @@ terribly wrong...\n");
:
"r"
(
pc
));
#endif
/* __alpha__ */
/* We are 1 frame above signal frame with NPTL and 2 frames above with LT */
sigreturn_frame_count
=
is_nptl
?
1
:
2
;
while
(
fp
<
(
uchar
**
)
stack_bottom
)
{
#if
def __i386__
#if
defined(__i386__) || defined(__x86_64__)
uchar
**
new_fp
=
(
uchar
**
)
*
fp
;
fprintf
(
stderr
,
"%p
\n
"
,
frame_count
==
SIGRETURN_FRAME_COUNT
?
*
(
fp
+
17
)
:
*
(
fp
+
1
));
#endif
/*
__386__
*/
fprintf
(
stderr
,
"%p
\n
"
,
frame_count
==
sigreturn_frame_count
?
*
(
fp
+
SIGRETURN_FRAME_OFFSET
)
:
*
(
fp
+
1
));
#endif
/*
defined(__386__) || defined(__x86_64__)
*/
#if defined(__alpha__) && defined(__GNUC__)
uchar
**
new_fp
=
find_prev_fp
(
pc
,
fp
);
...
...
sql/stacktrace.h
View file @
8c192e2d
...
...
@@ -19,16 +19,20 @@ extern "C" {
#endif
#ifdef TARGET_OS_LINUX
#if defined(HAVE_STACKTRACE) || (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__)))
#if defined(HAVE_STACKTRACE) || (defined (__
x86_64__) || defined (__
i386__) || (defined(__alpha__) && defined(__GNUC__)))
#undef HAVE_STACKTRACE
#define HAVE_STACKTRACE
extern
char
*
__bss_start
;
extern
char
*
heap_start
;
#define init_stacktrace() { heap_start = (char*) &__bss_start; }
#define init_stacktrace() do { \
heap_start = (char*) &__bss_start; \
check_thread_lib(); \
} while(0);
void
print_stacktrace
(
gptr
stack_bottom
,
ulong
thread_stack
);
void
safe_print_str
(
const
char
*
name
,
const
char
*
val
,
int
max_len
);
void
check_thread_lib
(
void
);
#endif
/* (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */
#endif
/* TARGET_OS_LINUX */
...
...
strings/strtod.c
View file @
8c192e2d
...
...
@@ -30,7 +30,8 @@
#include <m_ctype.h>
#define MAX_DBL_EXP 308
#define MAX_RESULT_FOR_MAX_EXP 1.79769313486232
#define MAX_RESULT_FOR_MAX_EXP 1.7976931348623157
#define MIN_RESULT_FOR_MIN_EXP 2.225073858507202
static
double
scaler10
[]
=
{
1
.
0
,
1e10
,
1e20
,
1e30
,
1e40
,
1e50
,
1e60
,
1e70
,
1e80
,
1e90
};
...
...
@@ -57,10 +58,11 @@ double my_strtod(const char *str, char **end_ptr, int *error)
{
double
result
=
0
.
0
;
uint
negative
=
0
,
ndigits
,
dec_digits
=
0
,
neg_exp
=
0
;
int
exp
=
0
,
digits_after_dec_point
=
0
;
int
exp
=
0
,
digits_after_dec_point
=
0
,
tmp_exp
;
const
char
*
old_str
,
*
end
=
*
end_ptr
,
*
start_of_number
;
char
next_char
;
my_bool
overflow
=
0
;
double
scaler
=
1
.
0
;
*
error
=
0
;
if
(
str
>=
end
)
...
...
@@ -91,6 +93,7 @@ double my_strtod(const char *str, char **end_ptr, int *error)
while
((
next_char
=
*
str
)
>=
'0'
&&
next_char
<=
'9'
)
{
result
=
result
*
10
.
0
+
(
next_char
-
'0'
);
scaler
=
scaler
*
10
.
0
;
if
(
++
str
==
end
)
{
next_char
=
0
;
/* Found end of string */
...
...
@@ -114,6 +117,7 @@ double my_strtod(const char *str, char **end_ptr, int *error)
{
result
=
result
*
10
.
0
+
(
next_char
-
'0'
);
digits_after_dec_point
++
;
scaler
=
scaler
*
10
.
0
;
if
(
++
str
==
end
)
{
next_char
=
0
;
...
...
@@ -144,39 +148,54 @@ double my_strtod(const char *str, char **end_ptr, int *error)
}
while
(
str
<
end
&&
my_isdigit
(
&
my_charset_latin1
,
*
str
));
}
}
if
((
exp
=
(
neg_exp
?
exp
+
digits_after_dec_point
:
exp
-
digits_after_dec_point
))
)
tmp_exp
=
neg_exp
?
exp
+
digits_after_dec_point
:
exp
-
digits_after_dec_point
;
if
(
tmp_exp
)
{
double
scaler
;
if
(
exp
<
0
)
{
exp
=
-
exp
;
neg_exp
=
1
;
/* neg_exp was 0 before */
}
if
(
exp
+
ndigits
>=
MAX_DBL_EXP
+
1
&&
result
)
int
order
;
/*
Check for underflow/overflow.
order is such an integer number that f = C * 10 ^ order,
where f is the resulting floating point number and 1 <= C < 10.
Here we compute the modulus
*/
order
=
exp
+
(
neg_exp
?
-
1
:
1
)
*
(
ndigits
-
1
);
if
(
order
<
0
)
order
=
-
order
;
if
(
order
>=
MAX_DBL_EXP
&&
result
)
{
/*
This is not 100 % as we actually will give an owerflow for
17E307 but not for 1.7E308 but lets cut some corners to make life
simpler
*/
if
(
exp
+
ndigits
>
MAX_DBL_EXP
+
1
||
result
>=
MAX_RESULT_FOR_MAX_EXP
)
double
c
;
/* Compute modulus of C (see comment above) */
c
=
result
/
scaler
*
10
.
0
;
if
(
neg_exp
)
{
if
(
neg_exp
)
if
(
order
>
MAX_DBL_EXP
||
c
<
MIN_RESULT_FOR_MIN_EXP
)
{
result
=
0
.
0
;
else
goto
done
;
}
}
else
{
if
(
order
>
MAX_DBL_EXP
||
c
>
MAX_RESULT_FOR_MAX_EXP
)
{
overflow
=
1
;
goto
done
;
goto
done
;
}
}
}
scaler
=
1
.
0
;
exp
=
tmp_exp
;
if
(
exp
<
0
)
{
exp
=
-
exp
;
neg_exp
=
1
;
/* neg_exp was 0 before */
}
while
(
exp
>=
100
)
{
scaler
*=
1.0e100
;
result
=
neg_exp
?
result
/
1.0e100
:
result
*
1.0e100
;
exp
-=
100
;
}
scaler
*
=
scaler10
[
exp
/
10
]
*
scaler1
[
exp
%
10
];
scaler
=
scaler10
[
exp
/
10
]
*
scaler1
[
exp
%
10
];
if
(
neg_exp
)
result
/=
scaler
;
else
...
...
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