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
86b63337
Commit
86b63337
authored
Nov 06, 2002
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some charset code clean-ups
parent
5d45eae0
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
50 additions
and
58 deletions
+50
-58
sql/field.h
sql/field.h
+4
-3
sql/field_conv.cc
sql/field_conv.cc
+2
-4
sql/filesort.cc
sql/filesort.cc
+3
-4
sql/ha_heap.cc
sql/ha_heap.cc
+1
-1
sql/ha_myisam.cc
sql/ha_myisam.cc
+1
-2
sql/item.cc
sql/item.cc
+8
-10
sql/item.h
sql/item.h
+6
-6
sql/item_strfunc.cc
sql/item_strfunc.cc
+1
-1
sql/item_timefunc.cc
sql/item_timefunc.cc
+19
-19
sql/opt_range.cc
sql/opt_range.cc
+1
-1
sql/sql_prepare.cc
sql/sql_prepare.cc
+2
-2
sql/sql_select.cc
sql/sql_select.cc
+1
-3
sql/table.cc
sql/table.cc
+1
-2
No files found.
sql/field.h
View file @
86b63337
...
...
@@ -198,7 +198,8 @@ class Field {
uint
fill_cache_field
(
struct
st_cache_field
*
copy
);
virtual
bool
get_date
(
TIME
*
ltime
,
bool
fuzzydate
);
virtual
bool
get_time
(
TIME
*
ltime
);
virtual
CHARSET_INFO
*
charset
(
void
)
{
return
my_charset_bin
;
}
virtual
CHARSET_INFO
*
charset
(
void
)
const
{
return
my_charset_bin
;
}
virtual
void
set_charset
(
CHARSET_INFO
*
charset
)
{
}
friend
bool
reopen_table
(
THD
*
,
struct
st_table
*
,
bool
);
friend
int
cre_myisam
(
my_string
name
,
register
TABLE
*
form
,
uint
options
,
ulonglong
auto_increment_value
);
...
...
@@ -260,9 +261,9 @@ class Field_str :public Field {
uint
decimals
()
const
{
return
NOT_FIXED_DEC
;
}
void
make_field
(
Send_field
*
);
uint
size_of
()
const
{
return
sizeof
(
*
this
);
}
CHARSET_INFO
*
charset
(
void
)
{
return
field_charset
;
}
CHARSET_INFO
*
charset
(
void
)
const
{
return
field_charset
;
}
inline
void
set_charset
(
CHARSET_INFO
*
charset
)
{
field_charset
=
charset
;
}
void
set_charset
(
CHARSET_INFO
*
charset
)
{
field_charset
=
charset
;
}
bool
binary
()
const
{
return
field_charset
->
state
&
MY_CS_BINSORT
?
1
:
0
;
}
inline
int
cmp_image
(
char
*
buff
,
uint
length
)
{
...
...
sql/field_conv.cc
View file @
86b63337
...
...
@@ -525,8 +525,7 @@ void field_conv(Field *to,Field *from)
if
(
!
blob
->
value
.
is_alloced
()
&&
from
->
real_type
()
!=
FIELD_TYPE_STRING
)
blob
->
value
.
copy
();
blob
->
store
(
blob
->
value
.
ptr
(),
blob
->
value
.
length
(),
to
->
binary
()
?
default_charset_info
:
((
Field_str
*
)
to
)
->
charset
());
blob
->
store
(
blob
->
value
.
ptr
(),
blob
->
value
.
length
(),
to
->
charset
());
return
;
}
if
((
from
->
result_type
()
==
STRING_RESULT
&&
...
...
@@ -538,8 +537,7 @@ void field_conv(Field *to,Field *from)
char
buff
[
MAX_FIELD_WIDTH
];
String
result
(
buff
,
sizeof
(
buff
),
default_charset_info
);
from
->
val_str
(
&
result
,
&
result
);
to
->
store
(
result
.
c_ptr_quick
(),
result
.
length
(),
to
->
binary
()
?
default_charset_info
:
((
Field_str
*
)
to
)
->
charset
());
to
->
store
(
result
.
c_ptr_quick
(),
result
.
length
(),
to
->
charset
());
// QQ: what to do if "from" and "to" are of dirrent charsets?
}
else
if
(
from
->
result_type
()
==
REAL_RESULT
)
...
...
sql/filesort.cc
View file @
86b63337
...
...
@@ -75,7 +75,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
uchar
**
sort_keys
;
IO_CACHE
tempfile
,
buffpek_pointers
,
*
selected_records_file
,
*
outfile
;
SORTPARAM
param
;
CHARSET_INFO
*
charset
=
table
->
table_charset
;
CHARSET_INFO
*
charset
=
my_charset_bin
;
DBUG_ENTER
(
"filesort"
);
DBUG_EXECUTE
(
"info"
,
TEST_filesort
(
sortorder
,
s_length
););
#ifdef SKIP_DBUG_IN_FILESORT
...
...
@@ -85,8 +85,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
// BAR TODO: this is not absolutely correct, but OK for now
for
(
i
=
0
;
i
<
table
->
fields
;
i
++
)
if
(
!
table
->
field
[
i
]
->
binary
())
charset
=
((
Field_str
*
)(
table
->
field
[
i
]))
->
charset
();
charset
=
charset
?
charset
:
default_charset_info
;
charset
=
table
->
field
[
i
]
->
charset
();
// /BAR TODO
outfile
=
table
->
io_cache
;
...
...
@@ -930,7 +929,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length)
#ifdef USE_STRCOLL
if
(
!
sortorder
->
field
->
binary
())
{
CHARSET_INFO
*
cs
=
((
Field_str
*
)(
sortorder
->
field
))
->
charset
();
CHARSET_INFO
*
cs
=
sortorder
->
field
->
charset
();
if
(
use_strnxfrm
(
cs
))
sortorder
->
length
=
sortorder
->
length
*
cs
->
strxfrm_multiply
;
}
...
...
sql/ha_heap.cc
View file @
86b63337
...
...
@@ -291,7 +291,7 @@ int ha_heap::create(const char *name, TABLE *table,
seg
->
start
=
(
uint
)
key_part
->
offset
;
seg
->
length
=
(
uint
)
key_part
->
length
;
seg
->
flag
=
0
;
seg
->
charset
=
field
->
binary
()
?
NULL
:
((
Field_str
*
)
field
)
->
charset
();
seg
->
charset
=
field
->
charset
();
if
(
field
->
null_ptr
)
{
seg
->
null_bit
=
field
->
null_bit
;
...
...
sql/ha_myisam.cc
View file @
86b63337
...
...
@@ -1078,8 +1078,7 @@ int ha_myisam::create(const char *name, register TABLE *table,
keydef
[
i
].
seg
[
j
].
start
=
pos
->
key_part
[
j
].
offset
;
keydef
[
i
].
seg
[
j
].
length
=
pos
->
key_part
[
j
].
length
;
keydef
[
i
].
seg
[
j
].
bit_start
=
keydef
[
i
].
seg
[
j
].
bit_end
=
0
;
keydef
[
i
].
seg
[
j
].
language
=
field
->
binary
()
?
MY_CHARSET_CURRENT
:
((
Field_str
*
)
field
)
->
charset
()
->
number
;
keydef
[
i
].
seg
[
j
].
language
=
field
->
charset
()
->
number
;
if
(
field
->
null_ptr
)
{
...
...
sql/item.cc
View file @
86b63337
...
...
@@ -313,15 +313,15 @@ void Item_param::set_double(double value)
}
void
Item_param
::
set_value
(
const
char
*
str
,
uint
length
)
void
Item_param
::
set_value
(
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
)
{
str_value
.
set
(
str
,
length
,
default_charset_info
);
str_value
.
set
(
str
,
length
,
cs
);
item_result_type
=
STRING_RESULT
;
item_type
=
STRING_ITEM
;
}
void
Item_param
::
set_longdata
(
const
char
*
str
,
ulong
length
)
void
Item_param
::
set_longdata
(
const
char
*
str
,
ulong
length
,
CHARSET_INFO
*
cs
)
{
/* TODO: Fix this for binary handling by making use of
buffer_type..
...
...
@@ -346,10 +346,8 @@ int Item_param::save_in_field(Field *field)
double
nr
=
val
();
return
(
field
->
store
(
nr
))
?
-
1
:
0
;
}
String
*
result
;
CHARSET_INFO
*
cs
=
default_charset_info
;
//fix this
result
=
val_str
(
&
str_value
);
return
(
field
->
store
(
result
->
ptr
(),
result
->
length
(),
cs
))
?
-
1
:
0
;
String
*
result
=
val_str
(
&
str_value
);
return
(
field
->
store
(
result
->
ptr
(),
result
->
length
(),
field
->
charset
()))
?
-
1
:
0
;
}
...
...
@@ -658,7 +656,7 @@ int Item::save_in_field(Field *field)
field
->
result_type
()
==
STRING_RESULT
)
{
String
*
result
;
CHARSET_INFO
*
cs
=
field
->
binary
()
?
my_charset_bin
:
((
Field_str
*
)
field
)
->
charset
();
CHARSET_INFO
*
cs
=
field
->
charset
();
char
buff
[
MAX_FIELD_WIDTH
];
// Alloc buffer for small columns
str_value
.
set_quick
(
buff
,
sizeof
(
buff
),
cs
);
result
=
val_str
(
&
str_value
);
...
...
@@ -690,7 +688,7 @@ int Item::save_in_field(Field *field)
int
Item_string
::
save_in_field
(
Field
*
field
)
{
String
*
result
;
CHARSET_INFO
*
cs
=
field
->
binary
()
?
my_charset_bin
:
((
Field_str
*
)
field
)
->
charset
();
CHARSET_INFO
*
cs
=
field
->
charset
();
result
=
val_str
(
&
str_value
);
if
(
null_value
)
return
set_field_to_null
(
field
);
...
...
@@ -763,7 +761,7 @@ longlong Item_varbinary::val_int()
int
Item_varbinary
::
save_in_field
(
Field
*
field
)
{
int
error
;
CHARSET_INFO
*
cs
=
field
->
binary
()
?
default_charset_info
:
((
Field_str
*
)
field
)
->
charset
();
CHARSET_INFO
*
cs
=
field
->
charset
();
field
->
set_notnull
();
if
(
field
->
result_type
()
==
STRING_RESULT
)
{
...
...
sql/item.h
View file @
86b63337
...
...
@@ -196,14 +196,14 @@ class Item_param :public Item
void
set_null
();
void
set_int
(
longlong
i
);
void
set_double
(
double
i
);
void
set_value
(
const
char
*
str
,
uint
length
);
void
set_long_str
(
const
char
*
str
,
ulong
length
);
void
set_long_binary
(
const
char
*
str
,
ulong
length
);
void
set_longdata
(
const
char
*
str
,
ulong
length
);
void
set_long_end
();
void
set_value
(
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
);
void
set_long_str
(
const
char
*
str
,
ulong
length
,
CHARSET_INFO
*
cs
);
void
set_long_binary
(
const
char
*
str
,
ulong
length
,
CHARSET_INFO
*
cs
);
void
set_longdata
(
const
char
*
str
,
ulong
length
,
CHARSET_INFO
*
cs
);
void
set_long_end
();
void
reset
()
{}
enum
Item_result
result_type
()
const
{
return
item_result_type
;
}
{
return
item_result_type
;
}
Item
*
new_item
()
{
return
new
Item_param
(
name
);
}
};
...
...
sql/item_strfunc.cc
View file @
86b63337
...
...
@@ -1637,7 +1637,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
(
default_charset_info
))
if
(
use_mb
(
charset
()
))
{
if
(
num
&
0xFF000000L
)
{
str
->
append
((
char
)(
num
>>
24
));
...
...
sql/item_timefunc.cc
View file @
86b63337
...
...
@@ -31,28 +31,28 @@
static
String
month_names
[]
=
{
String
(
"January"
,
default_charset_info
),
String
(
"February"
,
default_charset_info
),
String
(
"March"
,
default_charset_info
),
String
(
"April"
,
default_charset_info
),
String
(
"May"
,
default_charset_info
),
String
(
"June"
,
default_charset_info
),
String
(
"July"
,
default_charset_info
),
String
(
"August"
,
default_charset_info
),
String
(
"September"
,
default_charset_info
),
String
(
"October"
,
default_charset_info
),
String
(
"November"
,
default_charset_info
),
String
(
"December"
,
default_charset_info
)
String
(
"January"
,
my_charset_latin1
),
String
(
"February"
,
my_charset_latin1
),
String
(
"March"
,
my_charset_latin1
),
String
(
"April"
,
my_charset_latin1
),
String
(
"May"
,
my_charset_latin1
),
String
(
"June"
,
my_charset_latin1
),
String
(
"July"
,
my_charset_latin1
),
String
(
"August"
,
my_charset_latin1
),
String
(
"September"
,
my_charset_latin1
),
String
(
"October"
,
my_charset_latin1
),
String
(
"November"
,
my_charset_latin1
),
String
(
"December"
,
my_charset_latin1
)
};
static
String
day_names
[]
=
{
String
(
"Monday"
,
default_charset_info
),
String
(
"Tuesday"
,
default_charset_info
),
String
(
"Wednesday"
,
default_charset_info
),
String
(
"Thursday"
,
default_charset_info
),
String
(
"Friday"
,
default_charset_info
),
String
(
"Saturday"
,
default_charset_info
),
String
(
"Sunday"
,
default_charset_info
)
String
(
"Monday"
,
my_charset_latin1
),
String
(
"Tuesday"
,
my_charset_latin1
),
String
(
"Wednesday"
,
my_charset_latin1
),
String
(
"Thursday"
,
my_charset_latin1
),
String
(
"Friday"
,
my_charset_latin1
),
String
(
"Saturday"
,
my_charset_latin1
),
String
(
"Sunday"
,
my_charset_latin1
)
};
/*
...
...
sql/opt_range.cc
View file @
86b63337
...
...
@@ -976,7 +976,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
&
min_length
,
&
max_length
);
else
{
CHARSET_INFO
*
charset
=
((
Field_str
*
)(
field
))
->
charset
();
CHARSET_INFO
*
charset
=
field
->
charset
();
#ifdef USE_STRCOLL
if
(
use_strnxfrm
(
charset
))
like_error
=
my_like_range
(
charset
,
...
...
sql/sql_prepare.cc
View file @
86b63337
...
...
@@ -271,7 +271,7 @@ static uchar* setup_param_field(Item_param *item_param,
default:
{
ulong
len
=
get_param_length
(
&
pos
);
item_param
->
set_value
((
const
char
*
)
pos
,
len
);
item_param
->
set_value
((
const
char
*
)
pos
,
len
,
current_thd
->
thd_charset
);
pos
+=
len
;
}
}
...
...
@@ -829,7 +829,7 @@ void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length)
sprintf
(
stmt
->
last_error
,
ER
(
ER_WRONG_ARGUMENTS
),
"get_longdata"
);
DBUG_VOID_RETURN
;
}
stmt
->
param
[
param_number
].
set_longdata
(
pos
,
packet_length
-
9
);
stmt
->
param
[
param_number
].
set_longdata
(
pos
,
packet_length
-
9
,
current_thd
->
thd_charset
);
stmt
->
long_data_used
=
1
;
DBUG_VOID_RETURN
;
}
sql/sql_select.cc
View file @
86b63337
...
...
@@ -4231,9 +4231,7 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
{
Field
*
field
=
keyinfo
->
key_part
[
i
].
field
;
seg
->
flag
=
0
;
seg
->
language
=
field
->
binary
()
?
MY_CHARSET_CURRENT
:
((
Field_str
*
)
field
)
->
charset
()
->
number
;
seg
->
language
=
field
->
charset
()
->
number
;
seg
->
length
=
keyinfo
->
key_part
[
i
].
length
;
seg
->
start
=
keyinfo
->
key_part
[
i
].
offset
;
if
(
field
->
flags
&
BLOB_FLAG
)
...
...
sql/table.cc
View file @
86b63337
...
...
@@ -392,8 +392,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
outparam
->
fieldnames
.
type_names
[
i
],
outparam
);
reg_field
->
comment
=
comment
;
if
(
!
reg_field
->
binary
())
((
Field_str
*
)
reg_field
)
->
set_charset
(
charset
);
reg_field
->
set_charset
(
charset
);
if
(
!
(
reg_field
->
flags
&
NOT_NULL_FLAG
))
{
if
((
null_bit
<<=
1
)
==
256
)
...
...
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