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
50c39153
Commit
50c39153
authored
Oct 09, 2002
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
my_sortcmp -> my_strnncoll
parent
954a47b9
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
44 additions
and
90 deletions
+44
-90
client/mysql.cc
client/mysql.cc
+3
-2
heap/hp_hash.c
heap/hp_hash.c
+2
-2
include/my_sys.h
include/my_sys.h
+0
-2
libmysql/Makefile.shared
libmysql/Makefile.shared
+1
-1
mysys/Makefile.am
mysys/Makefile.am
+1
-1
mysys/charset.c
mysys/charset.c
+1
-0
mysys/mf_casecnv.c
mysys/mf_casecnv.c
+0
-67
sql/field.cc
sql/field.cc
+27
-9
sql/ha_innodb.cc
sql/ha_innodb.cc
+3
-3
sql/item_sum.cc
sql/item_sum.cc
+3
-1
sql/key.cc
sql/key.cc
+3
-2
No files found.
client/mysql.cc
View file @
50c39153
...
@@ -1396,8 +1396,9 @@ com_go(String *buffer,char *line __attribute__((unused)))
...
@@ -1396,8 +1396,9 @@ com_go(String *buffer,char *line __attribute__((unused)))
(
void
)
com_print
(
buffer
,
0
);
(
void
)
com_print
(
buffer
,
0
);
if
(
skip_updates
&&
if
(
skip_updates
&&
(
buffer
->
length
()
<
4
||
my_sortcmp
(
system_charset_info
,
buffer
->
ptr
(),
(
buffer
->
length
()
<
4
||
my_strnncoll
(
system_charset_info
,
"SET "
,
4
)))
(
const
uchar
*
)
buffer
->
ptr
(),
4
,
(
const
uchar
*
)
"SET "
,
4
)))
{
{
(
void
)
put_info
(
"Ignoring query to other database"
,
INFO_INFO
);
(
void
)
put_info
(
"Ignoring query to other database"
,
INFO_INFO
);
return
0
;
return
0
;
...
...
heap/hp_hash.c
View file @
50c39153
...
@@ -401,7 +401,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2)
...
@@ -401,7 +401,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2)
}
}
if
(
seg
->
type
==
HA_KEYTYPE_TEXT
)
if
(
seg
->
type
==
HA_KEYTYPE_TEXT
)
{
{
if
(
my_s
ortcmp
(
seg
->
charset
,
rec1
+
seg
->
start
,
rec2
+
seg
->
start
,
seg
->
length
))
if
(
my_s
trnncoll
(
seg
->
charset
,
rec1
+
seg
->
start
,
seg
->
length
,
rec2
+
seg
->
start
,
seg
->
length
))
return
1
;
return
1
;
}
}
else
else
...
@@ -433,7 +433,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
...
@@ -433,7 +433,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
}
}
if
(
seg
->
type
==
HA_KEYTYPE_TEXT
)
if
(
seg
->
type
==
HA_KEYTYPE_TEXT
)
{
{
if
(
my_s
ortcmp
(
seg
->
charset
,
rec
+
seg
->
start
,
key
,
seg
->
length
))
if
(
my_s
trnncoll
(
seg
->
charset
,
rec
+
seg
->
start
,
seg
->
length
,
key
,
seg
->
length
))
return
1
;
return
1
;
}
}
else
else
...
...
include/my_sys.h
View file @
50c39153
...
@@ -607,8 +607,6 @@ extern my_string my_path(my_string to,const char *progname,
...
@@ -607,8 +607,6 @@ extern my_string my_path(my_string to,const char *progname,
extern
my_string
my_load_path
(
my_string
to
,
const
char
*
path
,
extern
my_string
my_load_path
(
my_string
to
,
const
char
*
path
,
const
char
*
own_path_prefix
);
const
char
*
own_path_prefix
);
extern
int
wild_compare
(
const
char
*
str
,
const
char
*
wildstr
);
extern
int
wild_compare
(
const
char
*
str
,
const
char
*
wildstr
);
extern
int
my_sortcmp
(
CHARSET_INFO
*
cs
,
const
char
*
s
,
const
char
*
t
,
uint
length
);
extern
int
my_sortncmp
(
CHARSET_INFO
*
cs
,
const
char
*
s
,
uint
s_len
,
const
char
*
t
,
uint
t_len
);
extern
WF_PACK
*
wf_comp
(
my_string
str
);
extern
WF_PACK
*
wf_comp
(
my_string
str
);
extern
int
wf_test
(
struct
wild_file_pack
*
wf_pack
,
const
char
*
name
);
extern
int
wf_test
(
struct
wild_file_pack
*
wf_pack
,
const
char
*
name
);
extern
void
wf_end
(
struct
wild_file_pack
*
buffer
);
extern
void
wf_end
(
struct
wild_file_pack
*
buffer
);
...
...
libmysql/Makefile.shared
View file @
50c39153
...
@@ -49,7 +49,7 @@ dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo
...
@@ -49,7 +49,7 @@ dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo
mysysheaders
=
mysys_priv.h my_static.h
mysysheaders
=
mysys_priv.h my_static.h
mysysobjects1
=
my_init.lo my_static.lo my_malloc.lo my_realloc.lo
\
mysysobjects1
=
my_init.lo my_static.lo my_malloc.lo my_realloc.lo
\
my_create.lo my_delete.lo mf_tempfile.lo my_open.lo
\
my_create.lo my_delete.lo mf_tempfile.lo my_open.lo
\
m
f_casecnv.lo m
y_read.lo my_write.lo errors.lo
\
my_read.lo my_write.lo errors.lo
\
my_error.lo my_getwd.lo my_div.lo
\
my_error.lo my_getwd.lo my_div.lo
\
mf_pack.lo my_messnc.lo mf_dirname.lo mf_fn_ext.lo
\
mf_pack.lo my_messnc.lo mf_dirname.lo mf_fn_ext.lo
\
mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo
\
mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo
\
...
...
mysys/Makefile.am
View file @
50c39153
...
@@ -39,7 +39,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
...
@@ -39,7 +39,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c
\
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c
\
my_symlink.c my_symlink2.c
\
my_symlink.c my_symlink2.c
\
mf_pack.c mf_unixpath.c mf_strip.c
\
mf_pack.c mf_unixpath.c mf_strip.c
\
mf_
casecnv.c mf_
soundex.c mf_wcomp.c mf_wfile.c
\
mf_soundex.c mf_wcomp.c mf_wfile.c
\
mf_qsort.c mf_qsort2.c mf_sort.c
\
mf_qsort.c mf_qsort2.c mf_sort.c
\
ptr_cmp.c mf_radix.c queues.c
\
ptr_cmp.c mf_radix.c queues.c
\
tree.c list.c hash.c array.c string.c typelib.c
\
tree.c list.c hash.c array.c string.c typelib.c
\
...
...
mysys/charset.c
View file @
50c39153
...
@@ -373,6 +373,7 @@ static CHARSET_INFO *add_charset(uint cs_number, myf flags)
...
@@ -373,6 +373,7 @@ static CHARSET_INFO *add_charset(uint cs_number, myf flags)
sizeof
(
tmp_sort_order
));
sizeof
(
tmp_sort_order
));
memcpy
((
char
*
)
cs
->
tab_to_uni
,
(
char
*
)
tmp_to_uni
,
sizeof
(
tmp_to_uni
));
memcpy
((
char
*
)
cs
->
tab_to_uni
,
(
char
*
)
tmp_to_uni
,
sizeof
(
tmp_to_uni
));
cs
->
strnncoll
=
my_strnncoll_simple
;
cs
->
caseup_str
=
my_caseup_str_8bit
;
cs
->
caseup_str
=
my_caseup_str_8bit
;
cs
->
casedn_str
=
my_casedn_str_8bit
;
cs
->
casedn_str
=
my_casedn_str_8bit
;
cs
->
caseup
=
my_caseup_8bit
;
cs
->
caseup
=
my_caseup_8bit
;
...
...
mysys/mf_casecnv.c
deleted
100644 → 0
View file @
954a47b9
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Functions to convert to lover_case and to upper_case.
*/
#include "mysys_priv.h"
#include <m_ctype.h>
#ifndef SCO
#include <m_string.h>
#endif
int
my_sortcmp
(
CHARSET_INFO
*
cs
,
const
char
*
s
,
const
char
*
t
,
uint
len
)
{
#ifdef USE_STRCOLL
if
(
use_strnxfrm
(
cs
))
return
my_strnncoll
(
cs
,(
uchar
*
)
s
,
len
,
(
uchar
*
)
t
,
len
);
else
#endif
{
register
uchar
*
map
=
cs
->
sort_order
;
while
(
len
--
)
{
if
(
map
[(
uchar
)
*
s
++
]
!=
map
[(
uchar
)
*
t
++
])
return
((
int
)
map
[(
uchar
)
s
[
-
1
]]
-
(
int
)
map
[(
uchar
)
t
[
-
1
]]);
}
return
0
;
}
}
int
my_sortncmp
(
CHARSET_INFO
*
cs
,
const
char
*
s
,
uint
s_len
,
const
char
*
t
,
uint
t_len
)
{
#ifdef USE_STRCOLL
if
(
use_strnxfrm
(
cs
))
return
my_strnncoll
(
cs
,
(
uchar
*
)
s
,
s_len
,
(
uchar
*
)
t
,
t_len
);
else
#endif
{
uint
len
=
min
(
s_len
,
t_len
);
register
uchar
*
map
=
cs
->
sort_order
;
while
(
len
--
)
{
if
(
map
[(
uchar
)
*
s
++
]
!=
map
[(
uchar
)
*
t
++
])
return
((
int
)
map
[(
uchar
)
s
[
-
1
]]
-
(
int
)
map
[(
uchar
)
t
[
-
1
]]);
}
return
(
int
)
(
s_len
-
t_len
);
}
}
sql/field.cc
View file @
50c39153
...
@@ -3831,7 +3831,9 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
...
@@ -3831,7 +3831,9 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
if
(
binary_flag
)
if
(
binary_flag
)
return
memcmp
(
a_ptr
,
b_ptr
,
field_length
);
return
memcmp
(
a_ptr
,
b_ptr
,
field_length
);
else
else
return
my_sortcmp
(
field_charset
,
a_ptr
,
b_ptr
,
field_length
);
return
my_strnncoll
(
field_charset
,
(
const
uchar
*
)
a_ptr
,
field_length
,
(
const
uchar
*
)
b_ptr
,
field_length
);
}
}
void
Field_string
::
sort_string
(
char
*
to
,
uint
length
)
void
Field_string
::
sort_string
(
char
*
to
,
uint
length
)
...
@@ -3907,7 +3909,9 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length)
...
@@ -3907,7 +3909,9 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length)
int
cmp
=
memcmp
(
a
,
b
,
min
(
a_length
,
b_length
));
int
cmp
=
memcmp
(
a
,
b
,
min
(
a_length
,
b_length
));
return
cmp
?
cmp
:
(
int
)
(
a_length
-
b_length
);
return
cmp
?
cmp
:
(
int
)
(
a_length
-
b_length
);
}
}
return
my_sortncmp
(
field_charset
,
a
,
a_length
,
b
,
b_length
);
return
my_strnncoll
(
field_charset
,
(
const
uchar
*
)
a
,
a_length
,
(
const
uchar
*
)
b
,
b_length
);
}
}
...
@@ -3924,7 +3928,9 @@ int Field_string::pack_cmp(const char *b, uint length)
...
@@ -3924,7 +3928,9 @@ int Field_string::pack_cmp(const char *b, uint length)
int
cmp
=
memcmp
(
ptr
,
b
,
min
(
a_length
,
b_length
));
int
cmp
=
memcmp
(
ptr
,
b
,
min
(
a_length
,
b_length
));
return
cmp
?
cmp
:
(
int
)
(
a_length
-
b_length
);
return
cmp
?
cmp
:
(
int
)
(
a_length
-
b_length
);
}
}
return
my_sortncmp
(
field_charset
,
ptr
,
a_length
,
b
,
b_length
);
return
my_strnncoll
(
field_charset
,
(
const
uchar
*
)
ptr
,
a_length
,
(
const
uchar
*
)
b
,
b_length
);
}
}
...
@@ -4033,7 +4039,9 @@ int Field_varstring::cmp(const char *a_ptr, const char *b_ptr)
...
@@ -4033,7 +4039,9 @@ int Field_varstring::cmp(const char *a_ptr, const char *b_ptr)
if
(
binary_flag
)
if
(
binary_flag
)
diff
=
memcmp
(
a_ptr
+
2
,
b_ptr
+
2
,
min
(
a_length
,
b_length
));
diff
=
memcmp
(
a_ptr
+
2
,
b_ptr
+
2
,
min
(
a_length
,
b_length
));
else
else
diff
=
my_sortcmp
(
field_charset
,
a_ptr
+
2
,
b_ptr
+
2
,
min
(
a_length
,
b_length
));
diff
=
my_strnncoll
(
field_charset
,
(
const
uchar
*
)
a_ptr
+
2
,
min
(
a_length
,
b_length
),
(
const
uchar
*
)
b_ptr
+
2
,
min
(
a_length
,
b_length
));
return
diff
?
diff
:
(
int
)
(
a_length
-
b_length
);
return
diff
?
diff
:
(
int
)
(
a_length
-
b_length
);
}
}
...
@@ -4134,7 +4142,9 @@ int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length)
...
@@ -4134,7 +4142,9 @@ int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length)
int
cmp
=
memcmp
(
a
,
b
,
min
(
a_length
,
b_length
));
int
cmp
=
memcmp
(
a
,
b
,
min
(
a_length
,
b_length
));
return
cmp
?
cmp
:
(
int
)
(
a_length
-
b_length
);
return
cmp
?
cmp
:
(
int
)
(
a_length
-
b_length
);
}
}
return
my_sortncmp
(
field_charset
,
a
,
a_length
,
b
,
b_length
);
return
my_strnncoll
(
field_charset
,
(
const
uchar
*
)
a
,
a_length
,
(
const
uchar
*
)
b
,
b_length
);
}
}
int
Field_varstring
::
pack_cmp
(
const
char
*
b
,
uint
key_length
)
int
Field_varstring
::
pack_cmp
(
const
char
*
b
,
uint
key_length
)
...
@@ -4155,7 +4165,9 @@ int Field_varstring::pack_cmp(const char *b, uint key_length)
...
@@ -4155,7 +4165,9 @@ int Field_varstring::pack_cmp(const char *b, uint key_length)
int
cmp
=
memcmp
(
a
,
b
,
min
(
a_length
,
b_length
));
int
cmp
=
memcmp
(
a
,
b
,
min
(
a_length
,
b_length
));
return
cmp
?
cmp
:
(
int
)
(
a_length
-
b_length
);
return
cmp
?
cmp
:
(
int
)
(
a_length
-
b_length
);
}
}
return
my_sortncmp
(
field_charset
,
a
,
a_length
,
b
,
b_length
);
return
my_strnncoll
(
field_charset
,
(
const
uchar
*
)
a
,
a_length
,
(
const
uchar
*
)
b
,
b_length
);
}
}
uint
Field_varstring
::
packed_col_length
(
const
char
*
ptr
,
uint
length
)
uint
Field_varstring
::
packed_col_length
(
const
char
*
ptr
,
uint
length
)
...
@@ -4382,7 +4394,9 @@ int Field_blob::cmp(const char *a,uint32 a_length, const char *b,
...
@@ -4382,7 +4394,9 @@ int Field_blob::cmp(const char *a,uint32 a_length, const char *b,
if
(
binary_flag
)
if
(
binary_flag
)
diff
=
memcmp
(
a
,
b
,
min
(
a_length
,
b_length
));
diff
=
memcmp
(
a
,
b
,
min
(
a_length
,
b_length
));
else
else
diff
=
my_sortcmp
(
field_charset
,
a
,
b
,
min
(
a_length
,
b_length
));
diff
=
my_strnncoll
(
field_charset
,
(
const
uchar
*
)
a
,
min
(
a_length
,
b_length
),
(
const
uchar
*
)
b
,
min
(
a_length
,
b_length
));
return
diff
?
diff
:
(
int
)
(
a_length
-
b_length
);
return
diff
?
diff
:
(
int
)
(
a_length
-
b_length
);
}
}
...
@@ -4631,7 +4645,9 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length)
...
@@ -4631,7 +4645,9 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length)
int
cmp
=
memcmp
(
a
,
b
,
min
(
a_length
,
b_length
));
int
cmp
=
memcmp
(
a
,
b
,
min
(
a_length
,
b_length
));
return
cmp
?
cmp
:
(
int
)
(
a_length
-
b_length
);
return
cmp
?
cmp
:
(
int
)
(
a_length
-
b_length
);
}
}
return
my_sortncmp
(
field_charset
,
a
,
a_length
,
b
,
b_length
);
return
my_strnncoll
(
field_charset
,
(
const
uchar
*
)
a
,
a_length
,
(
const
uchar
*
)
b
,
b_length
);
}
}
...
@@ -4657,7 +4673,9 @@ int Field_blob::pack_cmp(const char *b, uint key_length)
...
@@ -4657,7 +4673,9 @@ int Field_blob::pack_cmp(const char *b, uint key_length)
int
cmp
=
memcmp
(
a
,
b
,
min
(
a_length
,
b_length
));
int
cmp
=
memcmp
(
a
,
b
,
min
(
a_length
,
b_length
));
return
cmp
?
cmp
:
(
int
)
(
a_length
-
b_length
);
return
cmp
?
cmp
:
(
int
)
(
a_length
-
b_length
);
}
}
return
my_sortncmp
(
field_charset
,
a
,
a_length
,
b
,
b_length
);
return
my_strnncoll
(
field_charset
,
(
const
uchar
*
)
a
,
a_length
,
(
const
uchar
*
)
b
,
b_length
);
}
}
/* Create a packed key that will be used for storage from a MySQL row */
/* Create a packed key that will be used for storage from a MySQL row */
...
...
sql/ha_innodb.cc
View file @
50c39153
...
@@ -1366,9 +1366,9 @@ innobase_mysql_cmp(
...
@@ -1366,9 +1366,9 @@ innobase_mysql_cmp(
case
FIELD_TYPE_VAR_STRING
:
case
FIELD_TYPE_VAR_STRING
:
// BAR TODO: Discuss with heikki.tuuri@innodb.com
// BAR TODO: Discuss with heikki.tuuri@innodb.com
// so that he sends CHARSET_INFO for the field to this function.
// so that he sends CHARSET_INFO for the field to this function.
ret
=
my_s
ortncmp
(
default_charset_info
,
ret
=
my_s
trnncoll
(
default_charset_info
,
(
const
char
*
)
a
,
a_length
,
a
,
a_length
,
(
const
char
*
)
b
,
b_length
);
b
,
b_length
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
return
(
-
1
);
return
(
-
1
);
}
else
if
(
ret
>
0
)
{
}
else
if
(
ret
>
0
)
{
...
...
sql/item_sum.cc
View file @
50c39153
...
@@ -866,7 +866,9 @@ static int simple_raw_key_cmp(void* arg, byte* key1, byte* key2)
...
@@ -866,7 +866,9 @@ static int simple_raw_key_cmp(void* arg, byte* key1, byte* key2)
static
int
simple_str_key_cmp
(
void
*
arg
,
byte
*
key1
,
byte
*
key2
)
static
int
simple_str_key_cmp
(
void
*
arg
,
byte
*
key1
,
byte
*
key2
)
{
{
/* BAR TODO: remove default_charset_info */
/* BAR TODO: remove default_charset_info */
return
my_sortcmp
(
default_charset_info
,(
char
*
)
key1
,
(
char
*
)
key2
,
*
(
uint
*
)
arg
);
return
my_strnncoll
(
default_charset_info
,
(
const
uchar
*
)
key1
,
*
(
uint
*
)
arg
,
(
const
uchar
*
)
key2
,
*
(
uint
*
)
arg
);
}
}
/*
/*
...
...
sql/key.cc
View file @
50c39153
...
@@ -193,8 +193,9 @@ int key_cmp(TABLE *table,const byte *key,uint idx,uint key_length)
...
@@ -193,8 +193,9 @@ int key_cmp(TABLE *table,const byte *key,uint idx,uint key_length)
FIELDFLAG_PACK
)))
FIELDFLAG_PACK
)))
{
{
/* BAR TODO: I'm not sure this should be system_charset_info */
/* BAR TODO: I'm not sure this should be system_charset_info */
if
(
my_sortcmp
(
system_charset_info
,(
char
*
)
key
,
if
(
my_strnncoll
(
system_charset_info
,
(
char
*
)
table
->
record
[
0
]
+
key_part
->
offset
,
length
))
(
const
uchar
*
)
key
,
length
,
(
const
uchar
*
)
table
->
record
[
0
]
+
key_part
->
offset
,
length
))
return
1
;
return
1
;
}
}
else
if
(
memcmp
(
key
,
table
->
record
[
0
]
+
key_part
->
offset
,
length
))
else
if
(
memcmp
(
key
,
table
->
record
[
0
]
+
key_part
->
offset
,
length
))
...
...
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