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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
2fc0d7e4
Commit
2fc0d7e4
authored
Oct 28, 2004
by
bar@mysql.com
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
891a8f57
Changes
4
Show 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 @
2fc0d7e4
...
...
@@ -2873,10 +2873,10 @@ void Item_func_match::init_search(bool no_order)
if
(
key
==
NO_SUCH_KEY
)
{
List
<
Item
>
fields
;
fields
.
push_back
(
new
Item_string
(
" "
,
1
,
cmp_collation
.
collation
));
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
fields
.
push_back
(
args
[
i
]);
concat
=
new
Item_func_concat_ws
(
new
Item_string
(
" "
,
1
,
cmp_collation
.
collation
),
fields
);
concat
=
new
Item_func_concat_ws
(
fields
);
/*
Above function used only to get value and do not need fix_fields for it:
Item_string - basic constant
...
...
sql/item_strfunc.cc
View file @
2fc0d7e4
...
...
@@ -532,7 +532,7 @@ String *Item_func_concat_ws::val_str(String *str)
uint
i
;
null_value
=
0
;
if
(
!
(
sep_str
=
separator
->
val_str
(
&
tmp_sep_str
)))
if
(
!
(
sep_str
=
args
[
0
]
->
val_str
(
&
tmp_sep_str
)))
goto
null
;
use_as_buff
=
&
tmp_value
;
...
...
@@ -541,7 +541,7 @@ String *Item_func_concat_ws::val_str(String *str)
// Skip until non-null argument is found.
// 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
)))
break
;
if
(
i
==
arg_count
)
...
...
@@ -635,67 +635,25 @@ null:
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
()
{
collation
.
set
(
separator
->
collation
);
max_length
=
separator
->
max_length
*
(
arg_count
-
1
);
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
{
DTCollation
tmp
(
collation
.
collation
,
collation
.
derivation
);
max_length
=
0
;
if
(
agg_arg_collations
(
collation
,
args
,
arg_count
))
return
;
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
;
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
)
{
max_length
=
MAX_BLOB_WIDTH
;
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
)
{
...
...
sql/item_strfunc.h
View file @
2fc0d7e4
...
...
@@ -89,30 +89,12 @@ public:
class
Item_func_concat_ws
:
public
Item_str_func
{
Item
*
separator
;
String
tmp_value
;
public:
Item_func_concat_ws
(
Item
*
a
,
List
<
Item
>
&
list
)
:
Item_str_func
(
list
),
separator
(
a
)
{}
Item_func_concat_ws
(
List
<
Item
>
&
list
)
:
Item_str_func
(
list
)
{}
String
*
val_str
(
String
*
);
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"
;
}
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
...
...
sql/sql_yacc.yy
View file @
2fc0d7e4
...
...
@@ -2889,7 +2889,7 @@ simple_expr:
| CONCAT '(' expr_list ')'
{ $$= new Item_func_concat(* $3); }
| 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 ')'
{
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