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
f79b8d6f
Commit
f79b8d6f
authored
Aug 06, 2012
by
Chaithra Gopalareddy
Browse files
Options
Browse Files
Download
Plain Diff
Merge from 5.1 to 5.5
parents
639e4967
c61abdad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
17 deletions
+34
-17
sql/item_strfunc.cc
sql/item_strfunc.cc
+34
-17
No files found.
sql/item_strfunc.cc
View file @
f79b8d6f
...
@@ -3295,23 +3295,21 @@ String *Item_load_file::val_str(String *str)
...
@@ -3295,23 +3295,21 @@ String *Item_load_file::val_str(String *str)
String
*
Item_func_export_set
::
val_str
(
String
*
str
)
String
*
Item_func_export_set
::
val_str
(
String
*
str
)
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
ulonglong
the_set
=
(
ulonglong
)
args
[
0
]
->
val_int
();
String
yes_buf
,
no_buf
,
sep_buf
;
String
yes_buf
,
*
yes
;
const
ulonglong
the_set
=
(
ulonglong
)
args
[
0
]
->
val_int
();
yes
=
args
[
1
]
->
val_str
(
&
yes_buf
);
const
String
*
yes
=
args
[
1
]
->
val_str
(
&
yes_buf
);
String
no_buf
,
*
no
;
const
String
*
no
=
args
[
2
]
->
val_str
(
&
no_buf
);
no
=
args
[
2
]
->
val_str
(
&
no_buf
);
const
String
*
sep
=
NULL
;
String
*
sep
=
NULL
,
sep_buf
;
uint
num_set_values
=
64
;
uint
num_set_values
=
64
;
ulonglong
mask
=
0x1
;
str
->
length
(
0
);
str
->
length
(
0
);
str
->
set_charset
(
collation
.
collation
);
str
->
set_charset
(
collation
.
collation
);
/* Check if some argument is a NULL value */
/* Check if some argument is a NULL value */
if
(
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
||
args
[
2
]
->
null_value
)
if
(
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
||
args
[
2
]
->
null_value
)
{
{
null_value
=
1
;
null_value
=
true
;
return
0
;
return
NULL
;
}
}
/*
/*
Arg count can only be 3, 4 or 5 here. This is guaranteed from the
Arg count can only be 3, 4 or 5 here. This is guaranteed from the
...
@@ -3324,37 +3322,56 @@ String* Item_func_export_set::val_str(String* str)
...
@@ -3324,37 +3322,56 @@ String* Item_func_export_set::val_str(String* str)
num_set_values
=
64
;
num_set_values
=
64
;
if
(
args
[
4
]
->
null_value
)
if
(
args
[
4
]
->
null_value
)
{
{
null_value
=
1
;
null_value
=
true
;
return
0
;
return
NULL
;
}
}
/* Fall through */
/* Fall through */
case
4
:
case
4
:
if
(
!
(
sep
=
args
[
3
]
->
val_str
(
&
sep_buf
)))
// Only true if NULL
if
(
!
(
sep
=
args
[
3
]
->
val_str
(
&
sep_buf
)))
// Only true if NULL
{
{
null_value
=
1
;
null_value
=
true
;
return
0
;
return
NULL
;
}
}
break
;
break
;
case
3
:
case
3
:
{
{
/* errors is not checked - assume "," can always be converted */
/* errors is not checked - assume "," can always be converted */
uint
errors
;
uint
errors
;
sep_buf
.
copy
(
STRING_WITH_LEN
(
","
),
&
my_charset_bin
,
collation
.
collation
,
&
errors
);
sep_buf
.
copy
(
STRING_WITH_LEN
(
","
),
&
my_charset_bin
,
collation
.
collation
,
&
errors
);
sep
=
&
sep_buf
;
sep
=
&
sep_buf
;
}
}
break
;
break
;
default:
default:
DBUG_ASSERT
(
0
);
// cannot happen
DBUG_ASSERT
(
0
);
// cannot happen
}
}
null_value
=
0
;
null_value
=
false
;
const
ulong
max_allowed_packet
=
current_thd
->
variables
.
max_allowed_packet
;
const
uint
num_separators
=
num_set_values
>
0
?
num_set_values
-
1
:
0
;
const
ulonglong
max_total_length
=
num_set_values
*
max
(
yes
->
length
(),
no
->
length
())
+
num_separators
*
sep
->
length
();
if
(
unlikely
(
max_total_length
>
max_allowed_packet
))
{
push_warning_printf
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_ALLOWED_PACKET_OVERFLOWED
,
ER
(
ER_WARN_ALLOWED_PACKET_OVERFLOWED
),
func_name
(),
max_allowed_packet
);
null_value
=
true
;
return
NULL
;
}
for
(
uint
i
=
0
;
i
<
num_set_values
;
i
++
,
mask
=
(
mask
<<
1
))
uint
ix
;
ulonglong
mask
;
for
(
ix
=
0
,
mask
=
0x1
;
ix
<
num_set_values
;
++
ix
,
mask
=
(
mask
<<
1
))
{
{
if
(
the_set
&
mask
)
if
(
the_set
&
mask
)
str
->
append
(
*
yes
);
str
->
append
(
*
yes
);
else
else
str
->
append
(
*
no
);
str
->
append
(
*
no
);
if
(
i
!=
num_set_values
-
1
)
if
(
i
x
!=
num_separators
)
str
->
append
(
*
sep
);
str
->
append
(
*
sep
);
}
}
return
str
;
return
str
;
...
...
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