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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
b60713c0
Commit
b60713c0
authored
Aug 30, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug in my_strnncoll_utf8 (and friends) fixed
cleanups better, charset-dependent, ft_max_len_for_sort value
parent
08f3ba0e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
252 additions
and
235 deletions
+252
-235
myisam/ftdefs.h
myisam/ftdefs.h
+1
-1
myisam/mi_check.c
myisam/mi_check.c
+22
-14
myisam/myisamchk.c
myisam/myisamchk.c
+1
-1
myisam/sort.c
myisam/sort.c
+3
-1
sql/mysql_priv.h
sql/mysql_priv.h
+4
-4
sql/mysqld.cc
sql/mysqld.cc
+40
-40
sql/sql_acl.cc
sql/sql_acl.cc
+3
-3
sql/tztime.cc
sql/tztime.cc
+12
-14
strings/ctype-utf8.c
strings/ctype-utf8.c
+166
-157
No files found.
myisam/ftdefs.h
View file @
b60713c0
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#define misc_word_char(X) ((X)=='\'')
#define misc_word_char(X) ((X)=='\'')
#define word_char(s,X) (true_word_char(s,X) || misc_word_char(X))
#define word_char(s,X) (true_word_char(s,X) || misc_word_char(X))
#define FT_MAX_WORD_LEN_FOR_SORT
20
#define FT_MAX_WORD_LEN_FOR_SORT
31
#define COMPILE_STOPWORDS_IN
#define COMPILE_STOPWORDS_IN
...
...
myisam/mi_check.c
View file @
b60713c0
...
@@ -2020,12 +2020,14 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
...
@@ -2020,12 +2020,14 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
if
(
sort_param
.
keyinfo
->
flag
&
HA_FULLTEXT
)
if
(
sort_param
.
keyinfo
->
flag
&
HA_FULLTEXT
)
{
{
uint
ft_max_word_len_for_sort
=
FT_MAX_WORD_LEN_FOR_SORT
*
sort_param
.
keyinfo
->
seg
->
charset
->
mbmaxlen
;
sort_info
.
max_records
=
sort_info
.
max_records
=
(
ha_rows
)
(
sort_info
.
filelength
/
FT_MAX_WORD_LEN_FOR_SORT
+
1
);
(
ha_rows
)
(
sort_info
.
filelength
/
ft_max_word_len_for_sort
+
1
);
sort_param
.
key_read
=
sort_ft_key_read
;
sort_param
.
key_read
=
sort_ft_key_read
;
sort_param
.
key_write
=
sort_ft_key_write
;
sort_param
.
key_write
=
sort_ft_key_write
;
sort_param
.
key_length
+=
FT_MAX_WORD_LEN_FOR_SORT
-
HA_FT_MAXBYTELEN
;
sort_param
.
key_length
+=
ft_max_word_len_for_sort
-
HA_FT_MAXBYTELEN
;
}
}
else
else
{
{
...
@@ -2425,7 +2427,11 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
...
@@ -2425,7 +2427,11 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
total_key_length
+=
sort_param
[
i
].
key_length
;
total_key_length
+=
sort_param
[
i
].
key_length
;
if
(
sort_param
[
i
].
keyinfo
->
flag
&
HA_FULLTEXT
)
if
(
sort_param
[
i
].
keyinfo
->
flag
&
HA_FULLTEXT
)
sort_param
[
i
].
key_length
+=
FT_MAX_WORD_LEN_FOR_SORT
-
HA_FT_MAXBYTELEN
;
{
uint
ft_max_word_len_for_sort
=
FT_MAX_WORD_LEN_FOR_SORT
*
sort_param
[
i
].
keyinfo
->
seg
->
charset
->
mbmaxlen
;
sort_param
[
i
].
key_length
+=
ft_max_word_len_for_sort
-
HA_FT_MAXBYTELEN
;
}
}
}
sort_info
.
total_keys
=
i
;
sort_info
.
total_keys
=
i
;
sort_param
[
0
].
master
=
1
;
sort_param
[
0
].
master
=
1
;
...
@@ -2634,7 +2640,6 @@ static int sort_key_read(MI_SORT_PARAM *sort_param, void *key)
...
@@ -2634,7 +2640,6 @@ static int sort_key_read(MI_SORT_PARAM *sort_param, void *key)
DBUG_RETURN
(
sort_write_record
(
sort_param
));
DBUG_RETURN
(
sort_write_record
(
sort_param
));
}
/* sort_key_read */
}
/* sort_key_read */
static
int
sort_ft_key_read
(
MI_SORT_PARAM
*
sort_param
,
void
*
key
)
static
int
sort_ft_key_read
(
MI_SORT_PARAM
*
sort_param
,
void
*
key
)
{
{
int
error
;
int
error
;
...
@@ -3950,25 +3955,28 @@ static ha_checksum mi_byte_checksum(const byte *buf, uint length)
...
@@ -3950,25 +3955,28 @@ static ha_checksum mi_byte_checksum(const byte *buf, uint length)
return
crc
;
return
crc
;
}
}
/*
Deactive all not unique index that can be recreated fast
These include packed keys on which sorting will use more temporary
space than the max allowed file length or for which the unpacked keys
will take much more space than packed keys.
Note that 'rows' may be zero for the case when we don't know how many
rows we will put into the file.
*/
static
my_bool
mi_too_big_key_for_sort
(
MI_KEYDEF
*
key
,
ha_rows
rows
)
static
my_bool
mi_too_big_key_for_sort
(
MI_KEYDEF
*
key
,
ha_rows
rows
)
{
{
uint
key_maxlength
=
key
->
maxlength
;
uint
key_maxlength
=
key
->
maxlength
;
if
(
key
->
flag
&
HA_FULLTEXT
)
if
(
key
->
flag
&
HA_FULLTEXT
)
key_maxlength
+=
FT_MAX_WORD_LEN_FOR_SORT
-
HA_FT_MAXBYTELEN
;
{
uint
ft_max_word_len_for_sort
=
FT_MAX_WORD_LEN_FOR_SORT
*
key
->
seg
->
charset
->
mbmaxlen
;
key_maxlength
+=
ft_max_word_len_for_sort
-
HA_FT_MAXBYTELEN
;
}
return
(
key
->
flag
&
(
HA_BINARY_PACK_KEY
|
HA_VAR_LENGTH_KEY
|
HA_FULLTEXT
)
&&
return
(
key
->
flag
&
(
HA_BINARY_PACK_KEY
|
HA_VAR_LENGTH_KEY
|
HA_FULLTEXT
)
&&
((
ulonglong
)
rows
*
key_maxlength
>
((
ulonglong
)
rows
*
key_maxlength
>
(
ulonglong
)
myisam_max_temp_length
));
(
ulonglong
)
myisam_max_temp_length
));
}
}
/*
Deactivate all not unique index that can be recreated fast
These include packed keys on which sorting will use more temporary
space than the max allowed file length or for which the unpacked keys
will take much more space than packed keys.
Note that 'rows' may be zero for the case when we don't know how many
rows we will put into the file.
*/
void
mi_disable_non_unique_index
(
MI_INFO
*
info
,
ha_rows
rows
)
void
mi_disable_non_unique_index
(
MI_INFO
*
info
,
ha_rows
rows
)
{
{
...
...
myisam/myisamchk.c
View file @
b60713c0
...
@@ -154,7 +154,7 @@ enum options_mc {
...
@@ -154,7 +154,7 @@ enum options_mc {
OPT_KEY_CACHE_BLOCK_SIZE
,
OPT_MYISAM_BLOCK_SIZE
,
OPT_KEY_CACHE_BLOCK_SIZE
,
OPT_MYISAM_BLOCK_SIZE
,
OPT_READ_BUFFER_SIZE
,
OPT_WRITE_BUFFER_SIZE
,
OPT_SORT_BUFFER_SIZE
,
OPT_READ_BUFFER_SIZE
,
OPT_WRITE_BUFFER_SIZE
,
OPT_SORT_BUFFER_SIZE
,
OPT_SORT_KEY_BLOCKS
,
OPT_DECODE_BITS
,
OPT_FT_MIN_WORD_LEN
,
OPT_SORT_KEY_BLOCKS
,
OPT_DECODE_BITS
,
OPT_FT_MIN_WORD_LEN
,
OPT_FT_MAX_WORD_LEN
,
OPT_FT_
MAX_WORD_LEN_FOR_SORT
,
OPT_FT_
STOPWORD_FILE
,
OPT_FT_MAX_WORD_LEN
,
OPT_FT_STOPWORD_FILE
,
OPT_MAX_RECORD_LENGTH
OPT_MAX_RECORD_LENGTH
};
};
...
...
myisam/sort.c
View file @
b60713c0
...
@@ -204,7 +204,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
...
@@ -204,7 +204,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
reinit_io_cache
(
&
tempfile
,
READ_CACHE
,
0L
,
0
,
0
))
reinit_io_cache
(
&
tempfile
,
READ_CACHE
,
0L
,
0
,
0
))
goto
err
;
/* purecov: inspected */
goto
err
;
/* purecov: inspected */
if
(
!
no_messages
)
if
(
!
no_messages
)
p
uts
(
" - Last merge and dumping keys
\n
"
);
/* purecov: tested */
p
rintf
(
" - Last merge and dumping keys
\n
"
);
/* purecov: tested */
if
(
merge_index
(
info
,
keys
,
sort_keys
,
dynamic_element
(
&
buffpek
,
0
,
BUFFPEK
*
),
if
(
merge_index
(
info
,
keys
,
sort_keys
,
dynamic_element
(
&
buffpek
,
0
,
BUFFPEK
*
),
maxbuffer
,
&
tempfile
))
maxbuffer
,
&
tempfile
))
goto
err
;
/* purecov: inspected */
goto
err
;
/* purecov: inspected */
...
@@ -219,6 +219,8 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
...
@@ -219,6 +219,8 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
uint
keyno
=
info
->
key
;
uint
keyno
=
info
->
key
;
uint
key_length
,
ref_length
=
index
->
s
->
rec_reflength
;
uint
key_length
,
ref_length
=
index
->
s
->
rec_reflength
;
if
(
!
no_messages
)
printf
(
" - Adding exceptions
\n
"
);
/* purecov: tested */
if
(
flush_io_cache
(
&
tempfile_for_exceptions
)
||
if
(
flush_io_cache
(
&
tempfile_for_exceptions
)
||
reinit_io_cache
(
&
tempfile_for_exceptions
,
READ_CACHE
,
0L
,
0
,
0
))
reinit_io_cache
(
&
tempfile_for_exceptions
,
READ_CACHE
,
0L
,
0
,
0
))
goto
err
;
goto
err
;
...
...
sql/mysql_priv.h
View file @
b60713c0
...
@@ -783,10 +783,10 @@ int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length);
...
@@ -783,10 +783,10 @@ int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length);
bool
init_errmessage
(
void
);
bool
init_errmessage
(
void
);
void
sql_perror
(
const
char
*
message
);
void
sql_perror
(
const
char
*
message
);
void
vprint_msg_to_log
(
enum
loglevel
level
,
const
char
*
format
,
va_list
args
);
void
vprint_msg_to_log
(
enum
loglevel
level
,
const
char
*
format
,
va_list
args
);
void
sql_print_error
(
const
char
*
format
,
...
);
void
sql_print_error
(
const
char
*
format
,
...
);
void
sql_print_warning
(
const
char
*
format
,
...);
void
sql_print_warning
(
const
char
*
format
,
...);
void
sql_print_information
(
const
char
*
format
,
...);
void
sql_print_information
(
const
char
*
format
,
...);
...
...
sql/mysqld.cc
View file @
b60713c0
...
@@ -762,7 +762,7 @@ void kill_mysql(void)
...
@@ -762,7 +762,7 @@ void kill_mysql(void)
abort_loop
=
1
;
abort_loop
=
1
;
if
(
pthread_create
(
&
tmp
,
&
connection_attrib
,
kill_server_thread
,
if
(
pthread_create
(
&
tmp
,
&
connection_attrib
,
kill_server_thread
,
(
void
*
)
0
))
(
void
*
)
0
))
sql_print_error
(
"
Error:
Can't create thread to kill server"
);
sql_print_error
(
"Can't create thread to kill server"
);
}
}
#endif
#endif
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
...
@@ -791,7 +791,7 @@ static void __cdecl kill_server(int sig_ptr)
...
@@ -791,7 +791,7 @@ static void __cdecl kill_server(int sig_ptr)
abort_loop
=
1
;
// This should be set
abort_loop
=
1
;
// This should be set
signal
(
sig
,
SIG_IGN
);
signal
(
sig
,
SIG_IGN
);
if
(
sig
==
MYSQL_KILL_SIGNAL
||
sig
==
0
)
if
(
sig
==
MYSQL_KILL_SIGNAL
||
sig
==
0
)
sql_print_
error
(
ER
(
ER_NORMAL_SHUTDOWN
),
my_progname
);
sql_print_
information
(
ER
(
ER_NORMAL_SHUTDOWN
),
my_progname
);
else
else
sql_print_error
(
ER
(
ER_GOT_SIGNAL
),
my_progname
,
sig
);
/* purecov: inspected */
sql_print_error
(
ER
(
ER_GOT_SIGNAL
),
my_progname
,
sig
);
/* purecov: inspected */
...
@@ -806,7 +806,7 @@ static void __cdecl kill_server(int sig_ptr)
...
@@ -806,7 +806,7 @@ static void __cdecl kill_server(int sig_ptr)
#ifdef __NETWARE__
#ifdef __NETWARE__
pthread_join
(
select_thread
,
NULL
);
// wait for main thread
pthread_join
(
select_thread
,
NULL
);
// wait for main thread
#endif
/* __NETWARE__ */
#endif
/* __NETWARE__ */
pthread_exit
(
0
);
/* purecov: deadcode */
pthread_exit
(
0
);
/* purecov: deadcode */
#endif
/* EMBEDDED_LIBRARY */
#endif
/* EMBEDDED_LIBRARY */
...
@@ -834,7 +834,7 @@ extern "C" sig_handler print_signal_warning(int sig)
...
@@ -834,7 +834,7 @@ extern "C" sig_handler print_signal_warning(int sig)
if
(
!
DBUG_IN_USE
)
if
(
!
DBUG_IN_USE
)
{
{
if
(
global_system_variables
.
log_warnings
)
if
(
global_system_variables
.
log_warnings
)
sql_print_
error
(
"Warning:
Got signal %d from thread %d"
,
sql_print_
warning
(
"
Got signal %d from thread %d"
,
sig
,
my_thread_id
());
sig
,
my_thread_id
());
}
}
#ifdef DONT_REMEMBER_SIGNAL
#ifdef DONT_REMEMBER_SIGNAL
...
@@ -961,7 +961,7 @@ void clean_up(bool print_message)
...
@@ -961,7 +961,7 @@ void clean_up(bool print_message)
#endif
#endif
if
(
print_message
&&
errmesg
)
if
(
print_message
&&
errmesg
)
sql_print_
error
(
ER
(
ER_SHUTDOWN_COMPLETE
),
my_progname
);
sql_print_
information
(
ER
(
ER_SHUTDOWN_COMPLETE
),
my_progname
);
#if !defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
#if !defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
if
(
!
opt_bootstrap
)
if
(
!
opt_bootstrap
)
(
void
)
my_delete
(
pidfile_name
,
MYF
(
0
));
// This may not always exist
(
void
)
my_delete
(
pidfile_name
,
MYF
(
0
));
// This may not always exist
...
@@ -1062,8 +1062,8 @@ static void set_user(const char *user)
...
@@ -1062,8 +1062,8 @@ static void set_user(const char *user)
struct
passwd
*
user_info
=
getpwnam
(
user
);
struct
passwd
*
user_info
=
getpwnam
(
user
);
if
((
!
user_info
||
user_id
!=
user_info
->
pw_uid
)
&&
if
((
!
user_info
||
user_id
!=
user_info
->
pw_uid
)
&&
global_system_variables
.
log_warnings
)
global_system_variables
.
log_warnings
)
fprintf
(
stderr
,
sql_print_warning
(
"Warning:
One can only use the --user switch if running as root
\n
"
);
"
One can only use the --user switch if running as root
\n
"
);
}
}
return
;
return
;
}
}
...
@@ -1183,7 +1183,7 @@ static void server_init(void)
...
@@ -1183,7 +1183,7 @@ static void server_init(void)
if
(
listen
(
ip_sock
,(
int
)
back_log
)
<
0
)
if
(
listen
(
ip_sock
,(
int
)
back_log
)
<
0
)
{
{
sql_perror
(
"Can't start server: listen() on TCP/IP port"
);
sql_perror
(
"Can't start server: listen() on TCP/IP port"
);
sql_print_error
(
"
Error:
listen() on TCP/IP failed with error %d"
,
sql_print_error
(
"listen() on TCP/IP failed with error %d"
,
socket_errno
);
socket_errno
);
unireg_abort
(
1
);
unireg_abort
(
1
);
}
}
...
@@ -1278,7 +1278,7 @@ static void server_init(void)
...
@@ -1278,7 +1278,7 @@ static void server_init(void)
(
void
)
chmod
(
mysqld_unix_port
,
S_IFSOCK
);
/* Fix solaris 2.6 bug */
(
void
)
chmod
(
mysqld_unix_port
,
S_IFSOCK
);
/* Fix solaris 2.6 bug */
#endif
#endif
if
(
listen
(
unix_sock
,(
int
)
back_log
)
<
0
)
if
(
listen
(
unix_sock
,(
int
)
back_log
)
<
0
)
sql_print_
error
(
"Warning:
listen() on Unix socket failed with error %d"
,
sql_print_
warning
(
"
listen() on Unix socket failed with error %d"
,
socket_errno
);
socket_errno
);
}
}
#endif
#endif
...
@@ -1870,7 +1870,7 @@ static void init_signals(void)
...
@@ -1870,7 +1870,7 @@ static void init_signals(void)
struct
rlimit
rl
;
struct
rlimit
rl
;
rl
.
rlim_cur
=
rl
.
rlim_max
=
RLIM_INFINITY
;
rl
.
rlim_cur
=
rl
.
rlim_max
=
RLIM_INFINITY
;
if
(
setrlimit
(
RLIMIT_CORE
,
&
rl
)
&&
global_system_variables
.
log_warnings
)
if
(
setrlimit
(
RLIMIT_CORE
,
&
rl
)
&&
global_system_variables
.
log_warnings
)
sql_print_
error
(
"Warning:
setrlimit could not change the size of core files to 'infinity'; We may not be able to generate a core file on signals"
);
sql_print_
warning
(
"
setrlimit could not change the size of core files to 'infinity'; We may not be able to generate a core file on signals"
);
}
}
#endif
#endif
(
void
)
sigemptyset
(
&
set
);
(
void
)
sigemptyset
(
&
set
);
...
@@ -2024,7 +2024,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
...
@@ -2024,7 +2024,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
case
SIGQUIT
:
case
SIGQUIT
:
case
SIGKILL
:
case
SIGKILL
:
#ifdef EXTRA_DEBUG
#ifdef EXTRA_DEBUG
sql_print_
error
(
"Got signal %d to shutdown mysqld"
,
sig
);
sql_print_
information
(
"Got signal %d to shutdown mysqld"
,
sig
);
#endif
#endif
DBUG_PRINT
(
"info"
,(
"Got signal: %d abort_loop: %d"
,
sig
,
abort_loop
));
DBUG_PRINT
(
"info"
,(
"Got signal: %d abort_loop: %d"
,
sig
,
abort_loop
));
if
(
!
abort_loop
)
if
(
!
abort_loop
)
...
@@ -2036,7 +2036,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
...
@@ -2036,7 +2036,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
my_pthread_attr_setprio
(
&
connection_attrib
,
INTERRUPT_PRIOR
);
my_pthread_attr_setprio
(
&
connection_attrib
,
INTERRUPT_PRIOR
);
if
(
pthread_create
(
&
tmp
,
&
connection_attrib
,
kill_server_thread
,
if
(
pthread_create
(
&
tmp
,
&
connection_attrib
,
kill_server_thread
,
(
void
*
)
sig
))
(
void
*
)
sig
))
sql_print_error
(
"
Error:
Can't create thread to kill server"
);
sql_print_error
(
"Can't create thread to kill server"
);
#else
#else
kill_server
((
void
*
)
sig
);
// MIT THREAD has a alarm thread
kill_server
((
void
*
)
sig
);
// MIT THREAD has a alarm thread
#endif
#endif
...
@@ -2060,7 +2060,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
...
@@ -2060,7 +2060,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
#endif
#endif
default:
default:
#ifdef EXTRA_DEBUG
#ifdef EXTRA_DEBUG
sql_print_
error
(
"Warning:
Got signal: %d error: %d"
,
sig
,
error
);
/* purecov: tested */
sql_print_
warning
(
"
Got signal: %d error: %d"
,
sig
,
error
);
/* purecov: tested */
#endif
#endif
break
;
/* purecov: tested */
break
;
/* purecov: tested */
}
}
...
@@ -2339,11 +2339,11 @@ static int init_common_variables(const char *conf_file_name, int argc,
...
@@ -2339,11 +2339,11 @@ static int init_common_variables(const char *conf_file_name, int argc,
(
"Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld"
,
(
"Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld"
,
files
,
max_connections
,
table_cache_size
));
files
,
max_connections
,
table_cache_size
));
if
(
global_system_variables
.
log_warnings
)
if
(
global_system_variables
.
log_warnings
)
sql_print_
error
(
"Warning:
Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld"
,
sql_print_
warning
(
"
Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld"
,
files
,
max_connections
,
table_cache_size
);
files
,
max_connections
,
table_cache_size
);
}
}
else
if
(
global_system_variables
.
log_warnings
)
else
if
(
global_system_variables
.
log_warnings
)
sql_print_
error
(
"Warning:
Could not increase number of max_open_files to more than %u (request: %u)"
,
files
,
wanted_files
);
sql_print_
warning
(
"
Could not increase number of max_open_files to more than %u (request: %u)"
,
files
,
wanted_files
);
}
}
open_files_limit
=
files
;
open_files_limit
=
files
;
}
}
...
@@ -2523,8 +2523,8 @@ static int init_server_components()
...
@@ -2523,8 +2523,8 @@ static int init_server_components()
}
}
else
if
(
opt_log_slave_updates
)
else
if
(
opt_log_slave_updates
)
{
{
sql_print_
error
(
"\
sql_print_
warning
(
"\
Warning:
you need to use --log-bin to make --log-slave-updates work. \
you need to use --log-bin to make --log-slave-updates work. \
Now disabling --log-slave-updates."
);
Now disabling --log-slave-updates."
);
}
}
...
@@ -2532,7 +2532,7 @@ Now disabling --log-slave-updates.");
...
@@ -2532,7 +2532,7 @@ Now disabling --log-slave-updates.");
if
(
opt_log_slave_updates
&&
replicate_same_server_id
)
if
(
opt_log_slave_updates
&&
replicate_same_server_id
)
{
{
sql_print_error
(
"\
sql_print_error
(
"\
Error:
using --replicate-same-server-id in conjunction with \
using --replicate-same-server-id in conjunction with \
--log-slave-updates is impossible, it would lead to infinite loops in this \
--log-slave-updates is impossible, it would lead to infinite loops in this \
server."
);
server."
);
unireg_abort
(
1
);
unireg_abort
(
1
);
...
@@ -2561,12 +2561,12 @@ server.");
...
@@ -2561,12 +2561,12 @@ server.");
if
(
opt_innodb_safe_binlog
)
if
(
opt_innodb_safe_binlog
)
{
{
if
(
have_innodb
!=
SHOW_OPTION_YES
)
if
(
have_innodb
!=
SHOW_OPTION_YES
)
sql_print_
error
(
"Warning:
--innodb-safe-binlog is meaningful only if "
sql_print_
warning
(
"
--innodb-safe-binlog is meaningful only if "
"the InnoDB storage engine is enabled in the server."
);
"the InnoDB storage engine is enabled in the server."
);
#ifdef HAVE_INNOBASE_DB
#ifdef HAVE_INNOBASE_DB
if
(
innobase_flush_log_at_trx_commit
!=
1
)
if
(
innobase_flush_log_at_trx_commit
!=
1
)
{
{
sql_print_
error
(
"Warning:
--innodb-safe-binlog is meaningful only if "
sql_print_
warning
(
"
--innodb-safe-binlog is meaningful only if "
"innodb_flush_log_at_trx_commit is 1; now setting it "
"innodb_flush_log_at_trx_commit is 1; now setting it "
"to 1."
);
"to 1."
);
innobase_flush_log_at_trx_commit
=
1
;
innobase_flush_log_at_trx_commit
=
1
;
...
@@ -2578,14 +2578,14 @@ server.");
...
@@ -2578,14 +2578,14 @@ server.");
good (especially "littlesync", and on Windows... see
good (especially "littlesync", and on Windows... see
srv/srv0start.c).
srv/srv0start.c).
*/
*/
sql_print_
error
(
"Warning:
--innodb-safe-binlog requires that "
sql_print_
warning
(
"
--innodb-safe-binlog requires that "
"the innodb_flush_method actually synchronizes the "
"the innodb_flush_method actually synchronizes the "
"InnoDB log to disk; it is your responsibility "
"InnoDB log to disk; it is your responsibility "
"to verify that the method you chose does it."
);
"to verify that the method you chose does it."
);
}
}
if
(
sync_binlog_period
!=
1
)
if
(
sync_binlog_period
!=
1
)
{
{
sql_print_
error
(
"Warning:
--innodb-safe-binlog is meaningful only if "
sql_print_
warning
(
"
--innodb-safe-binlog is meaningful only if "
"the global sync_binlog variable is 1; now setting it "
"the global sync_binlog variable is 1; now setting it "
"to 1."
);
"to 1."
);
sync_binlog_period
=
1
;
sync_binlog_period
=
1
;
...
@@ -2624,7 +2624,7 @@ server.");
...
@@ -2624,7 +2624,7 @@ server.");
if
(
mlockall
(
MCL_CURRENT
))
if
(
mlockall
(
MCL_CURRENT
))
{
{
if
(
global_system_variables
.
log_warnings
)
if
(
global_system_variables
.
log_warnings
)
sql_print_
error
(
"Warning:
Failed to lock memory. Errno: %d
\n
"
,
errno
);
sql_print_
warning
(
"
Failed to lock memory. Errno: %d
\n
"
,
errno
);
locked_in_memory
=
0
;
locked_in_memory
=
0
;
}
}
}
}
...
@@ -2650,7 +2650,7 @@ static void create_maintenance_thread()
...
@@ -2650,7 +2650,7 @@ static void create_maintenance_thread()
{
{
pthread_t
hThread
;
pthread_t
hThread
;
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
handle_manager
,
0
))
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
handle_manager
,
0
))
sql_print_
error
(
"Warning:
Can't create thread to manage maintenance"
);
sql_print_
warning
(
"
Can't create thread to manage maintenance"
);
}
}
}
}
...
@@ -2662,7 +2662,7 @@ static void create_shutdown_thread()
...
@@ -2662,7 +2662,7 @@ static void create_shutdown_thread()
hEventShutdown
=
CreateEvent
(
0
,
FALSE
,
FALSE
,
shutdown_event_name
);
hEventShutdown
=
CreateEvent
(
0
,
FALSE
,
FALSE
,
shutdown_event_name
);
pthread_t
hThread
;
pthread_t
hThread
;
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
handle_shutdown
,
0
))
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
handle_shutdown
,
0
))
sql_print_
error
(
"Warning:
Can't create thread to handle shutdown requests"
);
sql_print_
warning
(
"
Can't create thread to handle shutdown requests"
);
// On "Stop Service" we have to do regular shutdown
// On "Stop Service" we have to do regular shutdown
Service
.
SetShutdownEvent
(
hEventShutdown
);
Service
.
SetShutdownEvent
(
hEventShutdown
);
...
@@ -2671,7 +2671,7 @@ static void create_shutdown_thread()
...
@@ -2671,7 +2671,7 @@ static void create_shutdown_thread()
pthread_cond_init
(
&
eventShutdown
,
NULL
);
pthread_cond_init
(
&
eventShutdown
,
NULL
);
pthread_t
hThread
;
pthread_t
hThread
;
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
handle_shutdown
,
0
))
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
handle_shutdown
,
0
))
sql_print_
error
(
"Warning:
Can't create thread to handle shutdown requests"
);
sql_print_
warning
(
"
Can't create thread to handle shutdown requests"
);
#endif
#endif
#endif // EMBEDDED_LIBRARY
#endif // EMBEDDED_LIBRARY
}
}
...
@@ -2702,7 +2702,7 @@ static void handle_connections_methods()
...
@@ -2702,7 +2702,7 @@ static void handle_connections_methods()
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
handle_connections_namedpipes
,
0
))
handle_connections_namedpipes
,
0
))
{
{
sql_print_
error
(
"Warning:
Can't create thread to handle named pipes"
);
sql_print_
warning
(
"
Can't create thread to handle named pipes"
);
handler_count
--
;
handler_count
--
;
}
}
}
}
...
@@ -2713,7 +2713,7 @@ static void handle_connections_methods()
...
@@ -2713,7 +2713,7 @@ static void handle_connections_methods()
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
handle_connections_sockets
,
0
))
handle_connections_sockets
,
0
))
{
{
sql_print_
error
(
"Warning:
Can't create thread to handle TCP/IP"
);
sql_print_
warning
(
"
Can't create thread to handle TCP/IP"
);
handler_count
--
;
handler_count
--
;
}
}
}
}
...
@@ -2724,7 +2724,7 @@ static void handle_connections_methods()
...
@@ -2724,7 +2724,7 @@ static void handle_connections_methods()
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
handle_connections_shared_memory
,
0
))
handle_connections_shared_memory
,
0
))
{
{
sql_print_
error
(
"Warning:
Can't create thread to handle shared memory"
);
sql_print_
warning
(
"
Can't create thread to handle shared memory"
);
handler_count
--
;
handler_count
--
;
}
}
}
}
...
@@ -2784,7 +2784,7 @@ int main(int argc, char **argv)
...
@@ -2784,7 +2784,7 @@ int main(int argc, char **argv)
if
(
stack_size
&&
stack_size
<
thread_stack
)
if
(
stack_size
&&
stack_size
<
thread_stack
)
{
{
if
(
global_system_variables
.
log_warnings
)
if
(
global_system_variables
.
log_warnings
)
sql_print_
error
(
"Warning:
Asked for %ld thread stack, but got %ld"
,
sql_print_
warning
(
"
Asked for %ld thread stack, but got %ld"
,
thread_stack
,
stack_size
);
thread_stack
,
stack_size
);
thread_stack
=
stack_size
;
thread_stack
=
stack_size
;
}
}
...
@@ -2807,8 +2807,8 @@ int main(int argc, char **argv)
...
@@ -2807,8 +2807,8 @@ int main(int argc, char **argv)
if
(
lower_case_table_names_used
)
if
(
lower_case_table_names_used
)
{
{
if
(
global_system_variables
.
log_warnings
)
if
(
global_system_variables
.
log_warnings
)
sql_print_
error
(
"\
sql_print_
warning
(
"\
Warning:
You have forced lower_case_table_names to 0 through a command-line \
You have forced lower_case_table_names to 0 through a command-line \
option, even though your file system '%s' is case insensitive. This means \
option, even though your file system '%s' is case insensitive. This means \
that you can corrupt a MyISAM table by accessing it with different cases. \
that you can corrupt a MyISAM table by accessing it with different cases. \
You should consider changing lower_case_table_names to 1 or 2"
,
You should consider changing lower_case_table_names to 1 or 2"
,
...
@@ -2817,7 +2817,7 @@ You should consider changing lower_case_table_names to 1 or 2",
...
@@ -2817,7 +2817,7 @@ You should consider changing lower_case_table_names to 1 or 2",
else
else
{
{
if
(
global_system_variables
.
log_warnings
)
if
(
global_system_variables
.
log_warnings
)
sql_print_
error
(
"Warning:
Setting lower_case_table_names=2 because file system for %s is case insensitive"
,
mysql_real_data_home
);
sql_print_
warning
(
"
Setting lower_case_table_names=2 because file system for %s is case insensitive"
,
mysql_real_data_home
);
lower_case_table_names
=
2
;
lower_case_table_names
=
2
;
}
}
}
}
...
@@ -2850,14 +2850,14 @@ You should consider changing lower_case_table_names to 1 or 2",
...
@@ -2850,14 +2850,14 @@ You should consider changing lower_case_table_names to 1 or 2",
#ifdef EXTRA_DEBUG
#ifdef EXTRA_DEBUG
switch
(
server_id
)
{
switch
(
server_id
)
{
case
1
:
case
1
:
sql_print_
error
(
"\
sql_print_
warning
(
"\
Warning:
You have enabled the binary log, but you haven't set server-id to \
You have enabled the binary log, but you haven't set server-id to \
a non-zero value: we force server id to 1; updates will be logged to the \
a non-zero value: we force server id to 1; updates will be logged to the \
binary log, but connections from slaves will not be accepted."
);
binary log, but connections from slaves will not be accepted."
);
break
;
break
;
case
2
:
case
2
:
sql_print_
error
(
"\
sql_print_
warning
(
"\
Warning:
You should set server-id to a non-0 value if master_host is set; \
You should set server-id to a non-0 value if master_host is set; \
we force server id to 2, but this MySQL server will not act as a slave."
);
we force server id to 2, but this MySQL server will not act as a slave."
);
break
;
break
;
}
}
...
@@ -3197,7 +3197,7 @@ static int bootstrap(FILE *file)
...
@@ -3197,7 +3197,7 @@ static int bootstrap(FILE *file)
if
(
pthread_create
(
&
thd
->
real_id
,
&
connection_attrib
,
handle_bootstrap
,
if
(
pthread_create
(
&
thd
->
real_id
,
&
connection_attrib
,
handle_bootstrap
,
(
void
*
)
thd
))
(
void
*
)
thd
))
{
{
sql_print_
error
(
"Warning:
Can't create thread to handle bootstrap"
);
sql_print_
warning
(
"
Can't create thread to handle bootstrap"
);
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
/* Wait for thread to die */
/* Wait for thread to die */
...
@@ -5606,7 +5606,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
...
@@ -5606,7 +5606,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if
(
!
mysqld_user
||
!
strcmp
(
mysqld_user
,
argument
))
if
(
!
mysqld_user
||
!
strcmp
(
mysqld_user
,
argument
))
mysqld_user
=
argument
;
mysqld_user
=
argument
;
else
else
fprintf
(
stderr
,
"Warning:
Ignoring user change to '%s' because the user was set to '%s' earlier on the command line
\n
"
,
argument
,
mysqld_user
);
sql_print_warning
(
"
Ignoring user change to '%s' because the user was set to '%s' earlier on the command line
\n
"
,
argument
,
mysqld_user
);
break
;
break
;
case
'L'
:
case
'L'
:
strmake
(
language
,
argument
,
sizeof
(
language
)
-
1
);
strmake
(
language
,
argument
,
sizeof
(
language
)
-
1
);
...
@@ -6391,7 +6391,7 @@ static int test_if_case_insensitive(const char *dir_name)
...
@@ -6391,7 +6391,7 @@ static int test_if_case_insensitive(const char *dir_name)
(
void
)
my_delete
(
buff2
,
MYF
(
0
));
(
void
)
my_delete
(
buff2
,
MYF
(
0
));
if
((
file
=
my_create
(
buff
,
0666
,
O_RDWR
,
MYF
(
0
)))
<
0
)
if
((
file
=
my_create
(
buff
,
0666
,
O_RDWR
,
MYF
(
0
)))
<
0
)
{
{
sql_print_
error
(
"Warning:
Can't create test file %s"
,
buff
);
sql_print_
warning
(
"
Can't create test file %s"
,
buff
);
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
my_close
(
file
,
MYF
(
0
));
my_close
(
file
,
MYF
(
0
));
...
...
sql/sql_acl.cc
View file @
b60713c0
...
@@ -251,9 +251,9 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
...
@@ -251,9 +251,9 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
{
{
global_system_variables
.
old_passwords
=
1
;
global_system_variables
.
old_passwords
=
1
;
pthread_mutex_unlock
(
&
LOCK_global_system_variables
);
pthread_mutex_unlock
(
&
LOCK_global_system_variables
);
sql_print_
error
(
"mysql.user table is not updated to new password format; "
sql_print_
warning
(
"mysql.user table is not updated to new password format; "
"Disabling new password usage until "
"Disabling new password usage until "
"mysql_fix_privilege_tables is run"
);
"mysql_fix_privilege_tables is run"
);
}
}
thd
->
variables
.
old_passwords
=
1
;
thd
->
variables
.
old_passwords
=
1
;
}
}
...
...
sql/tztime.cc
View file @
b60713c0
...
@@ -1560,8 +1560,8 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
...
@@ -1560,8 +1560,8 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
if
(
open_tables
(
thd
,
tables_buff
,
&
counter
)
||
if
(
open_tables
(
thd
,
tables_buff
,
&
counter
)
||
lock_tables
(
thd
,
tables_buff
,
counter
))
lock_tables
(
thd
,
tables_buff
,
counter
))
{
{
sql_print_
error
(
"Warning:
Can't open and lock time zone table: %s "
sql_print_
warning
(
"
Can't open and lock time zone table: %s "
"trying to live without them"
,
thd
->
net
.
last_error
);
"trying to live without them"
,
thd
->
net
.
last_error
);
/* We will try emulate that everything is ok */
/* We will try emulate that everything is ok */
return_val
=
time_zone_tables_exist
=
0
;
return_val
=
time_zone_tables_exist
=
0
;
goto
end_with_setting_default_tz
;
goto
end_with_setting_default_tz
;
...
@@ -1740,8 +1740,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
...
@@ -1740,8 +1740,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
if
(
!
(
alloc_buff
=
alloc_root
(
&
tz_storage
,
sizeof
(
TIME_ZONE_INFO
)
+
if
(
!
(
alloc_buff
=
alloc_root
(
&
tz_storage
,
sizeof
(
TIME_ZONE_INFO
)
+
tz_name
->
length
()
+
1
)))
tz_name
->
length
()
+
1
)))
{
{
sql_print_error
(
"Error: Out of memory while loading time zone "
sql_print_error
(
"Out of memory while loading time zone description"
);
"description"
);
return
0
;
return
0
;
}
}
tz_info
=
(
TIME_ZONE_INFO
*
)
alloc_buff
;
tz_info
=
(
TIME_ZONE_INFO
*
)
alloc_buff
;
...
@@ -1757,7 +1756,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
...
@@ -1757,7 +1756,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
Let us find out time zone id by its name (there is only one index
Let us find out time zone id by its name (there is only one index
and it is specifically for this purpose).
and it is specifically for this purpose).
*/
*/
table
=
tz_tables
->
table
;
table
=
tz_tables
->
table
;
tz_tables
=
tz_tables
->
next
;
tz_tables
=
tz_tables
->
next
;
table
->
field
[
0
]
->
store
(
tz_name
->
ptr
(),
tz_name
->
length
(),
&
my_charset_latin1
);
table
->
field
[
0
]
->
store
(
tz_name
->
ptr
(),
tz_name
->
length
(),
&
my_charset_latin1
);
/*
/*
...
@@ -1770,7 +1769,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
...
@@ -1770,7 +1769,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
if
(
table
->
file
->
index_read
(
table
->
record
[
0
],
(
byte
*
)
table
->
field
[
0
]
->
ptr
,
if
(
table
->
file
->
index_read
(
table
->
record
[
0
],
(
byte
*
)
table
->
field
[
0
]
->
ptr
,
0
,
HA_READ_KEY_EXACT
))
0
,
HA_READ_KEY_EXACT
))
{
{
sql_print_error
(
"
Error:
Can't find description of time zone."
);
sql_print_error
(
"Can't find description of time zone."
);
goto
end
;
goto
end
;
}
}
...
@@ -1783,7 +1782,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
...
@@ -1783,7 +1782,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
understand whenever this timezone uses leap seconds (again we are
understand whenever this timezone uses leap seconds (again we are
using the only index in this table).
using the only index in this table).
*/
*/
table
=
tz_tables
->
table
;
table
=
tz_tables
->
table
;
tz_tables
=
tz_tables
->
next
;
tz_tables
=
tz_tables
->
next
;
table
->
field
[
0
]
->
store
((
longlong
)
tzid
);
table
->
field
[
0
]
->
store
((
longlong
)
tzid
);
(
void
)
table
->
file
->
ha_index_init
(
0
);
(
void
)
table
->
file
->
ha_index_init
(
0
);
...
@@ -1791,7 +1790,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
...
@@ -1791,7 +1790,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
if
(
table
->
file
->
index_read
(
table
->
record
[
0
],
(
byte
*
)
table
->
field
[
0
]
->
ptr
,
if
(
table
->
file
->
index_read
(
table
->
record
[
0
],
(
byte
*
)
table
->
field
[
0
]
->
ptr
,
0
,
HA_READ_KEY_EXACT
))
0
,
HA_READ_KEY_EXACT
))
{
{
sql_print_error
(
"
Error:
Can't find description of time zone."
);
sql_print_error
(
"Can't find description of time zone."
);
goto
end
;
goto
end
;
}
}
...
@@ -1810,7 +1809,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
...
@@ -1810,7 +1809,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
only for our time zone guess what are we doing?
only for our time zone guess what are we doing?
Right - using special index.
Right - using special index.
*/
*/
table
=
tz_tables
->
table
;
table
=
tz_tables
->
table
;
tz_tables
=
tz_tables
->
next
;
tz_tables
=
tz_tables
->
next
;
table
->
field
[
0
]
->
store
((
longlong
)
tzid
);
table
->
field
[
0
]
->
store
((
longlong
)
tzid
);
(
void
)
table
->
file
->
ha_index_init
(
0
);
(
void
)
table
->
file
->
ha_index_init
(
0
);
...
@@ -1948,8 +1947,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
...
@@ -1948,8 +1947,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
#endif
#endif
sizeof
(
TRAN_TYPE_INFO
)
*
tz_info
->
typecnt
)))
sizeof
(
TRAN_TYPE_INFO
)
*
tz_info
->
typecnt
)))
{
{
sql_print_error
(
"Error: Out of memory while loading time zone "
sql_print_error
(
"Out of memory while loading time zone description"
);
"description"
);
goto
end
;
goto
end
;
}
}
...
@@ -1974,12 +1972,12 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
...
@@ -1974,12 +1972,12 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
*/
*/
if
(
tz_info
->
typecnt
<
1
)
if
(
tz_info
->
typecnt
<
1
)
{
{
sql_print_error
(
"
Error:
loading time zone without transition types"
);
sql_print_error
(
"loading time zone without transition types"
);
goto
end
;
goto
end
;
}
}
if
(
prepare_tz_info
(
tz_info
,
&
tz_storage
))
if
(
prepare_tz_info
(
tz_info
,
&
tz_storage
))
{
{
sql_print_error
(
"
Error:
Unable to build mktime map for time zone"
);
sql_print_error
(
"Unable to build mktime map for time zone"
);
goto
end
;
goto
end
;
}
}
...
@@ -1991,7 +1989,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
...
@@ -1991,7 +1989,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
&
my_charset_latin1
),
&
my_charset_latin1
),
my_hash_insert
(
&
tz_names
,
(
const
byte
*
)
tmp_tzname
)))
my_hash_insert
(
&
tz_names
,
(
const
byte
*
)
tmp_tzname
)))
{
{
sql_print_error
(
"
Error:
Out of memory while loading time zone"
);
sql_print_error
(
"Out of memory while loading time zone"
);
goto
end
;
goto
end
;
}
}
...
...
strings/ctype-utf8.c
View file @
b60713c0
/* Copyright (C) 2000 MySQL AB
/* Copyright (C) 2000 MySQL AB
This library is free software; you can redistribute it and/or
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
...
@@ -1524,7 +1524,7 @@ MY_UNICASE_INFO *uni_plane[256]={
...
@@ -1524,7 +1524,7 @@ MY_UNICASE_INFO *uni_plane[256]={
#ifdef HAVE_CHARSET_utf8
#ifdef HAVE_CHARSET_utf8
/*
/*
We consider bytes with code more than 127 as a letter.
We consider bytes with code more than 127 as a letter.
This garantees that word boundaries work fine with regular
This garantees that word boundaries work fine with regular
expressions. Note, there is no need to mark byte 255 as a
expressions. Note, there is no need to mark byte 255 as a
...
@@ -1590,99 +1590,108 @@ static uchar to_upper_utf8[] = {
...
@@ -1590,99 +1590,108 @@ static uchar to_upper_utf8[] = {
240
,
241
,
242
,
243
,
244
,
245
,
246
,
247
,
248
,
249
,
250
,
251
,
252
,
253
,
254
,
255
240
,
241
,
242
,
243
,
244
,
245
,
246
,
247
,
248
,
249
,
250
,
251
,
252
,
253
,
254
,
255
};
};
static
inline
int
bincmp
(
const
uchar
*
s
,
const
uchar
*
se
,
const
uchar
*
t
,
const
uchar
*
te
)
{
int
slen
=
se
-
s
,
tlen
=
te
-
t
;
int
len
=
min
(
slen
,
tlen
);
int
cmp
=
memcmp
(
s
,
t
,
len
);
return
cmp
?
cmp
:
slen
-
tlen
;
}
static
int
my_utf8_uni
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
static
int
my_utf8_uni
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
my_wc_t
*
pwc
,
const
uchar
*
s
,
const
uchar
*
e
)
my_wc_t
*
pwc
,
const
uchar
*
s
,
const
uchar
*
e
)
{
{
unsigned
char
c
;
unsigned
char
c
;
if
(
s
>=
e
)
if
(
s
>=
e
)
return
MY_CS_TOOFEW
(
0
);
return
MY_CS_TOOFEW
(
0
);
c
=
s
[
0
];
c
=
s
[
0
];
if
(
c
<
0x80
)
if
(
c
<
0x80
)
{
{
*
pwc
=
c
;
*
pwc
=
c
;
return
1
;
return
1
;
}
}
else
if
(
c
<
0xc2
)
else
if
(
c
<
0xc2
)
return
MY_CS_ILSEQ
;
return
MY_CS_ILSEQ
;
else
if
(
c
<
0xe0
)
else
if
(
c
<
0xe0
)
{
{
if
(
s
+
2
>
e
)
/* We need 2 characters */
if
(
s
+
2
>
e
)
/* We need 2 characters */
return
MY_CS_TOOFEW
(
0
);
return
MY_CS_TOOFEW
(
0
);
if
(
!
((
s
[
1
]
^
0x80
)
<
0x40
))
if
(
!
((
s
[
1
]
^
0x80
)
<
0x40
))
return
MY_CS_ILSEQ
;
return
MY_CS_ILSEQ
;
*
pwc
=
((
my_wc_t
)
(
c
&
0x1f
)
<<
6
)
|
(
my_wc_t
)
(
s
[
1
]
^
0x80
);
*
pwc
=
((
my_wc_t
)
(
c
&
0x1f
)
<<
6
)
|
(
my_wc_t
)
(
s
[
1
]
^
0x80
);
return
2
;
return
2
;
}
}
else
if
(
c
<
0xf0
)
else
if
(
c
<
0xf0
)
{
{
if
(
s
+
3
>
e
)
/* We need 3 characters */
if
(
s
+
3
>
e
)
/* We need 3 characters */
return
MY_CS_TOOFEW
(
0
);
return
MY_CS_TOOFEW
(
0
);
if
(
!
((
s
[
1
]
^
0x80
)
<
0x40
&&
(
s
[
2
]
^
0x80
)
<
0x40
&&
(
c
>=
0xe1
||
s
[
1
]
>=
0xa0
)))
if
(
!
((
s
[
1
]
^
0x80
)
<
0x40
&&
(
s
[
2
]
^
0x80
)
<
0x40
&&
(
c
>=
0xe1
||
s
[
1
]
>=
0xa0
)))
return
MY_CS_ILSEQ
;
return
MY_CS_ILSEQ
;
*
pwc
=
((
my_wc_t
)
(
c
&
0x0f
)
<<
12
)
|
*
pwc
=
((
my_wc_t
)
(
c
&
0x0f
)
<<
12
)
|
((
my_wc_t
)
(
s
[
1
]
^
0x80
)
<<
6
)
|
((
my_wc_t
)
(
s
[
1
]
^
0x80
)
<<
6
)
|
(
my_wc_t
)
(
s
[
2
]
^
0x80
);
(
my_wc_t
)
(
s
[
2
]
^
0x80
);
return
3
;
return
3
;
}
}
#ifdef UNICODE_32BIT
#ifdef UNICODE_32BIT
else
if
(
c
<
0xf8
&&
sizeof
(
my_wc_t
)
*
8
>=
32
)
else
if
(
c
<
0xf8
&&
sizeof
(
my_wc_t
)
*
8
>=
32
)
{
{
if
(
s
+
4
>
e
)
/* We need 4 characters */
if
(
s
+
4
>
e
)
/* We need 4 characters */
return
MY_CS_TOOFEW
(
0
);
return
MY_CS_TOOFEW
(
0
);
if
(
!
((
s
[
1
]
^
0x80
)
<
0x40
&&
if
(
!
((
s
[
1
]
^
0x80
)
<
0x40
&&
(
s
[
2
]
^
0x80
)
<
0x40
&&
(
s
[
2
]
^
0x80
)
<
0x40
&&
(
s
[
3
]
^
0x80
)
<
0x40
&&
(
s
[
3
]
^
0x80
)
<
0x40
&&
(
c
>=
0xf1
||
s
[
1
]
>=
0x90
)))
(
c
>=
0xf1
||
s
[
1
]
>=
0x90
)))
return
MY_CS_ILSEQ
;
return
MY_CS_ILSEQ
;
*
pwc
=
((
my_wc_t
)
(
c
&
0x07
)
<<
18
)
|
*
pwc
=
((
my_wc_t
)
(
c
&
0x07
)
<<
18
)
|
((
my_wc_t
)
(
s
[
1
]
^
0x80
)
<<
12
)
|
((
my_wc_t
)
(
s
[
1
]
^
0x80
)
<<
12
)
|
((
my_wc_t
)
(
s
[
2
]
^
0x80
)
<<
6
)
|
((
my_wc_t
)
(
s
[
2
]
^
0x80
)
<<
6
)
|
(
my_wc_t
)
(
s
[
3
]
^
0x80
);
(
my_wc_t
)
(
s
[
3
]
^
0x80
);
return
4
;
return
4
;
}
}
else
if
(
c
<
0xfc
&&
sizeof
(
my_wc_t
)
*
8
>=
32
)
else
if
(
c
<
0xfc
&&
sizeof
(
my_wc_t
)
*
8
>=
32
)
{
{
if
(
s
+
5
>
e
)
/* We need 5 characters */
if
(
s
+
5
>
e
)
/* We need 5 characters */
return
MY_CS_TOOFEW
(
0
);
return
MY_CS_TOOFEW
(
0
);
if
(
!
((
s
[
1
]
^
0x80
)
<
0x40
&&
if
(
!
((
s
[
1
]
^
0x80
)
<
0x40
&&
(
s
[
2
]
^
0x80
)
<
0x40
&&
(
s
[
2
]
^
0x80
)
<
0x40
&&
(
s
[
3
]
^
0x80
)
<
0x40
&&
(
s
[
3
]
^
0x80
)
<
0x40
&&
(
s
[
4
]
^
0x80
)
<
0x40
&&
(
s
[
4
]
^
0x80
)
<
0x40
&&
(
c
>=
0xf9
||
s
[
1
]
>=
0x88
)))
(
c
>=
0xf9
||
s
[
1
]
>=
0x88
)))
return
MY_CS_ILSEQ
;
return
MY_CS_ILSEQ
;
*
pwc
=
((
my_wc_t
)
(
c
&
0x03
)
<<
24
)
|
*
pwc
=
((
my_wc_t
)
(
c
&
0x03
)
<<
24
)
|
((
my_wc_t
)
(
s
[
1
]
^
0x80
)
<<
18
)
|
((
my_wc_t
)
(
s
[
1
]
^
0x80
)
<<
18
)
|
((
my_wc_t
)
(
s
[
2
]
^
0x80
)
<<
12
)
|
((
my_wc_t
)
(
s
[
2
]
^
0x80
)
<<
12
)
|
((
my_wc_t
)
(
s
[
3
]
^
0x80
)
<<
6
)
|
((
my_wc_t
)
(
s
[
3
]
^
0x80
)
<<
6
)
|
(
my_wc_t
)
(
s
[
4
]
^
0x80
);
(
my_wc_t
)
(
s
[
4
]
^
0x80
);
return
5
;
return
5
;
}
}
else
if
(
c
<
0xfe
&&
sizeof
(
my_wc_t
)
*
8
>=
32
)
else
if
(
c
<
0xfe
&&
sizeof
(
my_wc_t
)
*
8
>=
32
)
{
{
if
(
s
+
6
>
e
)
/* We need 6 characters */
if
(
s
+
6
>
e
)
/* We need 6 characters */
return
MY_CS_TOOFEW
(
0
);
return
MY_CS_TOOFEW
(
0
);
if
(
!
((
s
[
1
]
^
0x80
)
<
0x40
&&
if
(
!
((
s
[
1
]
^
0x80
)
<
0x40
&&
(
s
[
2
]
^
0x80
)
<
0x40
&&
(
s
[
2
]
^
0x80
)
<
0x40
&&
(
s
[
3
]
^
0x80
)
<
0x40
&&
(
s
[
3
]
^
0x80
)
<
0x40
&&
(
s
[
4
]
^
0x80
)
<
0x40
&&
(
s
[
4
]
^
0x80
)
<
0x40
&&
(
s
[
5
]
^
0x80
)
<
0x40
&&
(
s
[
5
]
^
0x80
)
<
0x40
&&
(
c
>=
0xfd
||
s
[
1
]
>=
0x84
)))
(
c
>=
0xfd
||
s
[
1
]
>=
0x84
)))
return
MY_CS_ILSEQ
;
return
MY_CS_ILSEQ
;
*
pwc
=
((
my_wc_t
)
(
c
&
0x01
)
<<
30
)
*
pwc
=
((
my_wc_t
)
(
c
&
0x01
)
<<
30
)
|
((
my_wc_t
)
(
s
[
1
]
^
0x80
)
<<
24
)
|
((
my_wc_t
)
(
s
[
1
]
^
0x80
)
<<
24
)
|
((
my_wc_t
)
(
s
[
2
]
^
0x80
)
<<
18
)
|
((
my_wc_t
)
(
s
[
2
]
^
0x80
)
<<
18
)
...
@@ -1702,12 +1711,12 @@ static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) ,
...
@@ -1702,12 +1711,12 @@ static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) ,
if
(
r
>=
e
)
if
(
r
>=
e
)
return
MY_CS_TOOSMALL
;
return
MY_CS_TOOSMALL
;
if
(
wc
<
0x80
)
if
(
wc
<
0x80
)
count
=
1
;
count
=
1
;
else
if
(
wc
<
0x800
)
else
if
(
wc
<
0x800
)
count
=
2
;
count
=
2
;
else
if
(
wc
<
0x10000
)
else
if
(
wc
<
0x10000
)
count
=
3
;
count
=
3
;
#ifdef UNICODE_32BIT
#ifdef UNICODE_32BIT
else
if
(
wc
<
0x200000
)
else
if
(
wc
<
0x200000
)
...
@@ -1718,15 +1727,15 @@ static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) ,
...
@@ -1718,15 +1727,15 @@ static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) ,
count
=
6
;
count
=
6
;
#endif
#endif
else
return
MY_CS_ILUNI
;
else
return
MY_CS_ILUNI
;
/*
/*
e is a character after the string r, not the last character of it.
e is a character after the string r, not the last character of it.
Because of it (r+count > e), not (r+count-1 >e )
Because of it (r+count > e), not (r+count-1 >e )
*/
*/
if
(
r
+
count
>
e
)
if
(
r
+
count
>
e
)
return
MY_CS_TOOSMALL
;
return
MY_CS_TOOSMALL
;
switch
(
count
)
{
switch
(
count
)
{
/* Fall through all cases!!! */
/* Fall through all cases!!! */
#ifdef UNICODE_32BIT
#ifdef UNICODE_32BIT
case
6
:
r
[
5
]
=
(
uchar
)
(
0x80
|
(
wc
&
0x3f
));
wc
=
wc
>>
6
;
wc
|=
0x4000000
;
case
6
:
r
[
5
]
=
(
uchar
)
(
0x80
|
(
wc
&
0x3f
));
wc
=
wc
>>
6
;
wc
|=
0x4000000
;
...
@@ -1806,8 +1815,8 @@ static void my_casedn_str_utf8(CHARSET_INFO *cs, char * s)
...
@@ -1806,8 +1815,8 @@ static void my_casedn_str_utf8(CHARSET_INFO *cs, char * s)
}
}
static
int
my_strnncoll_utf8
(
CHARSET_INFO
*
cs
,
static
int
my_strnncoll_utf8
(
CHARSET_INFO
*
cs
,
const
uchar
*
s
,
uint
slen
,
const
uchar
*
s
,
uint
slen
,
const
uchar
*
t
,
uint
tlen
,
const
uchar
*
t
,
uint
tlen
,
my_bool
t_is_prefix
)
my_bool
t_is_prefix
)
{
{
...
@@ -1821,13 +1830,13 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs,
...
@@ -1821,13 +1830,13 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs,
int
plane
;
int
plane
;
s_res
=
my_utf8_uni
(
cs
,
&
s_wc
,
s
,
se
);
s_res
=
my_utf8_uni
(
cs
,
&
s_wc
,
s
,
se
);
t_res
=
my_utf8_uni
(
cs
,
&
t_wc
,
t
,
te
);
t_res
=
my_utf8_uni
(
cs
,
&
t_wc
,
t
,
te
);
if
(
s_res
<=
0
||
t_res
<=
0
)
if
(
s_res
<=
0
||
t_res
<=
0
)
{
{
/* Incorrect string, compare by
char
value */
/* Incorrect string, compare by
te by byte
value */
return
((
int
)
s
[
0
]
-
(
int
)
t
[
0
]);
return
bincmp
(
s
,
se
,
t
,
te
);
}
}
plane
=
(
s_wc
>>
8
)
&
0xFF
;
plane
=
(
s_wc
>>
8
)
&
0xFF
;
s_wc
=
uni_plane
[
plane
]
?
uni_plane
[
plane
][
s_wc
&
0xFF
].
sort
:
s_wc
;
s_wc
=
uni_plane
[
plane
]
?
uni_plane
[
plane
][
s_wc
&
0xFF
].
sort
:
s_wc
;
plane
=
(
t_wc
>>
8
)
&
0xFF
;
plane
=
(
t_wc
>>
8
)
&
0xFF
;
...
@@ -1836,7 +1845,7 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs,
...
@@ -1836,7 +1845,7 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs,
{
{
return
((
int
)
s_wc
)
-
((
int
)
t_wc
);
return
((
int
)
s_wc
)
-
((
int
)
t_wc
);
}
}
s
+=
s_res
;
s
+=
s_res
;
t
+=
t_res
;
t
+=
t_res
;
}
}
...
@@ -1850,11 +1859,11 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs,
...
@@ -1850,11 +1859,11 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs,
SYNOPSIS
SYNOPSIS
my_strnncollsp_utf8()
my_strnncollsp_utf8()
cs
character set handler
cs
character set handler
a
First string to compare
a
First string to compare
a_length
Length of 'a'
a_length
Length of 'a'
b
Second string to compare
b
Second string to compare
b_length
Length of 'b'
b_length
Length of 'b'
IMPLEMENTATION
IMPLEMENTATION
If one string is shorter as the other, then we space extend the other
If one string is shorter as the other, then we space extend the other
...
@@ -1867,32 +1876,32 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs,
...
@@ -1867,32 +1876,32 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs,
"a\0" < "a "
"a\0" < "a "
RETURN
RETURN
< 0
a < b
< 0
a < b
= 0
a == b
= 0
a == b
> 0
a > b
> 0
a > b
*/
*/
static
int
my_strnncollsp_utf8
(
CHARSET_INFO
*
cs
,
static
int
my_strnncollsp_utf8
(
CHARSET_INFO
*
cs
,
const
uchar
*
s
,
uint
slen
,
const
uchar
*
s
,
uint
slen
,
const
uchar
*
t
,
uint
tlen
)
const
uchar
*
t
,
uint
tlen
)
{
{
int
s_res
,
t_res
;
int
s_res
,
t_res
;
my_wc_t
s_wc
,
t_wc
;
my_wc_t
s_wc
,
t_wc
;
const
uchar
*
se
=
s
+
slen
;
const
uchar
*
se
=
s
+
slen
;
const
uchar
*
te
=
t
+
tlen
;
const
uchar
*
te
=
t
+
tlen
;
while
(
s
<
se
&&
t
<
te
)
while
(
s
<
se
&&
t
<
te
)
{
{
int
plane
;
int
plane
;
s_res
=
my_utf8_uni
(
cs
,
&
s_wc
,
s
,
se
);
s_res
=
my_utf8_uni
(
cs
,
&
s_wc
,
s
,
se
);
t_res
=
my_utf8_uni
(
cs
,
&
t_wc
,
t
,
te
);
t_res
=
my_utf8_uni
(
cs
,
&
t_wc
,
t
,
te
);
if
(
s_res
<=
0
||
t_res
<=
0
)
if
(
s_res
<=
0
||
t_res
<=
0
)
{
{
/* Incorrect string, compare by
char
value */
/* Incorrect string, compare by
te by byte
value */
return
((
int
)
s
[
0
]
-
(
int
)
t
[
0
]);
return
bincmp
(
s
,
se
,
t
,
te
);
}
}
plane
=
(
s_wc
>>
8
)
&
0xFF
;
plane
=
(
s_wc
>>
8
)
&
0xFF
;
s_wc
=
uni_plane
[
plane
]
?
uni_plane
[
plane
][
s_wc
&
0xFF
].
sort
:
s_wc
;
s_wc
=
uni_plane
[
plane
]
?
uni_plane
[
plane
][
s_wc
&
0xFF
].
sort
:
s_wc
;
plane
=
(
t_wc
>>
8
)
&
0xFF
;
plane
=
(
t_wc
>>
8
)
&
0xFF
;
...
@@ -1901,14 +1910,14 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
...
@@ -1901,14 +1910,14 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
{
{
return
((
int
)
s_wc
)
-
((
int
)
t_wc
);
return
((
int
)
s_wc
)
-
((
int
)
t_wc
);
}
}
s
+=
s_res
;
s
+=
s_res
;
t
+=
t_res
;
t
+=
t_res
;
}
}
slen
=
se
-
s
;
slen
=
se
-
s
;
tlen
=
te
-
t
;
tlen
=
te
-
t
;
if
(
slen
!=
tlen
)
if
(
slen
!=
tlen
)
{
{
int
swap
=
0
;
int
swap
=
0
;
...
@@ -1940,35 +1949,35 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
...
@@ -1940,35 +1949,35 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
static
int
my_strncasecmp_utf8
(
CHARSET_INFO
*
cs
,
static
int
my_strncasecmp_utf8
(
CHARSET_INFO
*
cs
,
const
char
*
s
,
const
char
*
t
,
uint
len
)
const
char
*
s
,
const
char
*
t
,
uint
len
)
{
{
int
s_res
,
t_res
;
int
s_res
,
t_res
;
my_wc_t
s_wc
,
t_wc
;
my_wc_t
s_wc
,
t_wc
;
const
char
*
se
=
s
+
len
;
const
char
*
se
=
s
+
len
;
const
char
*
te
=
t
+
len
;
const
char
*
te
=
t
+
len
;
while
(
s
<
se
&&
t
<
te
)
while
(
s
<
se
&&
t
<
te
)
{
{
int
plane
;
int
plane
;
s_res
=
my_utf8_uni
(
cs
,
&
s_wc
,
(
const
uchar
*
)
s
,
(
const
uchar
*
)
se
);
s_res
=
my_utf8_uni
(
cs
,
&
s_wc
,
(
const
uchar
*
)
s
,
(
const
uchar
*
)
se
);
t_res
=
my_utf8_uni
(
cs
,
&
t_wc
,
(
const
uchar
*
)
t
,
(
const
uchar
*
)
te
);
t_res
=
my_utf8_uni
(
cs
,
&
t_wc
,
(
const
uchar
*
)
t
,
(
const
uchar
*
)
te
);
if
(
s_res
<=
0
||
t_res
<=
0
)
if
(
s_res
<=
0
||
t_res
<=
0
)
{
{
/* Incorrect string, compare by
char
value */
/* Incorrect string, compare by
te by byte
value */
return
((
int
)
s
[
0
]
-
(
int
)
t
[
0
]);
return
bincmp
(
s
,
se
,
t
,
te
);
}
}
plane
=
(
s_wc
>>
8
)
&
0xFF
;
plane
=
(
s_wc
>>
8
)
&
0xFF
;
s_wc
=
uni_plane
[
plane
]
?
uni_plane
[
plane
][
s_wc
&
0xFF
].
tolower
:
s_wc
;
s_wc
=
uni_plane
[
plane
]
?
uni_plane
[
plane
][
s_wc
&
0xFF
].
tolower
:
s_wc
;
plane
=
(
t_wc
>>
8
)
&
0xFF
;
plane
=
(
t_wc
>>
8
)
&
0xFF
;
t_wc
=
uni_plane
[
plane
]
?
uni_plane
[
plane
][
t_wc
&
0xFF
].
tolower
:
t_wc
;
t_wc
=
uni_plane
[
plane
]
?
uni_plane
[
plane
][
t_wc
&
0xFF
].
tolower
:
t_wc
;
if
(
s_wc
!=
t_wc
)
if
(
s_wc
!=
t_wc
)
return
((
int
)
s_wc
)
-
((
int
)
t_wc
);
return
((
int
)
s_wc
)
-
((
int
)
t_wc
);
s
+=
s_res
;
s
+=
s_res
;
t
+=
t_res
;
t
+=
t_res
;
}
}
...
@@ -1983,9 +1992,9 @@ static int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
...
@@ -1983,9 +1992,9 @@ static int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
return
my_strncasecmp_utf8
(
cs
,
s
,
t
,
len
);
return
my_strncasecmp_utf8
(
cs
,
s
,
t
,
len
);
}
}
static
int
my_strnxfrm_utf8
(
CHARSET_INFO
*
cs
,
static
int
my_strnxfrm_utf8
(
CHARSET_INFO
*
cs
,
uchar
*
dst
,
uint
dstlen
,
uchar
*
dst
,
uint
dstlen
,
const
uchar
*
src
,
uint
srclen
)
const
uchar
*
src
,
uint
srclen
)
{
{
my_wc_t
wc
;
my_wc_t
wc
;
int
res
;
int
res
;
...
@@ -2002,10 +2011,10 @@ static int my_strnxfrm_utf8(CHARSET_INFO *cs,
...
@@ -2002,10 +2011,10 @@ static int my_strnxfrm_utf8(CHARSET_INFO *cs,
}
}
src
+=
res
;
src
+=
res
;
srclen
-=
res
;
srclen
-=
res
;
plane
=
(
wc
>>
8
)
&
0xFF
;
plane
=
(
wc
>>
8
)
&
0xFF
;
wc
=
uni_plane
[
plane
]
?
uni_plane
[
plane
][
wc
&
0xFF
].
sort
:
wc
;
wc
=
uni_plane
[
plane
]
?
uni_plane
[
plane
][
wc
&
0xFF
].
sort
:
wc
;
if
((
res
=
my_uni_utf8
(
cs
,
wc
,
dst
,
de
))
<
0
)
if
((
res
=
my_uni_utf8
(
cs
,
wc
,
dst
,
de
))
<
0
)
{
{
break
;
break
;
...
@@ -2026,18 +2035,18 @@ static int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c)
...
@@ -2026,18 +2035,18 @@ static int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c)
{
{
if
(
c
<
0x80
)
if
(
c
<
0x80
)
return
1
;
return
1
;
else
if
(
c
<
0xc2
)
else
if
(
c
<
0xc2
)
return
0
;
/* Illegal mb head */
return
0
;
/* Illegal mb head */
else
if
(
c
<
0xe0
)
else
if
(
c
<
0xe0
)
return
2
;
return
2
;
else
if
(
c
<
0xf0
)
else
if
(
c
<
0xf0
)
return
3
;
return
3
;
#ifdef UNICODE_32BIT
#ifdef UNICODE_32BIT
else
if
(
c
<
0xf8
)
else
if
(
c
<
0xf8
)
return
4
;
return
4
;
else
if
(
c
<
0xfc
)
else
if
(
c
<
0xfc
)
return
5
;
return
5
;
else
if
(
c
<
0xfe
)
else
if
(
c
<
0xfe
)
return
6
;
return
6
;
#endif
#endif
return
0
;
/* Illegal mb head */
;
return
0
;
/* Illegal mb head */
;
...
@@ -2046,7 +2055,7 @@ static int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c)
...
@@ -2046,7 +2055,7 @@ static int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c)
static
MY_COLLATION_HANDLER
my_collation_ci_handler
=
static
MY_COLLATION_HANDLER
my_collation_ci_handler
=
{
{
NULL
,
/* init */
NULL
,
/* init */
my_strnncoll_utf8
,
my_strnncoll_utf8
,
my_strnncollsp_utf8
,
my_strnncollsp_utf8
,
my_strnxfrm_utf8
,
my_strnxfrm_utf8
,
...
@@ -2059,7 +2068,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
...
@@ -2059,7 +2068,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
MY_CHARSET_HANDLER
my_charset_utf8_handler
=
MY_CHARSET_HANDLER
my_charset_utf8_handler
=
{
{
NULL
,
/* init */
NULL
,
/* init */
my_ismbchar_utf8
,
my_ismbchar_utf8
,
my_mbcharlen_utf8
,
my_mbcharlen_utf8
,
my_numchars_mb
,
my_numchars_mb
,
...
@@ -2089,27 +2098,27 @@ MY_CHARSET_HANDLER my_charset_utf8_handler=
...
@@ -2089,27 +2098,27 @@ MY_CHARSET_HANDLER my_charset_utf8_handler=
CHARSET_INFO
my_charset_utf8_general_ci
=
CHARSET_INFO
my_charset_utf8_general_ci
=
{
{
33
,
0
,
0
,
/* number */
33
,
0
,
0
,
/* number */
MY_CS_COMPILED
|
MY_CS_PRIMARY
|
MY_CS_STRNXFRM
|
MY_CS_UNICODE
,
/* state */
MY_CS_COMPILED
|
MY_CS_PRIMARY
|
MY_CS_STRNXFRM
|
MY_CS_UNICODE
,
/* state */
"utf8"
,
/* cs name */
"utf8"
,
/* cs name */
"utf8_general_ci"
,
/* name */
"utf8_general_ci"
,
/* name */
""
,
/* comment */
""
,
/* comment */
NULL
,
/* tailoring */
NULL
,
/* tailoring */
ctype_utf8
,
/* ctype */
ctype_utf8
,
/* ctype */
to_lower_utf8
,
/* to_lower */
to_lower_utf8
,
/* to_lower */
to_upper_utf8
,
/* to_upper */
to_upper_utf8
,
/* to_upper */
to_upper_utf8
,
/* sort_order */
to_upper_utf8
,
/* sort_order */
NULL
,
/* contractions */
NULL
,
/* contractions */
NULL
,
/* sort_order_big*/
NULL
,
/* sort_order_big*/
NULL
,
/* tab_to_uni */
NULL
,
/* tab_to_uni */
NULL
,
/* tab_from_uni */
NULL
,
/* tab_from_uni */
NULL
,
/* state_map */
NULL
,
/* state_map */
NULL
,
/* ident_map */
NULL
,
/* ident_map */
1
,
/* strxfrm_multiply */
1
,
/* strxfrm_multiply */
1
,
/* mbminlen */
1
,
/* mbminlen */
3
,
/* mbmaxlen */
3
,
/* mbmaxlen */
0
,
/* min_sort_char */
0
,
/* min_sort_char */
255
,
/* max_sort_char */
255
,
/* max_sort_char */
&
my_charset_utf8_handler
,
&
my_charset_utf8_handler
,
&
my_collation_ci_handler
&
my_collation_ci_handler
};
};
...
@@ -2117,27 +2126,27 @@ CHARSET_INFO my_charset_utf8_general_ci=
...
@@ -2117,27 +2126,27 @@ CHARSET_INFO my_charset_utf8_general_ci=
CHARSET_INFO
my_charset_utf8_bin
=
CHARSET_INFO
my_charset_utf8_bin
=
{
{
83
,
0
,
0
,
/* number */
83
,
0
,
0
,
/* number */
MY_CS_COMPILED
|
MY_CS_BINSORT
|
MY_CS_UNICODE
,
/* state */
MY_CS_COMPILED
|
MY_CS_BINSORT
|
MY_CS_UNICODE
,
/* state */
"utf8"
,
/* cs name */
"utf8"
,
/* cs name */
"utf8_bin"
,
/* name */
"utf8_bin"
,
/* name */
""
,
/* comment */
""
,
/* comment */
NULL
,
/* tailoring */
NULL
,
/* tailoring */
ctype_utf8
,
/* ctype */
ctype_utf8
,
/* ctype */
to_lower_utf8
,
/* to_lower */
to_lower_utf8
,
/* to_lower */
to_upper_utf8
,
/* to_upper */
to_upper_utf8
,
/* to_upper */
NULL
,
/* sort_order */
NULL
,
/* sort_order */
NULL
,
/* contractions */
NULL
,
/* contractions */
NULL
,
/* sort_order_big*/
NULL
,
/* sort_order_big*/
NULL
,
/* tab_to_uni */
NULL
,
/* tab_to_uni */
NULL
,
/* tab_from_uni */
NULL
,
/* tab_from_uni */
NULL
,
/* state_map */
NULL
,
/* state_map */
NULL
,
/* ident_map */
NULL
,
/* ident_map */
1
,
/* strxfrm_multiply */
1
,
/* strxfrm_multiply */
1
,
/* mbminlen */
1
,
/* mbminlen */
3
,
/* mbmaxlen */
3
,
/* mbmaxlen */
0
,
/* min_sort_char */
0
,
/* min_sort_char */
255
,
/* max_sort_char */
255
,
/* max_sort_char */
&
my_charset_utf8_handler
,
&
my_charset_utf8_handler
,
&
my_collation_mb_bin_handler
&
my_collation_mb_bin_handler
};
};
...
@@ -2155,8 +2164,8 @@ static void test_mb(CHARSET_INFO *cs, uchar *s)
...
@@ -2155,8 +2164,8 @@ static void test_mb(CHARSET_INFO *cs, uchar *s)
int
len
=
my_mbcharlen_utf8
(
cs
,
*
s
);
int
len
=
my_mbcharlen_utf8
(
cs
,
*
s
);
while
(
len
--
)
while
(
len
--
)
{
{
printf
(
"%c"
,
*
s
);
printf
(
"%c"
,
*
s
);
s
++
;
s
++
;
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
...
@@ -2172,23 +2181,23 @@ int main()
...
@@ -2172,23 +2181,23 @@ int main()
{
{
char
str
[
1024
]
=
" utf8 test проба ПЕРА по-РУССКИ"
;
char
str
[
1024
]
=
" utf8 test проба ПЕРА по-РУССКИ"
;
CHARSET_INFO
*
cs
;
CHARSET_INFO
*
cs
;
test_mb
(
cs
,(
uchar
*
)
str
);
test_mb
(
cs
,(
uchar
*
)
str
);
printf
(
"orig :'%s'
\n
"
,
str
);
printf
(
"orig :'%s'
\n
"
,
str
);
my_caseup_utf8
(
cs
,
str
,
15
);
my_caseup_utf8
(
cs
,
str
,
15
);
printf
(
"caseup :'%s'
\n
"
,
str
);
printf
(
"caseup :'%s'
\n
"
,
str
);
my_caseup_str_utf8
(
cs
,
str
);
my_caseup_str_utf8
(
cs
,
str
);
printf
(
"caseup_str:'%s'
\n
"
,
str
);
printf
(
"caseup_str:'%s'
\n
"
,
str
);
my_casedn_utf8
(
cs
,
str
,
15
);
my_casedn_utf8
(
cs
,
str
,
15
);
printf
(
"casedn :'%s'
\n
"
,
str
);
printf
(
"casedn :'%s'
\n
"
,
str
);
my_casedn_str_utf8
(
cs
,
str
);
my_casedn_str_utf8
(
cs
,
str
);
printf
(
"casedn_str:'%s'
\n
"
,
str
);
printf
(
"casedn_str:'%s'
\n
"
,
str
);
return
0
;
return
0
;
}
}
...
...
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