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
65a743b9
Commit
65a743b9
authored
Mar 21, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
All charset related actions have been moved from fix_fields() to fix_length_and_dec()
parent
d23ff904
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
46 deletions
+8
-46
sql/item_strfunc.cc
sql/item_strfunc.cc
+7
-42
sql/item_strfunc.h
sql/item_strfunc.h
+1
-4
No files found.
sql/item_strfunc.cc
View file @
65a743b9
...
...
@@ -2041,6 +2041,7 @@ String *Item_func_conv_charset::val_str(String *str)
void
Item_func_conv_charset
::
fix_length_and_dec
()
{
set_charset
(
conv_charset
);
max_length
=
args
[
0
]
->
max_length
*
conv_charset
->
mbmaxlen
;
set_charset
(
conv_charset
,
COER_IMPLICIT
);
}
...
...
@@ -2114,25 +2115,6 @@ String *Item_func_conv_charset3::val_str(String *str)
}
bool
Item_func_conv_charset
::
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tables
,
Item
**
ref
)
{
char
buff
[
STACK_BUFF_ALLOC
];
// Max argument in function
used_tables_cache
=
0
;
const_item_cache
=
1
;
if
(
thd
&&
check_stack_overrun
(
thd
,
buff
))
return
0
;
// Fatal error if flag is set!
if
(
args
[
0
]
->
fix_fields
(
thd
,
tables
,
args
)
||
args
[
0
]
->
check_cols
(
1
))
return
1
;
maybe_null
=
args
[
0
]
->
maybe_null
;
const_item_cache
=
args
[
0
]
->
const_item
();
set_charset
(
conv_charset
);
fix_length_and_dec
();
fixed
=
1
;
return
0
;
}
void
Item_func_conv_charset3
::
fix_length_and_dec
()
{
max_length
=
args
[
0
]
->
max_length
;
...
...
@@ -2147,24 +2129,11 @@ String *Item_func_set_collation::val_str(String *str)
return
str
;
}
bool
Item_func_set_collation
::
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tables
,
Item
**
ref
)
void
Item_func_set_collation
::
fix_length_and_dec
(
)
{
CHARSET_INFO
*
set_collation
;
String
tmp
,
*
str
;
const
char
*
colname
;
char
buff
[
STACK_BUFF_ALLOC
];
// Max argument in function
used_tables_cache
=
0
;
const_item_cache
=
1
;
if
(
thd
&&
check_stack_overrun
(
thd
,
buff
))
return
0
;
// Fatal error if flag is set!
if
(
args
[
0
]
->
fix_fields
(
thd
,
tables
,
args
)
||
args
[
0
]
->
check_cols
(
1
))
return
1
;
if
(
args
[
0
]
->
fix_fields
(
thd
,
tables
,
args
)
||
args
[
0
]
->
check_cols
(
1
))
return
2
;
maybe_null
=
args
[
0
]
->
maybe_null
||
args
[
1
]
->
maybe_null
;
str
=
args
[
1
]
->
val_str
(
&
tmp
);
String
tmp
,
*
str
=
args
[
1
]
->
val_str
(
&
tmp
);
colname
=
str
->
c_ptr
();
if
(
!
strncmp
(
colname
,
"BINARY"
,
6
))
set_collation
=
get_charset_by_csname
(
args
[
0
]
->
charset
()
->
csname
,
...
...
@@ -2175,24 +2144,20 @@ bool Item_func_set_collation::fix_fields(THD *thd,struct st_table_list *tables,
if
(
!
set_collation
)
{
my_error
(
ER_UNKNOWN_CHARACTER_SET
,
MYF
(
0
),
str
->
c_ptr
());
return
1
;
return
;
}
if
(
!
my_charset_same
(
args
[
0
]
->
charset
(),
set_collation
))
{
my_error
(
ER_COLLATION_CHARSET_MISMATCH
,
MYF
(
0
),
set_collation
->
name
,
args
[
0
]
->
charset
()
->
csname
);
return
1
;
return
;
}
set_charset
(
set_collation
,
COER_EXPLICIT
);
with_sum_func
=
with_sum_func
||
args
[
0
]
->
with_sum_func
;
used_tables_cache
=
args
[
0
]
->
used_tables
();
const_item_cache
=
args
[
0
]
->
const_item
();
fix_length_and_dec
();
fixed
=
1
;
return
0
;
max_length
=
args
[
0
]
->
max_length
;
}
bool
Item_func_set_collation
::
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
{
/* Assume we don't have rtti */
...
...
sql/item_strfunc.h
View file @
65a743b9
...
...
@@ -577,7 +577,6 @@ class Item_func_conv_charset :public Item_str_func
public:
Item_func_conv_charset
(
Item
*
a
,
CHARSET_INFO
*
cs
)
:
Item_str_func
(
a
)
{
conv_charset
=
cs
;
}
bool
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tables
,
Item
**
ref
);
String
*
val_str
(
String
*
);
void
fix_length_and_dec
();
const
char
*
func_name
()
const
{
return
"conv_charset"
;
}
...
...
@@ -588,9 +587,7 @@ class Item_func_set_collation :public Item_str_func
public:
Item_func_set_collation
(
Item
*
a
,
Item
*
b
)
:
Item_str_func
(
a
,
b
)
{};
String
*
val_str
(
String
*
);
bool
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tables
,
Item
**
ref
);
void
fix_length_and_dec
()
{
max_length
=
args
[
0
]
->
max_length
;
}
void
fix_length_and_dec
();
bool
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
;
const
char
*
func_name
()
const
{
return
"set_collation"
;
}
};
...
...
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