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
954a47b9
Commit
954a47b9
authored
Oct 09, 2002
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simple charsets now have strncoll() field too
parent
40c0fd1c
Changes
16
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
118 additions
and
91 deletions
+118
-91
client/sql_string.cc
client/sql_string.cc
+1
-1
include/m_ctype.h
include/m_ctype.h
+8
-5
include/my_sys.h
include/my_sys.h
+0
-1
isam/_key.c
isam/_key.c
+6
-6
isam/_search.c
isam/_search.c
+2
-2
myisam/mi_open.c
myisam/mi_open.c
+1
-1
myisam/mi_search.c
myisam/mi_search.c
+1
-1
mysys/charset.c
mysys/charset.c
+1
-0
mysys/mf_casecnv.c
mysys/mf_casecnv.c
+3
-17
mysys/my_handler.c
mysys/my_handler.c
+1
-1
sql/field.cc
sql/field.cc
+3
-3
sql/filesort.cc
sql/filesort.cc
+5
-5
sql/opt_range.cc
sql/opt_range.cc
+1
-1
sql/sql_string.cc
sql/sql_string.cc
+1
-1
strings/ctype-simple.c
strings/ctype-simple.c
+13
-11
strings/ctype.c
strings/ctype.c
+71
-35
No files found.
client/sql_string.cc
View file @
954a47b9
...
...
@@ -507,7 +507,7 @@ int sortcmp(const String *x,const String *y)
uint32
x_len
=
x
->
length
(),
y_len
=
y
->
length
(),
len
=
min
(
x_len
,
y_len
);
#ifdef USE_STRCOLL
if
(
use_str
coll
(
x
->
str_charset
))
if
(
use_str
nxfrm
(
x
->
str_charset
))
{
#ifndef CMP_ENDSPACE
while
(
x_len
&&
my_isspace
(
x
->
str_charset
,
s
[
x_len
-
1
]))
...
...
include/m_ctype.h
View file @
954a47b9
...
...
@@ -92,11 +92,12 @@ typedef struct charset_info_st
int
(
*
wc_mb
)(
struct
charset_info_st
*
cs
,
my_wc_t
wc
,
unsigned
char
*
s
,
unsigned
char
*
e
);
/* Functions for case convertion */
/* Functions for case
and sort
convertion */
void
(
*
caseup_str
)(
struct
charset_info_st
*
,
char
*
);
void
(
*
casedn_str
)(
struct
charset_info_st
*
,
char
*
);
void
(
*
caseup
)(
struct
charset_info_st
*
,
char
*
,
uint
);
void
(
*
casedn
)(
struct
charset_info_st
*
,
char
*
,
uint
);
void
(
*
tosort
)(
struct
charset_info_st
*
,
char
*
,
uint
);
/* Functions for case comparison */
int
(
*
strcasecmp
)(
struct
charset_info_st
*
,
const
char
*
,
const
char
*
);
...
...
@@ -125,14 +126,15 @@ extern const char *compiled_charset_name(uint charset_number);
#define MY_CHARSET_CURRENT (default_charset_info->number)
/* declarations for simple charsets */
extern
int
my_strnxfrm_simple
(
CHARSET_INFO
*
,
char
*
,
uint
,
const
char
*
,
uint
);
extern
int
my_strnncoll_simple
(
CHARSET_INFO
*
,
const
char
*
,
uint
,
const
char
*
,
uint
);
extern
int
my_strnxfrm_simple
(
CHARSET_INFO
*
,
uchar
*
,
uint
,
const
u
char
*
,
uint
);
extern
int
my_strnncoll_simple
(
CHARSET_INFO
*
,
const
uchar
*
,
uint
,
const
u
char
*
,
uint
);
/* Functions for 8bit */
extern
void
my_caseup_str_8bit
(
CHARSET_INFO
*
,
char
*
);
extern
void
my_casedn_str_8bit
(
CHARSET_INFO
*
,
char
*
);
extern
void
my_caseup_8bit
(
CHARSET_INFO
*
,
char
*
,
uint
);
extern
void
my_casedn_8bit
(
CHARSET_INFO
*
,
char
*
,
uint
);
extern
void
my_tosort_8bit
(
CHARSET_INFO
*
,
char
*
,
uint
);
extern
int
my_strcasecmp_8bit
(
CHARSET_INFO
*
cs
,
const
char
*
,
const
char
*
);
extern
int
my_strncasecmp_8bit
(
CHARSET_INFO
*
cs
,
const
char
*
,
const
char
*
,
uint
);
...
...
@@ -364,7 +366,7 @@ void my_hash_sort_ucs2(struct charset_info_st *cs, const uchar *key, uint len, u
#define my_isvar(s,c) (my_isalnum(s,c) || (c) == '_')
#define my_isvar_start(s,c) (my_isalpha(s,c) || (c) == '_')
#define use_str
coll(s) ((s)->strnncoll
!= NULL)
#define use_str
nxfrm(s) ((s)->strnxfrm
!= NULL)
#define my_strnxfrm(s, a, b, c, d) ((s)->strnxfrm((s), (a), (b), (c), (d)))
#define my_strnncoll(s, a, b, c, d) ((s)->strnncoll((s), (a), (b), (c), (d)))
#define my_like_range(s, a, b, c, d, e, f, g, h) \
...
...
@@ -377,6 +379,7 @@ void my_hash_sort_ucs2(struct charset_info_st *cs, const uchar *key, uint len, u
#define my_caseup(s, a, l) ((s)->caseup((s), (a), (l)))
#define my_casedn(s, a, l) ((s)->casedn((s), (a), (l)))
#define my_tosort(s, a, l) ((s)->tosort((s), (a), (l)))
#define my_caseup_str(s, a) ((s)->caseup_str((s), (a)))
#define my_casedn_str(s, a) ((s)->casedn_str((s), (a)))
#define my_strcasecmp(s, a, b) ((s)->strcasecmp((s), (a), (b)))
...
...
include/my_sys.h
View file @
954a47b9
...
...
@@ -583,7 +583,6 @@ extern void allow_break(void);
#endif
extern
void
my_remember_signal
(
int
signal_number
,
sig_handler
(
*
func
)(
int
));
extern
void
case_sort
(
CHARSET_INFO
*
cs
,
my_string
str
,
uint
length
);
extern
uint
dirname_part
(
my_string
to
,
const
char
*
name
);
extern
uint
dirname_length
(
const
char
*
name
);
#define base_name(A) (A+dirname_length(A))
...
...
isam/_key.c
View file @
954a47b9
...
...
@@ -54,11 +54,11 @@ uint _nisam_make_key(register N_INFO *info, uint keynr, uchar *key, const char *
*
key
++=
(
uchar
)
(
length
=
(
uint
)
(
end
-
pos
));
memcpy
((
byte
*
)
key
,(
byte
*
)
pos
,(
size_t
)
length
);
#ifdef USE_STRCOLL
if
(
!
use_str
coll
(
default_charset_info
))
if
(
!
use_str
nxfrm
(
default_charset_info
))
#endif
{
if
(
type
==
HA_KEYTYPE_TEXT
)
case_
sort
(
default_charset_info
,(
byte
*
)
key
,
length
);
my_to
sort
(
default_charset_info
,(
byte
*
)
key
,
length
);
}
key
+=
length
;
}
...
...
@@ -67,11 +67,11 @@ uint _nisam_make_key(register N_INFO *info, uint keynr, uchar *key, const char *
memcpy
((
byte
*
)
key
,(
byte
*
)
record
+
keyseg
->
base
.
start
,
(
size_t
)
keyseg
->
base
.
length
);
#ifdef USE_STRCOLL
if
(
!
use_str
coll
(
default_charset_info
))
if
(
!
use_str
nxfrm
(
default_charset_info
))
#endif
{
if
(
type
==
HA_KEYTYPE_TEXT
)
case_
sort
(
default_charset_info
,(
byte
*
)
key
,(
uint
)
keyseg
->
base
.
length
);
my_to
sort
(
default_charset_info
,(
byte
*
)
key
,(
uint
)
keyseg
->
base
.
length
);
}
#ifdef NAN_TEST
else
if
(
type
==
HA_KEYTYPE_FLOAT
)
...
...
@@ -150,11 +150,11 @@ uint _nisam_pack_key(register N_INFO *info, uint keynr, uchar *key, uchar *old,
else
memcpy
((
byte
*
)
key
,
old
,(
size_t
)
length
);
#ifdef USE_STRCOLL
if
(
!
use_str
coll
(
default_charset_info
))
if
(
!
use_str
nxfrm
(
default_charset_info
))
#endif
{
if
(
type
==
HA_KEYTYPE_TEXT
)
case_
sort
(
default_charset_info
,(
byte
*
)
key
,
length
);
my_to
sort
(
default_charset_info
,(
byte
*
)
key
,
length
);
}
key
+=
length
;
}
...
...
isam/_search.c
View file @
954a47b9
...
...
@@ -332,7 +332,7 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar
end
=
a
+
min
(
key_length
,(
uint
)
length
);
#ifdef USE_STRCOLL
if
(
use_str
coll
(
default_charset_info
))
{
if
(
use_str
nxfrm
(
default_charset_info
))
{
if
(((
enum
ha_base_keytype
)
keyseg
->
base
.
type
)
==
HA_KEYTYPE_BINARY
)
{
while
(
a
<
end
)
...
...
@@ -383,7 +383,7 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar
else
{
#ifdef USE_STRCOLL
if
(
use_str
coll
(
default_charset_info
))
{
if
(
use_str
nxfrm
(
default_charset_info
))
{
if
(((
enum
ha_base_keytype
)
keyseg
->
base
.
type
)
==
HA_KEYTYPE_BINARY
)
{
while
(
a
<
end
)
...
...
myisam/mi_open.c
View file @
954a47b9
...
...
@@ -685,7 +685,7 @@ static void setup_key_functions(register MI_KEYDEF *keyinfo)
keyinfo
->
get_key
=
_mi_get_pack_key
;
if
(
keyinfo
->
seg
[
0
].
flag
&
HA_PACK_KEY
)
{
/* Prefix compression */
if
(
!
keyinfo
->
seg
->
charset
||
use_str
coll
(
keyinfo
->
seg
->
charset
)
||
if
(
!
keyinfo
->
seg
->
charset
||
use_str
nxfrm
(
keyinfo
->
seg
->
charset
)
||
(
keyinfo
->
seg
->
flag
&
HA_NULL_PART
))
keyinfo
->
bin_search
=
_mi_seq_search
;
else
...
...
myisam/mi_search.c
View file @
954a47b9
...
...
@@ -1287,7 +1287,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
if
((
keyinfo
->
flag
&
HA_FULLTEXT
)
&&
((
keyseg
->
type
==
HA_KEYTYPE_TEXT
)
||
(
keyseg
->
type
==
HA_KEYTYPE_VARTEXT
))
&&
!
use_str
coll
(
keyseg
->
charset
))
!
use_str
nxfrm
(
keyseg
->
charset
))
sort_order
=
keyseg
->
charset
->
sort_order
;
/* diff flag contains how many bytes is needed to pack key */
...
...
mysys/charset.c
View file @
954a47b9
...
...
@@ -377,6 +377,7 @@ static CHARSET_INFO *add_charset(uint cs_number, myf flags)
cs
->
casedn_str
=
my_casedn_str_8bit
;
cs
->
caseup
=
my_caseup_8bit
;
cs
->
casedn
=
my_casedn_8bit
;
cs
->
tosort
=
my_tosort_8bit
;
cs
->
strcasecmp
=
my_strcasecmp_8bit
;
cs
->
strncasecmp
=
my_strncasecmp_8bit
;
cs
->
mb_wc
=
my_mb_wc_8bit
;
...
...
mysys/mf_casecnv.c
View file @
954a47b9
...
...
@@ -15,11 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Functions to convert to lover_case and to upper_case in scandinavia.
case_sort converts a character string to a representaion that can
be compared by strcmp to find with is alfabetical bigger.
(lower- and uppercase letters is compared as the same)
Functions to convert to lover_case and to upper_case.
*/
#include "mysys_priv.h"
...
...
@@ -29,21 +25,11 @@
#endif
/* to sort-string that can be compared to get text in order */
void
case_sort
(
CHARSET_INFO
*
cs
,
my_string
str
,
uint
length
)
{
register
uchar
*
map
=
cs
->
sort_order
;
for
(
;
length
>
0
;
length
--
,
str
++
)
*
str
=
(
char
)
map
[(
uchar
)
*
str
];
}
/* case_sort */
int
my_sortcmp
(
CHARSET_INFO
*
cs
,
const
char
*
s
,
const
char
*
t
,
uint
len
)
{
#ifdef USE_STRCOLL
if
(
use_str
coll
(
cs
))
if
(
use_str
nxfrm
(
cs
))
return
my_strnncoll
(
cs
,(
uchar
*
)
s
,
len
,
(
uchar
*
)
t
,
len
);
else
#endif
...
...
@@ -63,7 +49,7 @@ int my_sortncmp(CHARSET_INFO *cs,
const
char
*
t
,
uint
t_len
)
{
#ifdef USE_STRCOLL
if
(
use_str
coll
(
cs
))
if
(
use_str
nxfrm
(
cs
))
return
my_strnncoll
(
cs
,
(
uchar
*
)
s
,
s_len
,
(
uchar
*
)
t
,
t_len
);
else
#endif
...
...
mysys/my_handler.c
View file @
954a47b9
...
...
@@ -23,7 +23,7 @@ int mi_compare_text(CHARSET_INFO *charset_info, uchar *a, uint a_length,
int
flag
;
#ifdef USE_STRCOLL
if
(
use_str
coll
(
charset_info
))
if
(
use_str
nxfrm
(
charset_info
))
{
if
(
part_key
&&
b_length
<
a_length
)
a_length
=
b_length
;
...
...
sql/field.cc
View file @
954a47b9
...
...
@@ -3841,7 +3841,7 @@ void Field_string::sort_string(char *to,uint length)
else
{
#ifdef USE_STRCOLL
if
(
use_str
coll
(
field_charset
))
{
if
(
use_str
nxfrm
(
field_charset
))
{
uint
tmp
=
my_strnxfrm
(
field_charset
,
(
unsigned
char
*
)
to
,
length
,
(
unsigned
char
*
)
ptr
,
field_length
);
...
...
@@ -4045,7 +4045,7 @@ void Field_varstring::sort_string(char *to,uint length)
else
{
#ifdef USE_STRCOLL
if
(
use_str
coll
(
field_charset
))
if
(
use_str
nxfrm
(
field_charset
))
tot_length
=
my_strnxfrm
(
field_charset
,
(
unsigned
char
*
)
to
,
length
,
(
unsigned
char
*
)
ptr
+
2
,
tot_length
);
...
...
@@ -4536,7 +4536,7 @@ void Field_blob::sort_string(char *to,uint length)
else
{
#ifdef USE_STRCOLL
if
(
use_str
coll
(
field_charset
))
if
(
use_str
nxfrm
(
field_charset
))
{
blob_length
=
my_strnxfrm
(
field_charset
,
(
unsigned
char
*
)
to
,
length
,
...
...
sql/filesort.cc
View file @
954a47b9
...
...
@@ -140,7 +140,7 @@ ha_rows filesort(TABLE *table, SORT_FIELD *sortorder, uint s_length,
records
=
param
.
max_rows
;
/* purecov: inspected */
#ifdef USE_STRCOLL
if
(
use_str
coll
(
charset
)
&&
if
(
use_str
nxfrm
(
charset
)
&&
!
(
param
.
tmp_buffer
=
my_malloc
(
param
.
sort_length
,
MYF
(
MY_WME
))))
goto
err
;
#endif
...
...
@@ -511,7 +511,7 @@ static void make_sortkey(register SORTPARAM *param,
length
=
sort_field
->
length
;
}
#ifdef USE_STRCOLL
if
(
use_str
coll
(
cs
))
if
(
use_str
nxfrm
(
cs
))
{
if
(
item
->
binary
)
{
...
...
@@ -541,7 +541,7 @@ static void make_sortkey(register SORTPARAM *param,
memcpy
(
to
,
res
->
ptr
(),
length
);
bzero
((
char
*
)
to
+
length
,
diff
);
if
(
!
item
->
binary
)
case_
sort
(
cs
,
(
char
*
)
to
,
length
);
my_to
sort
(
cs
,
(
char
*
)
to
,
length
);
#ifdef USE_STRCOLL
}
#endif
...
...
@@ -946,7 +946,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length)
if
(
!
sortorder
->
field
->
binary
())
{
CHARSET_INFO
*
cs
=
((
Field_str
*
)(
sortorder
->
field
))
->
charset
();
if
(
use_str
coll
(
cs
))
if
(
use_str
nxfrm
(
cs
))
sortorder
->
length
=
sortorder
->
length
*
cs
->
strxfrm_multiply
;
}
#endif
...
...
@@ -966,7 +966,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length)
if
(
!
sortorder
->
item
->
binary
)
{
CHARSET_INFO
*
cs
=
sortorder
->
item
->
str_value
.
charset
();
if
(
use_str
coll
(
cs
))
if
(
use_str
nxfrm
(
cs
))
sortorder
->
length
=
sortorder
->
length
*
cs
->
strxfrm_multiply
;
}
#endif
...
...
sql/opt_range.cc
View file @
954a47b9
...
...
@@ -978,7 +978,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
{
CHARSET_INFO
*
charset
=
((
Field_str
*
)(
field
))
->
charset
();
#ifdef USE_STRCOLL
if
(
use_str
coll
(
charset
))
if
(
use_str
nxfrm
(
charset
))
like_error
=
my_like_range
(
charset
,
res
->
ptr
(),
res
->
length
(),
wild_prefix
,
field_length
,
min_str
+
maybe_null
,
...
...
sql/sql_string.cc
View file @
954a47b9
...
...
@@ -505,7 +505,7 @@ int sortcmp(const String *x,const String *y)
uint32
x_len
=
x
->
length
(),
y_len
=
y
->
length
(),
len
=
min
(
x_len
,
y_len
);
#ifdef USE_STRCOLL
if
(
use_str
coll
(
x
->
str_charset
))
if
(
use_str
nxfrm
(
x
->
str_charset
))
{
#ifndef CMP_ENDSPACE
while
(
x_len
&&
my_isspace
(
x
->
str_charset
,
s
[
x_len
-
1
]))
...
...
strings/ctype-simple.c
View file @
954a47b9
...
...
@@ -20,32 +20,30 @@
#include "assert.h"
int
my_strnxfrm_simple
(
CHARSET_INFO
*
cs
,
char
*
dest
,
uint
len
,
const
char
*
src
,
uint
srclen
)
u
char
*
dest
,
uint
len
,
const
u
char
*
src
,
uint
srclen
)
{
uchar
*
map
=
cs
->
sort_order
;
DBUG_ASSERT
(
len
>=
srclen
);
for
(
;
len
>
0
;
len
--
)
*
dest
++=
(
char
)
map
[(
uchar
)
*
src
++
];
*
dest
++=
map
[
*
src
++
];
return
srclen
;
}
int
my_strnncoll_simple
(
CHARSET_INFO
*
cs
,
const
char
*
s
,
uint
slen
,
const
char
*
t
,
uint
tlen
)
int
my_strnncoll_simple
(
CHARSET_INFO
*
cs
,
const
u
char
*
s
,
uint
slen
,
const
u
char
*
t
,
uint
tlen
)
{
int
len
=
(
slen
>
tlen
)
?
tlen
:
slen
;
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
]]);
if
(
map
[
*
s
++
]
!=
map
[
*
t
++
])
return
((
int
)
map
[
s
[
-
1
]]
-
(
int
)
map
[
t
[
-
1
]]);
}
return
(
int
)
(
slen
-
tlen
);
}
void
my_caseup_str_8bit
(
CHARSET_INFO
*
cs
,
char
*
str
)
{
register
uchar
*
map
=
cs
->
to_upper
;
...
...
@@ -53,7 +51,6 @@ void my_caseup_str_8bit(CHARSET_INFO * cs,char *str)
str
++
;
}
void
my_casedn_str_8bit
(
CHARSET_INFO
*
cs
,
char
*
str
)
{
register
uchar
*
map
=
cs
->
to_lower
;
...
...
@@ -61,7 +58,6 @@ void my_casedn_str_8bit(CHARSET_INFO * cs,char *str)
str
++
;
}
void
my_caseup_8bit
(
CHARSET_INFO
*
cs
,
char
*
str
,
uint
length
)
{
register
uchar
*
map
=
cs
->
to_upper
;
...
...
@@ -76,6 +72,12 @@ void my_casedn_8bit(CHARSET_INFO * cs, char *str, uint length)
*
str
=
(
char
)
map
[(
uchar
)
*
str
];
}
void
my_tosort_8bit
(
CHARSET_INFO
*
cs
,
char
*
str
,
uint
length
)
{
register
uchar
*
map
=
cs
->
sort_order
;
for
(
;
length
>
0
;
length
--
,
str
++
)
*
str
=
(
char
)
map
[(
uchar
)
*
str
];
}
int
my_strcasecmp_8bit
(
CHARSET_INFO
*
cs
,
const
char
*
s
,
const
char
*
t
)
{
...
...
strings/ctype.c
View file @
954a47b9
This diff is collapsed.
Click to expand it.
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