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
c334bc8c
Commit
c334bc8c
authored
May 07, 2013
by
Chaithra Gopalareddy
Browse files
Options
Browse Files
Download
Plain Diff
Merge from 5.1 to 5.5
parents
7e2c2bb9
266dd9c0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
40 deletions
+72
-40
sql/item_func.h
sql/item_func.h
+8
-0
sql/sql_select.cc
sql/sql_select.cc
+64
-40
No files found.
sql/item_func.h
View file @
c334bc8c
...
...
@@ -1492,6 +1492,14 @@ public:
:
Item_func
(
b
),
cached_result_type
(
INT_RESULT
),
entry
(
NULL
),
entry_thread_id
(
0
),
delayed_non_constness
(
delayed
),
name
(
a
)
{}
Item_func_set_user_var
(
THD
*
thd
,
Item_func_set_user_var
*
item
)
:
Item_func
(
thd
,
item
),
cached_result_type
(
item
->
cached_result_type
),
entry
(
item
->
entry
),
entry_thread_id
(
item
->
entry_thread_id
),
value
(
item
->
value
),
decimal_buff
(
item
->
decimal_buff
),
null_item
(
item
->
null_item
),
save_result
(
item
->
save_result
),
name
(
item
->
name
)
{}
enum
Functype
functype
()
const
{
return
SUSERVAR_FUNC
;
}
double
val_real
();
longlong
val_int
();
...
...
sql/sql_select.cc
View file @
c334bc8c
...
...
@@ -15966,20 +15966,44 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
res_selected_fields
.
empty
();
res_all_fields
.
empty
();
uint
i
,
border
=
all_fields
.
elements
-
elements
;
for
(
i
=
0
;
(
item
=
it
++
);
i
++
)
uint
border
=
all_fields
.
elements
-
elements
;
for
(
uint
i
=
0
;
(
item
=
it
++
);
i
++
)
{
Field
*
field
;
if
((
item
->
with_sum_func
&&
item
->
type
()
!=
Item
::
SUM_FUNC_ITEM
)
||
(
item
->
type
()
==
Item
::
FUNC_ITEM
&&
((
Item_func
*
)
item
)
->
functype
()
==
Item_func
::
SUSERVAR_FUNC
))
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
Item
::
SUM_FUNC_ITEM
)
item_field
=
item
;
else
else
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
)
item_field
=
item
->
get_tmp_table_item
(
thd
);
else
if
(
item
->
type
()
==
Item
::
FUNC_ITEM
&&
((
Item_func
*
)
item
)
->
functype
()
==
Item_func
::
SUSERVAR_FUNC
)
{
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
)
field
=
item
->
get_tmp_table_field
();
if
(
field
!=
NULL
)
{
item_field
=
item
->
get_tmp_table_item
(
thd
);
/*
Replace "@:=<expression>" with "@:=<tmp table column>". Otherwise, we
would re-evaluate <expression>, and if expression were a subquery, this
would access already-unlocked tables.
*/
Item_func_set_user_var
*
suv
=
new
Item_func_set_user_var
(
thd
,
(
Item_func_set_user_var
*
)
item
);
Item_field
*
new_field
=
new
Item_field
(
field
);
if
(
!
suv
||
!
new_field
)
DBUG_RETURN
(
true
);
// Fatal error
/*
We are replacing the argument of Item_func_set_user_var after its value
has been read. The argument's null_value should be set by now, so we
must set it explicitly for the replacement argument since the null_value
may be read without any preceeding call to val_*().
*/
new_field
->
update_null_value
();
List
<
Item
>
list
;
list
.
push_back
(
new_field
);
suv
->
set_arguments
(
list
);
item_field
=
suv
;
}
else
item_field
=
item
;
}
else
if
((
field
=
item
->
get_tmp_table_field
()))
{
...
...
@@ -15988,7 +16012,7 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
else
item_field
=
(
Item
*
)
new
Item_field
(
field
);
if
(
!
item_field
)
DBUG_RETURN
(
TRUE
);
// Fatal error
DBUG_RETURN
(
true
);
// Fatal error
if
(
item
->
real_item
()
->
type
()
!=
Item
::
FIELD_ITEM
)
field
->
orig_table
=
0
;
...
...
@@ -16013,17 +16037,17 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
}
else
item_field
=
item
;
}
res_all_fields
.
push_back
(
item_field
);
ref_pointer_array
[((
i
<
border
)
?
all_fields
.
elements
-
i
-
1
:
i
-
border
)]
=
item_field
;
}
List_iterator_fast
<
Item
>
itr
(
res_all_fields
);
for
(
i
=
0
;
i
<
border
;
i
++
)
for
(
uint
i
=
0
;
i
<
border
;
i
++
)
itr
++
;
itr
.
sublist
(
res_selected_fields
,
elements
);
DBUG_RETURN
(
FALSE
);
DBUG_RETURN
(
false
);
}
...
...
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