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
21a6fcbf
Commit
21a6fcbf
authored
Oct 28, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
An extra "separator" class member was removed from Item_func_concat_ws.
args[0] is now used instead.
parent
8600baf3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
74 deletions
+14
-74
sql/item_func.cc
sql/item_func.cc
+2
-2
sql/item_strfunc.cc
sql/item_strfunc.cc
+10
-52
sql/item_strfunc.h
sql/item_strfunc.h
+1
-19
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-1
No files found.
sql/item_func.cc
View file @
21a6fcbf
...
@@ -2873,10 +2873,10 @@ void Item_func_match::init_search(bool no_order)
...
@@ -2873,10 +2873,10 @@ void Item_func_match::init_search(bool no_order)
if
(
key
==
NO_SUCH_KEY
)
if
(
key
==
NO_SUCH_KEY
)
{
{
List
<
Item
>
fields
;
List
<
Item
>
fields
;
fields
.
push_back
(
new
Item_string
(
" "
,
1
,
cmp_collation
.
collation
));
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
fields
.
push_back
(
args
[
i
]);
fields
.
push_back
(
args
[
i
]);
concat
=
new
Item_func_concat_ws
(
new
Item_string
(
" "
,
1
,
concat
=
new
Item_func_concat_ws
(
fields
);
cmp_collation
.
collation
),
fields
);
/*
/*
Above function used only to get value and do not need fix_fields for it:
Above function used only to get value and do not need fix_fields for it:
Item_string - basic constant
Item_string - basic constant
...
...
sql/item_strfunc.cc
View file @
21a6fcbf
...
@@ -532,7 +532,7 @@ String *Item_func_concat_ws::val_str(String *str)
...
@@ -532,7 +532,7 @@ String *Item_func_concat_ws::val_str(String *str)
uint
i
;
uint
i
;
null_value
=
0
;
null_value
=
0
;
if
(
!
(
sep_str
=
separator
->
val_str
(
&
tmp_sep_str
)))
if
(
!
(
sep_str
=
args
[
0
]
->
val_str
(
&
tmp_sep_str
)))
goto
null
;
goto
null
;
use_as_buff
=
&
tmp_value
;
use_as_buff
=
&
tmp_value
;
...
@@ -541,7 +541,7 @@ String *Item_func_concat_ws::val_str(String *str)
...
@@ -541,7 +541,7 @@ String *Item_func_concat_ws::val_str(String *str)
// Skip until non-null argument is found.
// Skip until non-null argument is found.
// If not, return the empty string
// If not, return the empty string
for
(
i
=
0
;
i
<
arg_count
;
i
++
)
for
(
i
=
1
;
i
<
arg_count
;
i
++
)
if
((
res
=
args
[
i
]
->
val_str
(
str
)))
if
((
res
=
args
[
i
]
->
val_str
(
str
)))
break
;
break
;
if
(
i
==
arg_count
)
if
(
i
==
arg_count
)
...
@@ -635,67 +635,25 @@ String *Item_func_concat_ws::val_str(String *str)
...
@@ -635,67 +635,25 @@ String *Item_func_concat_ws::val_str(String *str)
return
0
;
return
0
;
}
}
void
Item_func_concat_ws
::
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
{
if
(
separator
->
with_sum_func
&&
separator
->
type
()
!=
SUM_FUNC_ITEM
)
separator
->
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
else
if
(
separator
->
used_tables
()
||
separator
->
type
()
==
SUM_FUNC_ITEM
)
{
uint
el
=
fields
.
elements
;
Item
*
new_item
=
new
Item_ref
(
ref_pointer_array
+
el
,
0
,
separator
->
name
);
fields
.
push_front
(
separator
);
ref_pointer_array
[
el
]
=
separator
;
thd
->
change_item_tree
(
&
separator
,
new_item
);
}
Item_str_func
::
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
}
void
Item_func_concat_ws
::
fix_length_and_dec
()
void
Item_func_concat_ws
::
fix_length_and_dec
()
{
{
collation
.
set
(
separator
->
collation
);
max_length
=
0
;
max_length
=
separator
->
max_length
*
(
arg_count
-
1
);
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
if
(
agg_arg_collations
(
collation
,
args
,
arg_count
))
{
return
;
DTCollation
tmp
(
collation
.
collation
,
collation
.
derivation
);
max_length
=
arg_count
>
1
?
args
[
0
]
->
max_length
*
(
arg_count
-
2
)
:
0
;
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
max_length
+=
args
[
i
]
->
max_length
;
max_length
+=
args
[
i
]
->
max_length
;
if
(
collation
.
aggregate
(
args
[
i
]
->
collation
))
{
collation
.
set
(
tmp
);
// Restore the previous value
my_coll_agg_error
(
collation
,
args
[
i
]
->
collation
,
func_name
());
break
;
}
}
if
(
max_length
>
MAX_BLOB_WIDTH
)
if
(
max_length
>
MAX_BLOB_WIDTH
)
{
{
max_length
=
MAX_BLOB_WIDTH
;
max_length
=
MAX_BLOB_WIDTH
;
maybe_null
=
1
;
maybe_null
=
1
;
}
}
used_tables_cache
|=
separator
->
used_tables
();
not_null_tables_cache
&=
separator
->
not_null_tables
();
const_item_cache
&=
separator
->
const_item
();
with_sum_func
=
with_sum_func
||
separator
->
with_sum_func
;
}
void
Item_func_concat_ws
::
update_used_tables
()
{
Item_func
::
update_used_tables
();
separator
->
update_used_tables
();
used_tables_cache
|=
separator
->
used_tables
();
const_item_cache
&=
separator
->
const_item
();
}
}
void
Item_func_concat_ws
::
print
(
String
*
str
)
{
str
->
append
(
"concat_ws("
,
10
);
separator
->
print
(
str
);
if
(
arg_count
)
{
str
->
append
(
','
);
print_args
(
str
,
0
);
}
str
->
append
(
')'
);
}
String
*
Item_func_reverse
::
val_str
(
String
*
str
)
String
*
Item_func_reverse
::
val_str
(
String
*
str
)
{
{
...
...
sql/item_strfunc.h
View file @
21a6fcbf
...
@@ -89,30 +89,12 @@ class Item_func_concat :public Item_str_func
...
@@ -89,30 +89,12 @@ class Item_func_concat :public Item_str_func
class
Item_func_concat_ws
:
public
Item_str_func
class
Item_func_concat_ws
:
public
Item_str_func
{
{
Item
*
separator
;
String
tmp_value
;
String
tmp_value
;
public:
public:
Item_func_concat_ws
(
Item
*
a
,
List
<
Item
>
&
list
)
Item_func_concat_ws
(
List
<
Item
>
&
list
)
:
Item_str_func
(
list
)
{}
:
Item_str_func
(
list
),
separator
(
a
)
{}
String
*
val_str
(
String
*
);
String
*
val_str
(
String
*
);
void
fix_length_and_dec
();
void
fix_length_and_dec
();
void
update_used_tables
();
bool
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tlist
,
Item
**
ref
)
{
DBUG_ASSERT
(
fixed
==
0
);
return
(
separator
->
fix_fields
(
thd
,
tlist
,
&
separator
)
||
separator
->
check_cols
(
1
)
||
Item_func
::
fix_fields
(
thd
,
tlist
,
ref
));
}
void
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
);
const
char
*
func_name
()
const
{
return
"concat_ws"
;
}
const
char
*
func_name
()
const
{
return
"concat_ws"
;
}
bool
walk
(
Item_processor
processor
,
byte
*
arg
)
{
return
separator
->
walk
(
processor
,
arg
)
||
Item_str_func
::
walk
(
processor
,
arg
);
}
void
print
(
String
*
str
);
};
};
class
Item_func_reverse
:
public
Item_str_func
class
Item_func_reverse
:
public
Item_str_func
...
...
sql/sql_yacc.yy
View file @
21a6fcbf
...
@@ -2889,7 +2889,7 @@ simple_expr:
...
@@ -2889,7 +2889,7 @@ simple_expr:
| CONCAT '(' expr_list ')'
| CONCAT '(' expr_list ')'
{ $$= new Item_func_concat(* $3); }
{ $$= new Item_func_concat(* $3); }
| CONCAT_WS '(' expr ',' expr_list ')'
| CONCAT_WS '(' expr ',' expr_list ')'
{ $
$= new Item_func_concat_ws($3,
*$5); }
{ $
5->push_front($3); $$= new Item_func_concat_ws(
*$5); }
| CONVERT_TZ_SYM '(' expr ',' expr ',' expr ')'
| CONVERT_TZ_SYM '(' expr ',' expr ',' expr ')'
{
{
Lex->time_zone_tables_used= &fake_time_zone_tables_list;
Lex->time_zone_tables_used= &fake_time_zone_tables_list;
...
...
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