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
feae02f9
Commit
feae02f9
authored
Aug 05, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Old style charset() and set_charset() were removed.
parent
65315f00
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
109 additions
and
122 deletions
+109
-122
sql/filesort.cc
sql/filesort.cc
+2
-2
sql/item.cc
sql/item.cc
+12
-11
sql/item.h
sql/item.h
+3
-18
sql/item_buff.cc
sql/item_buff.cc
+1
-1
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+22
-20
sql/item_func.cc
sql/item_func.cc
+8
-8
sql/item_strfunc.cc
sql/item_strfunc.cc
+22
-21
sql/item_strfunc.h
sql/item_strfunc.h
+12
-14
sql/item_sum.cc
sql/item_sum.cc
+1
-1
sql/item_timefunc.cc
sql/item_timefunc.cc
+4
-4
sql/item_timefunc.h
sql/item_timefunc.h
+10
-10
sql/opt_range.cc
sql/opt_range.cc
+1
-1
sql/set_var.h
sql/set_var.h
+1
-1
sql/sql_analyse.cc
sql/sql_analyse.cc
+6
-6
sql/sql_select.cc
sql/sql_select.cc
+4
-4
No files found.
sql/filesort.cc
View file @
feae02f9
...
...
@@ -519,7 +519,7 @@ static void make_sortkey(register SORTPARAM *param,
switch
(
sort_field
->
result_type
)
{
case
STRING_RESULT
:
{
CHARSET_INFO
*
cs
=
item
->
c
harset
()
;
CHARSET_INFO
*
cs
=
item
->
c
ollation
.
collation
;
if
((
maybe_null
=
item
->
maybe_null
))
*
to
++=
1
;
/* All item->str() to use some extra byte for end null.. */
...
...
@@ -1040,7 +1040,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
switch
((
sortorder
->
result_type
=
sortorder
->
item
->
result_type
()))
{
case
STRING_RESULT
:
sortorder
->
length
=
sortorder
->
item
->
max_length
;
if
(
use_strnxfrm
((
cs
=
sortorder
->
item
->
c
harset
()
)))
if
(
use_strnxfrm
((
cs
=
sortorder
->
item
->
c
ollation
.
collation
)))
{
sortorder
->
length
=
sortorder
->
length
*
cs
->
strxfrm_multiply
;
sortorder
->
need_strxnfrm
=
1
;
...
...
sql/item.cc
View file @
feae02f9
...
...
@@ -43,7 +43,7 @@ Item::Item():
{
marker
=
0
;
maybe_null
=
null_value
=
with_sum_func
=
unsigned_flag
=
0
;
set_char
set
(
default_charset
(),
DERIVATION_COERCIBLE
);
collation
.
set
(
default_charset
(),
DERIVATION_COERCIBLE
);
name
=
0
;
decimals
=
0
;
max_length
=
0
;
THD
*
thd
=
current_thd
;
...
...
@@ -149,7 +149,7 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const
{
if
(
binary_cmp
)
return
!
sortcmp
(
&
str_value
,
&
item
->
str_value
,
&
my_charset_bin
);
return
!
sortcmp
(
&
str_value
,
&
item
->
str_value
,
c
harset
()
);
return
!
sortcmp
(
&
str_value
,
&
item
->
str_value
,
c
ollation
.
collation
);
}
return
0
;
}
...
...
@@ -258,7 +258,7 @@ bool DTCollation::aggregate(DTCollation &dt)
Item_field
::
Item_field
(
Field
*
f
)
:
Item_ident
(
NullS
,
f
->
table_name
,
f
->
field_name
)
{
set_field
(
f
);
set_char
set
(
DERIVATION_IMPLICIT
);
collation
.
set
(
DERIVATION_IMPLICIT
);
fixed
=
1
;
// This item is not needed in fix_fields
}
...
...
@@ -267,7 +267,7 @@ Item_field::Item_field(THD *thd, Item_field &item):
Item_ident
(
thd
,
item
),
field
(
item
.
field
),
result_field
(
item
.
result_field
)
{
set_char
set
(
DERIVATION_IMPLICIT
);
}
{
collation
.
set
(
DERIVATION_IMPLICIT
);
}
void
Item_field
::
set_field
(
Field
*
field_par
)
{
...
...
@@ -279,7 +279,7 @@ void Item_field::set_field(Field *field_par)
field_name
=
field_par
->
field_name
;
db_name
=
field_par
->
table
->
table_cache_key
;
unsigned_flag
=
test
(
field_par
->
flags
&
UNSIGNED_FLAG
);
set_char
set
(
field_par
->
charset
(),
DERIVATION_IMPLICIT
);
collation
.
set
(
field_par
->
charset
(),
DERIVATION_IMPLICIT
);
}
const
char
*
Item_ident
::
full_name
()
const
...
...
@@ -962,7 +962,7 @@ void Item::init_make_field(Send_field *tmp_field,
tmp_field
->
org_col_name
=
empty_name
;
tmp_field
->
table_name
=
empty_name
;
tmp_field
->
col_name
=
name
;
tmp_field
->
charsetnr
=
c
harset
()
->
number
;
tmp_field
->
charsetnr
=
c
ollation
.
collation
->
number
;
tmp_field
->
flags
=
maybe_null
?
0
:
NOT_NULL_FLAG
;
tmp_field
->
type
=
field_type
;
tmp_field
->
length
=
max_length
;
...
...
@@ -1076,7 +1076,7 @@ int Item::save_in_field(Field *field, bool no_conversions)
field
->
result_type
()
==
STRING_RESULT
)
{
String
*
result
;
CHARSET_INFO
*
cs
=
charset
()
;
CHARSET_INFO
*
cs
=
collation
.
collation
;
char
buff
[
MAX_FIELD_WIDTH
];
// Alloc buffer for small columns
str_value
.
set_quick
(
buff
,
sizeof
(
buff
),
cs
);
result
=
val_str
(
&
str_value
);
...
...
@@ -1113,7 +1113,8 @@ int Item_string::save_in_field(Field *field, bool no_conversions)
if
(
null_value
)
return
set_field_to_null
(
field
);
field
->
set_notnull
();
return
(
field
->
store
(
result
->
ptr
(),
result
->
length
(),
charset
()))
?
-
1
:
0
;
return
(
field
->
store
(
result
->
ptr
(),
result
->
length
(),
collation
.
collation
))
?
-
1
:
0
;
}
...
...
@@ -1167,7 +1168,7 @@ Item_varbinary::Item_varbinary(const char *str, uint str_length)
str
+=
2
;
}
*
ptr
=
0
;
// Keep purify happy
set_char
set
(
&
my_charset_bin
,
DERIVATION_COERCIBLE
);
collation
.
set
(
&
my_charset_bin
,
DERIVATION_COERCIBLE
);
}
longlong
Item_varbinary
::
val_int
()
...
...
@@ -1188,7 +1189,7 @@ int Item_varbinary::save_in_field(Field *field, bool no_conversions)
field
->
set_notnull
();
if
(
field
->
result_type
()
==
STRING_RESULT
)
{
error
=
field
->
store
(
str_value
.
ptr
(),
str_value
.
length
(),
c
harset
()
);
error
=
field
->
store
(
str_value
.
ptr
(),
str_value
.
length
(),
c
ollation
.
collation
);
}
else
{
...
...
@@ -1686,7 +1687,7 @@ Item_cache* Item_cache::get_cache(Item_result type)
void
Item_cache_str
::
store
(
Item
*
item
)
{
str_value
.
set
(
buffer
,
sizeof
(
buffer
),
item
->
c
harset
()
);
str_value
.
set
(
buffer
,
sizeof
(
buffer
),
item
->
c
ollation
.
collation
);
value
=
item
->
str_result
(
&
str_value
);
if
((
null_value
=
item
->
null_value
))
value
=
0
;
...
...
sql/item.h
View file @
feae02f9
...
...
@@ -169,21 +169,6 @@ class Item {
virtual
Item
*
get_tmp_table_item
(
THD
*
thd
)
{
return
copy_or_same
(
thd
);
}
CHARSET_INFO
*
default_charset
()
const
;
Derivation
derivation
()
const
{
return
collation
.
derivation
;
}
CHARSET_INFO
*
charset
()
const
{
return
collation
.
collation
;
}
void
set_charset
(
CHARSET_INFO
*
cs
)
{
collation
.
collation
=
cs
;
}
void
set_charset
(
Derivation
dv
)
{
collation
.
derivation
=
dv
;
}
void
set_charset
(
CHARSET_INFO
*
cs
,
Derivation
dv
)
{
collation
.
collation
=
cs
;
collation
.
derivation
=
dv
;
}
void
set_charset
(
Item
&
item
)
{
collation
=
item
.
collation
;
}
void
set_charset
(
DTCollation
*
collation_arg
)
{
collation
.
collation
=
collation_arg
->
collation
;
collation
.
derivation
=
collation_arg
->
derivation
;
}
virtual
void
set_outer_resolving
()
{}
// Row emulation
...
...
@@ -229,7 +214,7 @@ class Item_field :public Item_ident
Item_field
(
const
char
*
db_par
,
const
char
*
table_name_par
,
const
char
*
field_name_par
)
:
Item_ident
(
db_par
,
table_name_par
,
field_name_par
),
field
(
0
),
result_field
(
0
)
{
set_char
set
(
DERIVATION_IMPLICIT
);
}
{
collation
.
set
(
DERIVATION_IMPLICIT
);
}
// Constructor need to process subselect with temporary tables (see Item)
Item_field
(
THD
*
thd
,
Item_field
&
item
);
Item_field
(
Field
*
field
);
...
...
@@ -432,7 +417,7 @@ class Item_string :public Item
Item_string
(
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
,
Derivation
dv
=
DERIVATION_COERCIBLE
)
{
set_char
set
(
cs
,
dv
);
collation
.
set
(
cs
,
dv
);
str_value
.
set
(
str
,
length
,
cs
);
max_length
=
length
;
set_name
(
str
,
length
,
cs
);
...
...
@@ -441,7 +426,7 @@ class Item_string :public Item
Item_string
(
const
char
*
name_par
,
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
,
Derivation
dv
=
DERIVATION_COERCIBLE
)
{
set_char
set
(
cs
,
dv
);
collation
.
set
(
cs
,
dv
);
str_value
.
set
(
str
,
length
,
cs
);
max_length
=
length
;
set_name
(
name_par
,
0
,
cs
);
...
...
sql/item_buff.cc
View file @
feae02f9
...
...
@@ -57,7 +57,7 @@ bool Item_str_buff::cmp(void)
else
if
(
null_value
)
return
0
;
// new and old value was null
else
tmp
=
sortcmp
(
&
value
,
res
,
item
->
c
harset
()
)
!=
0
;
tmp
=
sortcmp
(
&
value
,
res
,
item
->
c
ollation
.
collation
)
!=
0
;
if
(
tmp
)
value
.
copy
(
*
res
);
// Remember for next cmp
return
tmp
;
...
...
sql/item_cmpfunc.cc
View file @
feae02f9
...
...
@@ -151,15 +151,17 @@ void Item_bool_func2::fix_length_and_dec()
uint
strong
=
0
;
uint
weak
=
0
;
if
((
args
[
0
]
->
derivation
()
<
args
[
1
]
->
derivation
())
&&
!
my_charset_same
(
args
[
0
]
->
charset
(),
args
[
1
]
->
charset
())
&&
(
args
[
0
]
->
charset
()
->
state
&
MY_CS_UNICODE
))
if
((
args
[
0
]
->
collation
.
derivation
<
args
[
1
]
->
collation
.
derivation
)
&&
!
my_charset_same
(
args
[
0
]
->
collation
.
collation
,
args
[
1
]
->
collation
.
collation
)
&&
(
args
[
0
]
->
collation
.
collation
->
state
&
MY_CS_UNICODE
))
{
weak
=
1
;
}
else
if
((
args
[
1
]
->
derivation
()
<
args
[
0
]
->
derivation
())
&&
!
my_charset_same
(
args
[
0
]
->
charset
(),
args
[
1
]
->
charset
())
&&
(
args
[
1
]
->
charset
()
->
state
&
MY_CS_UNICODE
))
else
if
((
args
[
1
]
->
collation
.
derivation
<
args
[
0
]
->
collation
.
derivation
)
&&
!
my_charset_same
(
args
[
0
]
->
collation
.
collation
,
args
[
1
]
->
collation
.
collation
)
&&
(
args
[
1
]
->
collation
.
collation
->
state
&
MY_CS_UNICODE
))
{
strong
=
1
;
}
...
...
@@ -172,15 +174,15 @@ void Item_bool_func2::fix_length_and_dec()
String
tmp
,
cstr
;
String
*
ostr
=
args
[
weak
]
->
val_str
(
&
tmp
);
cstr
.
copy
(
ostr
->
ptr
(),
ostr
->
length
(),
ostr
->
charset
(),
args
[
strong
]
->
c
harset
()
);
args
[
strong
]
->
c
ollation
.
collation
);
conv
=
new
Item_string
(
cstr
.
ptr
(),
cstr
.
length
(),
cstr
.
charset
(),
args
[
weak
]
->
derivation
()
);
args
[
weak
]
->
collation
.
derivation
);
((
Item_string
*
)
conv
)
->
str_value
.
copy
();
}
else
{
conv
=
new
Item_func_conv_charset
(
args
[
weak
],
args
[
strong
]
->
c
harset
()
);
conv
->
collation
.
set
(
args
[
weak
]
->
derivation
()
);
conv
=
new
Item_func_conv_charset
(
args
[
weak
],
args
[
strong
]
->
c
ollation
.
collation
);
conv
->
collation
.
set
(
args
[
weak
]
->
collation
.
derivation
);
}
args
[
weak
]
=
conv
?
conv
:
args
[
weak
];
}
...
...
@@ -725,13 +727,13 @@ Item_func_ifnull::val_str(String *str)
if
(
!
args
[
0
]
->
null_value
)
{
null_value
=
0
;
res
->
set_charset
(
c
harset
()
);
res
->
set_charset
(
c
ollation
.
collation
);
return
res
;
}
res
=
args
[
1
]
->
val_str
(
str
);
if
((
null_value
=
args
[
1
]
->
null_value
))
return
0
;
res
->
set_charset
(
c
harset
()
);
res
->
set_charset
(
c
ollation
.
collation
);
return
res
;
}
...
...
@@ -750,12 +752,12 @@ Item_func_if::fix_length_and_dec()
if
(
null1
)
{
cached_result_type
=
arg2_type
;
set_charset
(
args
[
2
]
->
charset
()
);
collation
.
set
(
args
[
2
]
->
collation
.
collation
);
}
else
if
(
null2
)
{
cached_result_type
=
arg1_type
;
set_charset
(
args
[
1
]
->
charset
()
);
collation
.
set
(
args
[
1
]
->
collation
.
collation
);
}
else
{
...
...
@@ -767,7 +769,7 @@ Item_func_if::fix_length_and_dec()
}
else
{
set_char
set
(
&
my_charset_bin
);
// Number
collation
.
set
(
&
my_charset_bin
);
// Number
}
}
}
...
...
@@ -797,7 +799,7 @@ Item_func_if::val_str(String *str)
Item
*
arg
=
args
[
0
]
->
val_int
()
?
args
[
1
]
:
args
[
2
];
String
*
res
=
arg
->
val_str
(
str
);
if
(
res
)
res
->
set_charset
(
c
harset
()
);
res
->
set_charset
(
c
ollation
.
collation
);
null_value
=
arg
->
null_value
;
return
res
;
}
...
...
@@ -1182,7 +1184,7 @@ void in_string::set(uint pos,Item *item)
if
(
!
str
->
charset
())
{
CHARSET_INFO
*
cs
;
if
(
!
(
cs
=
item
->
c
harset
()
))
if
(
!
(
cs
=
item
->
c
ollation
.
collation
))
cs
=
&
my_charset_bin
;
// Should never happen for STR items
str
->
set_charset
(
cs
);
}
...
...
@@ -1260,7 +1262,7 @@ cmp_item* cmp_item::get_comparator(Item *item)
{
switch
(
item
->
result_type
())
{
case
STRING_RESULT
:
return
new
cmp_item_sort_string
(
item
->
c
harset
()
);
return
new
cmp_item_sort_string
(
item
->
c
ollation
.
collation
);
break
;
case
INT_RESULT
:
return
new
cmp_item_int
;
...
...
@@ -1839,7 +1841,7 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
We could also do boyer-more for non-const items, but as we would have to
recompute the tables for each row it's not worth it.
*/
if
(
args
[
1
]
->
const_item
()
&&
!
use_strnxfrm
(
c
harset
()
)
&&
if
(
args
[
1
]
->
const_item
()
&&
!
use_strnxfrm
(
c
ollation
.
collation
)
&&
!
(
specialflag
&
SPECIAL_NO_NEW_FUNC
))
{
String
*
res2
=
args
[
1
]
->
val_str
(
&
tmp_value2
);
...
...
@@ -1860,7 +1862,7 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
{
const
char
*
tmp
=
first
+
1
;
for
(;
*
tmp
!=
wild_many
&&
*
tmp
!=
wild_one
&&
*
tmp
!=
escape
;
tmp
++
)
;
canDoTurboBM
=
(
tmp
==
last
)
&&
!
use_mb
(
args
[
0
]
->
c
harset
()
);
canDoTurboBM
=
(
tmp
==
last
)
&&
!
use_mb
(
args
[
0
]
->
c
ollation
.
collation
);
}
if
(
canDoTurboBM
)
...
...
sql/item_func.cc
View file @
feae02f9
...
...
@@ -309,9 +309,9 @@ Field *Item_func::tmp_table_field(TABLE *t_arg)
break
;
case
STRING_RESULT
:
if
(
max_length
>
255
)
res
=
new
Field_blob
(
max_length
,
maybe_null
,
name
,
t_arg
,
c
harset
()
);
res
=
new
Field_blob
(
max_length
,
maybe_null
,
name
,
t_arg
,
c
ollation
.
collation
);
else
res
=
new
Field_string
(
max_length
,
maybe_null
,
name
,
t_arg
,
c
harset
()
);
res
=
new
Field_string
(
max_length
,
maybe_null
,
name
,
t_arg
,
c
ollation
.
collation
);
break
;
case
ROW_RESULT
:
default:
...
...
@@ -976,13 +976,13 @@ String *Item_func_min_max::val_str(String *str)
res2
=
args
[
i
]
->
val_str
(
res
==
str
?
&
tmp_value
:
str
);
if
(
res2
)
{
int
cmp
=
sortcmp
(
res
,
res2
,
c
harset
()
);
int
cmp
=
sortcmp
(
res
,
res2
,
c
ollation
.
collation
);
if
((
cmp_sign
<
0
?
cmp
:
-
cmp
)
<
0
)
res
=
res2
;
}
}
}
res
->
set_charset
(
c
harset
()
);
res
->
set_charset
(
c
ollation
.
collation
);
return
res
;
}
case
ROW_RESULT
:
...
...
@@ -1100,7 +1100,7 @@ longlong Item_func_coercibility::val_int()
return
0
;
}
null_value
=
0
;
return
(
longlong
)
args
[
0
]
->
derivation
()
;
return
(
longlong
)
args
[
0
]
->
collation
.
derivation
;
}
void
Item_func_locate
::
fix_length_and_dec
()
...
...
@@ -1434,8 +1434,8 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
There is no a general rule for UDF. Everything depends on
the particular user definted function.
*/
if
(
item
->
c
harset
()
->
state
&
MY_CS_BINSORT
)
func
->
set_char
set
(
&
my_charset_bin
);
if
(
item
->
c
ollation
.
collation
->
state
&
MY_CS_BINSORT
)
func
->
collation
.
set
(
&
my_charset_bin
);
if
(
item
->
maybe_null
)
func
->
maybe_null
=
1
;
func
->
with_sum_func
=
func
->
with_sum_func
||
item
->
with_sum_func
;
...
...
@@ -2199,7 +2199,7 @@ Item_func_set_user_var::val_str(String *str)
update_hash
((
void
*
)
0
,
0
,
STRING_RESULT
,
&
my_charset_bin
,
DERIVATION_NONE
);
else
update_hash
((
void
*
)
res
->
ptr
(),
res
->
length
(),
STRING_RESULT
,
res
->
charset
(),
args
[
0
]
->
derivation
()
);
res
->
charset
(),
args
[
0
]
->
collation
.
derivation
);
return
res
;
}
...
...
sql/item_strfunc.cc
View file @
feae02f9
...
...
@@ -310,7 +310,7 @@ String *Item_func_concat::val_str(String *str)
}
}
}
res
->
set_charset
(
c
harset
()
);
res
->
set_charset
(
c
ollation
.
collation
);
return
res
;
null:
...
...
@@ -596,7 +596,7 @@ String *Item_func_concat_ws::val_str(String *str)
use_as_buff
=
str
;
}
}
res
->
set_charset
(
c
harset
()
);
res
->
set_charset
(
c
ollation
.
collation
);
return
res
;
null:
...
...
@@ -697,7 +697,7 @@ String *Item_func_reverse::val_str(String *str)
void
Item_func_reverse
::
fix_length_and_dec
()
{
set_charset
(
*
args
[
0
]
);
collation
.
set
(
args
[
0
]
->
collation
);
max_length
=
args
[
0
]
->
max_length
;
}
...
...
@@ -933,7 +933,7 @@ void Item_str_func::left_right_max_length()
max_length
=
args
[
0
]
->
max_length
;
if
(
args
[
1
]
->
const_item
())
{
int
length
=
(
int
)
args
[
1
]
->
val_int
()
*
c
harset
()
->
mbmaxlen
;
int
length
=
(
int
)
args
[
1
]
->
val_int
()
*
c
ollation
.
collation
->
mbmaxlen
;
if
(
length
<=
0
)
max_length
=
0
;
else
...
...
@@ -944,7 +944,7 @@ void Item_str_func::left_right_max_length()
void
Item_func_left
::
fix_length_and_dec
()
{
set_charset
(
*
args
[
0
]
);
collation
.
set
(
args
[
0
]
->
collation
);
left_right_max_length
();
}
...
...
@@ -971,7 +971,7 @@ String *Item_func_right::val_str(String *str)
void
Item_func_right
::
fix_length_and_dec
()
{
set_charset
(
*
args
[
0
]
);
collation
.
set
(
args
[
0
]
->
collation
);
left_right_max_length
();
}
...
...
@@ -1006,7 +1006,7 @@ void Item_func_substr::fix_length_and_dec()
{
max_length
=
args
[
0
]
->
max_length
;
set_charset
(
*
args
[
0
]
);
collation
.
set
(
args
[
0
]
->
collation
);
if
(
args
[
1
]
->
const_item
())
{
int32
start
=
(
int32
)
args
[
1
]
->
val_int
()
-
1
;
...
...
@@ -1314,7 +1314,7 @@ void Item_func_trim::fix_length_and_dec()
if
(
arg_count
==
1
)
{
collation
.
set
(
args
[
0
]
->
collation
);
remove
.
set_charset
(
c
harset
()
);
remove
.
set_charset
(
c
ollation
.
collation
);
remove
.
set_ascii
(
" "
,
1
);
}
else
...
...
@@ -1535,7 +1535,7 @@ String *Item_func_user::val_str(String *str)
void
Item_func_soundex
::
fix_length_and_dec
()
{
set_charset
(
*
args
[
0
]
);
collation
.
set
(
args
[
0
]
->
collation
);
max_length
=
args
[
0
]
->
max_length
;
set_if_bigger
(
max_length
,
4
);
}
...
...
@@ -1567,7 +1567,7 @@ String *Item_func_soundex::val_str(String *str)
{
String
*
res
=
args
[
0
]
->
val_str
(
str
);
char
last_ch
,
ch
;
CHARSET_INFO
*
cs
=
c
harset
()
;
CHARSET_INFO
*
cs
=
c
ollation
.
collation
;
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
/* purecov: inspected */
...
...
@@ -1707,7 +1707,7 @@ String *Item_func_elt::val_str(String *str)
}
null_value
=
0
;
res
=
args
[
tmp
]
->
val_str
(
str
);
res
->
set_charset
(
c
harset
()
);
res
->
set_charset
(
c
ollation
.
collation
);
return
res
;
}
...
...
@@ -1813,7 +1813,7 @@ String *Item_func_char::val_str(String *str)
int32
num
=
(
int32
)
args
[
i
]
->
val_int
();
if
(
!
args
[
i
]
->
null_value
)
#ifdef USE_MB
if
(
use_mb
(
c
harset
()
))
if
(
use_mb
(
c
ollation
.
collation
))
{
if
(
num
&
0xFF000000L
)
{
str
->
append
((
char
)(
num
>>
24
));
...
...
@@ -1860,7 +1860,7 @@ inline String* alloc_buffer(String *res,String *str,String *tmp_value,
void
Item_func_repeat
::
fix_length_and_dec
()
{
set_charset
(
*
args
[
0
]
);
collation
.
set
(
args
[
0
]
->
collation
);
if
(
args
[
1
]
->
const_item
())
{
max_length
=
(
long
)
(
args
[
0
]
->
max_length
*
args
[
1
]
->
val_int
());
...
...
@@ -2109,7 +2109,7 @@ String *Item_func_conv_charset::val_str(String *str)
void
Item_func_conv_charset
::
fix_length_and_dec
()
{
set_char
set
(
conv_charset
,
DERIVATION_IMPLICIT
);
collation
.
set
(
conv_charset
,
DERIVATION_IMPLICIT
);
max_length
=
args
[
0
]
->
max_length
*
conv_charset
->
mbmaxlen
;
}
...
...
@@ -2192,7 +2192,7 @@ String *Item_func_set_collation::val_str(String *str)
str
=
args
[
0
]
->
val_str
(
str
);
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
str
->
set_charset
(
c
harset
()
);
str
->
set_charset
(
c
ollation
.
collation
);
return
str
;
}
...
...
@@ -2203,7 +2203,7 @@ void Item_func_set_collation::fix_length_and_dec()
String
tmp
,
*
str
=
args
[
1
]
->
val_str
(
&
tmp
);
colname
=
str
->
c_ptr
();
if
(
colname
==
binary_keyword
)
set_collation
=
get_charset_by_csname
(
args
[
0
]
->
c
harset
()
->
csname
,
set_collation
=
get_charset_by_csname
(
args
[
0
]
->
c
ollation
.
collation
->
csname
,
MY_CS_BINSORT
,
MYF
(
0
));
else
{
...
...
@@ -2214,13 +2214,14 @@ void Item_func_set_collation::fix_length_and_dec()
}
}
if
(
!
set_collation
||
!
my_charset_same
(
args
[
0
]
->
charset
(),
set_collation
))
if
(
!
set_collation
||
!
my_charset_same
(
args
[
0
]
->
collation
.
collation
,
set_collation
))
{
my_error
(
ER_COLLATION_CHARSET_MISMATCH
,
MYF
(
0
),
colname
,
args
[
0
]
->
c
harset
()
->
csname
);
colname
,
args
[
0
]
->
c
ollation
.
collation
->
csname
);
return
;
}
set_char
set
(
set_collation
,
DERIVATION_EXPLICIT
);
collation
.
set
(
set_collation
,
DERIVATION_EXPLICIT
);
max_length
=
args
[
0
]
->
max_length
;
}
...
...
@@ -2237,7 +2238,7 @@ bool Item_func_set_collation::eq(const Item *item, bool binary_cmp) const
func_name
()
!=
item_func
->
func_name
())
return
0
;
Item_func_set_collation
*
item_func_sc
=
(
Item_func_set_collation
*
)
item
;
if
(
c
harset
()
!=
item_func_sc
->
charset
()
)
if
(
c
ollation
.
collation
!=
item_func_sc
->
collation
.
collation
)
return
0
;
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
if
(
!
args
[
i
]
->
eq
(
item_func_sc
->
args
[
i
],
binary_cmp
))
...
...
@@ -2539,7 +2540,7 @@ String *Item_func_quote::val_str(String *str)
}
*
to
=
'\''
;
str
->
length
(
new_length
);
str
->
set_charset
(
c
harset
()
);
str
->
set_charset
(
c
ollation
.
collation
);
return
str
;
null:
...
...
sql/item_strfunc.h
View file @
feae02f9
...
...
@@ -153,7 +153,7 @@ class Item_str_conv :public Item_str_func
Item_str_conv
(
Item
*
item
)
:
Item_str_func
(
item
)
{}
void
fix_length_and_dec
()
{
set_charset
(
*
args
[
0
]
);
collation
.
set
(
args
[
0
]
->
collation
);
max_length
=
args
[
0
]
->
max_length
;
}
};
...
...
@@ -335,12 +335,11 @@ class Item_func_decode :public Item_func_encode
class
Item_func_database
:
public
Item_str_func
{
public:
Item_func_database
()
{
set_charset
(
DERIVATION_IMPLICIT
);
}
Item_func_database
()
{
collation
.
set
(
system_charset_info
,
DERIVATION_IMPLICIT
);
}
String
*
val_str
(
String
*
);
void
fix_length_and_dec
()
{
max_length
=
MAX_FIELD_NAME
*
system_charset_info
->
mbmaxlen
;
set_charset
(
system_charset_info
);
}
const
char
*
func_name
()
const
{
return
"database"
;
}
};
...
...
@@ -348,12 +347,11 @@ class Item_func_database :public Item_str_func
class
Item_func_user
:
public
Item_str_func
{
public:
Item_func_user
()
{
set_charset
(
DERIVATION_IMPLICIT
);
}
Item_func_user
()
{
collation
.
set
(
system_charset_info
,
DERIVATION_IMPLICIT
);
}
String
*
val_str
(
String
*
);
void
fix_length_and_dec
()
{
max_length
=
(
USERNAME_LENGTH
+
HOSTNAME_LENGTH
+
1
)
*
system_charset_info
->
mbmaxlen
;
set_charset
(
system_charset_info
);
}
const
char
*
func_name
()
const
{
return
"user"
;
}
};
...
...
@@ -417,7 +415,7 @@ class Item_func_format :public Item_str_func
String
*
val_str
(
String
*
);
void
fix_length_and_dec
()
{
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
max_length
=
args
[
0
]
->
max_length
+
(
args
[
0
]
->
max_length
-
args
[
0
]
->
decimals
)
/
3
;
}
const
char
*
func_name
()
const
{
return
"format"
;
}
...
...
@@ -431,7 +429,7 @@ class Item_func_char :public Item_str_func
String
*
val_str
(
String
*
);
void
fix_length_and_dec
()
{
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
maybe_null
=
0
;
max_length
=
arg_count
;
}
const
char
*
func_name
()
const
{
return
"char"
;
}
...
...
@@ -481,7 +479,7 @@ class Item_func_conv :public Item_str_func
String
*
val_str
(
String
*
);
void
fix_length_and_dec
()
{
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
decimals
=
0
;
max_length
=
64
;
}
};
...
...
@@ -496,7 +494,7 @@ class Item_func_hex :public Item_str_func
String
*
val_str
(
String
*
);
void
fix_length_and_dec
()
{
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
decimals
=
0
;
max_length
=
args
[
0
]
->
max_length
*
2
;
}
};
...
...
@@ -517,7 +515,7 @@ class Item_func_binary :public Item_str_func
}
void
fix_length_and_dec
()
{
set_char
set
(
&
my_charset_bin
);
collation
.
set
(
&
my_charset_bin
);
max_length
=
args
[
0
]
->
max_length
;
}
void
print
(
String
*
str
)
{
print_op
(
str
);
}
...
...
@@ -533,7 +531,7 @@ class Item_load_file :public Item_str_func
const
char
*
func_name
()
const
{
return
"load_file"
;
}
void
fix_length_and_dec
()
{
set_char
set
(
&
my_charset_bin
,
DERIVATION_COERCIBLE
);
collation
.
set
(
&
my_charset_bin
,
DERIVATION_COERCIBLE
);
maybe_null
=
1
;
max_length
=
MAX_BLOB_WIDTH
;
}
...
...
@@ -570,7 +568,7 @@ class Item_func_quote :public Item_str_func
String
*
val_str
(
String
*
);
void
fix_length_and_dec
()
{
set_charset
(
*
args
[
0
]
);
collation
.
set
(
args
[
0
]
->
collation
);
max_length
=
args
[
0
]
->
max_length
*
2
+
2
;
}
};
...
...
@@ -615,7 +613,7 @@ class Item_func_charset :public Item_str_func
void
fix_length_and_dec
()
{
max_length
=
40
;
// should be enough
set_charset
(
default_charset
()
);
collation
.
set
(
system_charset_info
);
};
};
...
...
@@ -628,6 +626,6 @@ class Item_func_collation :public Item_str_func
void
fix_length_and_dec
()
{
max_length
=
40
;
// should be enough
set_charset
(
default_charset
()
);
collation
.
set
(
system_charset_info
);
};
};
sql/item_sum.cc
View file @
feae02f9
...
...
@@ -193,7 +193,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
max_length
=
float_length
(
decimals
);
}
else
{
cmp_charset
=
item
->
c
harset
()
;
cmp_charset
=
item
->
c
ollation
.
collation
;
max_length
=
item
->
max_length
;
}
decimals
=
item
->
decimals
;
...
...
sql/item_timefunc.cc
View file @
feae02f9
...
...
@@ -574,7 +574,7 @@ void Item_func_curdate::fix_length_and_dec()
struct
tm
tm_tmp
,
*
start
;
time_t
query_start
=
current_thd
->
query_start
();
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
decimals
=
0
;
max_length
=
10
*
default_charset
()
->
mbmaxlen
;
localtime_r
(
&
query_start
,
&
tm_tmp
);
...
...
@@ -617,7 +617,7 @@ void Item_func_curtime::fix_length_and_dec()
max_length
=
8
*
cs
->
mbmaxlen
;
localtime_r
(
&
query_start
,
&
tm_tmp
);
start
=&
tm_tmp
;
set_char
set
(
cs
);
collation
.
set
(
cs
);
value
=
(
longlong
)
((
ulong
)
((
uint
)
start
->
tm_hour
)
*
10000L
+
(
ulong
)
(((
uint
)
start
->
tm_min
)
*
100L
+
(
uint
)
start
->
tm_sec
));
...
...
@@ -644,7 +644,7 @@ void Item_func_now::fix_length_and_dec()
decimals
=
0
;
max_length
=
19
*
cs
->
mbmaxlen
;
set_char
set
(
cs
);
collation
.
set
(
cs
);
localtime_r
(
&
query_start
,
&
tm_tmp
);
start
=&
tm_tmp
;
value
=
((
longlong
)
((
ulong
)
((
uint
)
start
->
tm_year
+
1900
)
*
10000L
+
...
...
@@ -1130,7 +1130,7 @@ bool Item_func_from_unixtime::get_date(TIME *ltime,
void
Item_date_add_interval
::
fix_length_and_dec
()
{
enum_field_types
arg0_field_type
;
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
maybe_null
=
1
;
max_length
=
26
*
MY_CHARSET_BIN_MB_MAXLEN
;
value
.
alloc
(
32
);
...
...
sql/item_timefunc.h
View file @
feae02f9
...
...
@@ -93,7 +93,7 @@ class Item_func_month :public Item_func
enum
Item_result
result_type
()
const
{
return
INT_RESULT
;
}
void
fix_length_and_dec
()
{
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
decimals
=
0
;
max_length
=
2
*
default_charset
()
->
mbmaxlen
;
maybe_null
=
1
;
...
...
@@ -110,7 +110,7 @@ class Item_func_monthname :public Item_func_month
enum
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
void
fix_length_and_dec
()
{
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
decimals
=
0
;
max_length
=
10
*
default_charset
()
->
mbmaxlen
;
maybe_null
=
1
;
...
...
@@ -254,7 +254,7 @@ class Item_func_weekday :public Item_func
enum
Item_result
result_type
()
const
{
return
INT_RESULT
;
}
void
fix_length_and_dec
()
{
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
decimals
=
0
;
max_length
=
1
*
default_charset
()
->
mbmaxlen
;
maybe_null
=
1
;
...
...
@@ -270,7 +270,7 @@ class Item_func_dayname :public Item_func_weekday
enum
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
void
fix_length_and_dec
()
{
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
decimals
=
0
;
max_length
=
9
*
default_charset
()
->
mbmaxlen
;
maybe_null
=
1
;
...
...
@@ -322,7 +322,7 @@ class Item_date :public Item_func
const
char
*
func_name
()
const
{
return
"date"
;
}
void
fix_length_and_dec
()
{
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
decimals
=
0
;
max_length
=
10
*
default_charset
()
->
mbmaxlen
;
}
...
...
@@ -440,7 +440,7 @@ class Item_func_from_unixtime :public Item_date_func
const
char
*
func_name
()
const
{
return
"from_unixtime"
;
}
void
fix_length_and_dec
()
{
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
decimals
=
0
;
max_length
=
19
*
default_charset
()
->
mbmaxlen
;
}
...
...
@@ -457,7 +457,7 @@ class Item_func_sec_to_time :public Item_str_func
String
*
val_str
(
String
*
);
void
fix_length_and_dec
()
{
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
maybe_null
=
1
;
max_length
=
13
*
default_charset
()
->
mbmaxlen
;
}
...
...
@@ -529,12 +529,12 @@ class Item_typecast :public Item_str_func
String
*
tmp
=
args
[
0
]
->
val_str
(
a
);
null_value
=
args
[
0
]
->
null_value
;
if
(
tmp
)
tmp
->
set_charset
(
c
harset
()
);
tmp
->
set_charset
(
c
ollation
.
collation
);
return
tmp
;
}
void
fix_length_and_dec
()
{
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
max_length
=
args
[
0
]
->
max_length
;
}
void
print
(
String
*
str
);
...
...
@@ -547,7 +547,7 @@ class Item_char_typecast :public Item_typecast
Item_char_typecast
(
Item
*
a
)
:
Item_typecast
(
a
)
{}
void
fix_length_and_dec
()
{
set_char
set
(
default_charset
());
collation
.
set
(
default_charset
());
max_length
=
args
[
0
]
->
max_length
;
}
};
...
...
sql/opt_range.cc
View file @
feae02f9
...
...
@@ -930,7 +930,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
{
bool
like_error
;
char
buff1
[
MAX_FIELD_WIDTH
],
*
min_str
,
*
max_str
;
String
tmp
(
buff1
,
sizeof
(
buff1
),
value
->
c
harset
()
),
*
res
;
String
tmp
(
buff1
,
sizeof
(
buff1
),
value
->
c
ollation
.
collation
),
*
res
;
uint
length
,
offset
,
min_length
,
max_length
;
if
(
!
field
->
optimize_range
(
param
->
real_keynr
[
key_part
->
key
]))
...
...
sql/set_var.h
View file @
feae02f9
...
...
@@ -607,7 +607,7 @@ class set_var :public set_var_base
{
Item_field
*
item
=
(
Item_field
*
)
value_arg
;
if
(
!
(
value
=
new
Item_string
(
item
->
field_name
,
strlen
(
item
->
field_name
),
item
->
c
harset
()
)))
item
->
c
ollation
.
collation
)))
value
=
value_arg
;
/* Give error message later */
}
else
...
...
sql/sql_analyse.cc
View file @
feae02f9
...
...
@@ -326,9 +326,9 @@ void field_str::add()
if
(
length
>
max_length
)
max_length
=
length
;
if
(
sortcmp
(
res
,
&
min_arg
,
item
->
c
harset
()
)
<
0
)
if
(
sortcmp
(
res
,
&
min_arg
,
item
->
c
ollation
.
collation
)
<
0
)
min_arg
.
copy
(
*
res
);
if
(
sortcmp
(
res
,
&
max_arg
,
item
->
c
harset
()
)
>
0
)
if
(
sortcmp
(
res
,
&
max_arg
,
item
->
c
ollation
.
collation
)
>
0
)
max_arg
.
copy
(
*
res
);
}
...
...
@@ -736,7 +736,7 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows)
{
if
(
must_be_blob
)
{
if
(
item
->
c
harset
()
==
&
my_charset_bin
)
if
(
item
->
c
ollation
.
collation
==
&
my_charset_bin
)
answer
->
append
(
"TINYBLOB"
,
8
);
else
answer
->
append
(
"TINYTEXT"
,
8
);
...
...
@@ -754,21 +754,21 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows)
}
else
if
(
max_length
<
(
1L
<<
16
))
{
if
(
item
->
c
harset
()
==
&
my_charset_bin
)
if
(
item
->
c
ollation
.
collation
==
&
my_charset_bin
)
answer
->
append
(
"BLOB"
,
4
);
else
answer
->
append
(
"TEXT"
,
4
);
}
else
if
(
max_length
<
(
1L
<<
24
))
{
if
(
item
->
c
harset
()
==
&
my_charset_bin
)
if
(
item
->
c
ollation
.
collation
==
&
my_charset_bin
)
answer
->
append
(
"MEDIUMBLOB"
,
10
);
else
answer
->
append
(
"MEDIUMTEXT"
,
10
);
}
else
{
if
(
item
->
c
harset
()
==
&
my_charset_bin
)
if
(
item
->
c
ollation
.
collation
==
&
my_charset_bin
)
answer
->
append
(
"LONGBLOB"
,
8
);
else
answer
->
append
(
"LONGTEXT"
,
8
);
...
...
sql/sql_select.cc
View file @
feae02f9
...
...
@@ -4229,9 +4229,9 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
case
STRING_RESULT
:
if
(
item_sum
->
max_length
>
255
)
return
new
Field_blob
(
item_sum
->
max_length
,
maybe_null
,
item
->
name
,
table
,
item
->
c
harset
()
);
item
->
name
,
table
,
item
->
c
ollation
.
collation
);
return
new
Field_string
(
item_sum
->
max_length
,
maybe_null
,
item
->
name
,
table
,
item
->
c
harset
()
);
item
->
name
,
table
,
item
->
c
ollation
.
collation
);
case
ROW_RESULT
:
default:
// This case should never be choosen
...
...
@@ -4288,10 +4288,10 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
case
STRING_RESULT
:
if
(
item
->
max_length
>
255
)
new_field
=
new
Field_blob
(
item
->
max_length
,
maybe_null
,
item
->
name
,
table
,
item
->
c
harset
()
);
item
->
name
,
table
,
item
->
c
ollation
.
collation
);
else
new_field
=
new
Field_string
(
item
->
max_length
,
maybe_null
,
item
->
name
,
table
,
item
->
c
harset
()
);
item
->
name
,
table
,
item
->
c
ollation
.
collation
);
break
;
case
ROW_RESULT
:
default:
...
...
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