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
b2d9799b
Commit
b2d9799b
authored
Oct 09, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
args_copy and cleunup() removed from Item_sum
registration changing ITEM_SUM arguments added
parent
234c80b6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
64 deletions
+18
-64
sql/item.cc
sql/item.cc
+8
-0
sql/item.h
sql/item.h
+1
-0
sql/item_sum.cc
sql/item_sum.cc
+1
-54
sql/item_sum.h
sql/item_sum.h
+3
-7
sql/sql_select.cc
sql/sql_select.cc
+5
-3
No files found.
sql/item.cc
View file @
b2d9799b
...
...
@@ -2629,6 +2629,14 @@ String *Item_type_holder::val_str(String*)
return
0
;
}
void
Item_result_field
::
cleanup
()
{
DBUG_ENTER
(
"Item_result_field::cleanup()"
);
Item
::
cleanup
();
result_field
=
0
;
DBUG_VOID_RETURN
;
}
/*****************************************************************************
** Instantiate templates
*****************************************************************************/
...
...
sql/item.h
View file @
b2d9799b
...
...
@@ -774,6 +774,7 @@ public:
{
save_in_field
(
result_field
,
no_conversions
);
}
void
cleanup
();
};
...
...
sql/item_sum.cc
View file @
b2d9799b
...
...
@@ -24,7 +24,7 @@
#include "mysql_priv.h"
Item_sum
::
Item_sum
(
List
<
Item
>
&
list
)
:
arg
s_copy
(
0
),
arg
_count
(
list
.
elements
)
:
arg_count
(
list
.
elements
)
{
if
((
args
=
(
Item
**
)
sql_alloc
(
sizeof
(
Item
*
)
*
arg_count
)))
{
...
...
@@ -56,39 +56,6 @@ Item_sum::Item_sum(THD *thd, Item_sum *item):
if
(
!
(
args
=
(
Item
**
)
thd
->
alloc
(
sizeof
(
Item
*
)
*
arg_count
)))
return
;
memcpy
(
args
,
item
->
args
,
sizeof
(
Item
*
)
*
arg_count
);
if
(
item
->
args_copy
!=
0
)
save_args
(
thd
);
else
args_copy
=
0
;
}
/*
Save copy of arguments if we prepare prepared statement
(arguments can be rewritten in get_tmp_table_item())
SYNOPSIS
Item_sum::save_args_for_prepared_statement()
thd - thread handler
RETURN
0 - OK
1 - Error
*/
bool
Item_sum
::
save_args_for_prepared_statement
(
THD
*
thd
)
{
if
(
thd
->
current_arena
->
is_stmt_prepare
())
return
save_args
(
thd
->
current_arena
);
return
0
;
}
bool
Item_sum
::
save_args
(
Item_arena
*
arena
)
{
if
(
!
(
args_copy
=
(
Item
**
)
arena
->
alloc
(
sizeof
(
Item
*
)
*
arg_count
)))
return
1
;
memcpy
(
args_copy
,
args
,
sizeof
(
Item
*
)
*
arg_count
);
return
0
;
}
...
...
@@ -99,17 +66,6 @@ void Item_sum::mark_as_sum_func()
}
void
Item_sum
::
cleanup
()
{
DBUG_ENTER
(
"Item_sum::cleanup"
);
Item_result_field
::
cleanup
();
if
(
args_copy
!=
0
)
memcpy
(
args
,
args_copy
,
sizeof
(
Item
*
)
*
arg_count
);
result_field
=
0
;
DBUG_VOID_RETURN
;
}
void
Item_sum
::
make_field
(
Send_field
*
tmp_field
)
{
if
(
args
[
0
]
->
type
()
==
Item
::
FIELD_ITEM
&&
keep_field_type
())
...
...
@@ -214,9 +170,6 @@ Item_sum_num::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
DBUG_ASSERT
(
fixed
==
0
);
if
(
save_args_for_prepared_statement
(
thd
))
return
1
;
if
(
!
thd
->
allow_sum_func
)
{
my_error
(
ER_INVALID_GROUP_FUNC_USE
,
MYF
(
0
));
...
...
@@ -248,9 +201,6 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
DBUG_ASSERT
(
fixed
==
0
);
if
(
save_args_for_prepared_statement
(
thd
))
return
1
;
Item
*
item
=
args
[
0
];
if
(
!
thd
->
allow_sum_func
)
{
...
...
@@ -1948,9 +1898,6 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
uint
i
;
/* for loop variable */
DBUG_ASSERT
(
fixed
==
0
);
if
(
save_args_for_prepared_statement
(
thd
))
return
1
;
if
(
!
thd
->
allow_sum_func
)
{
my_error
(
ER_INVALID_GROUP_FUNC_USE
,
MYF
(
0
));
...
...
sql/item_sum.h
View file @
b2d9799b
...
...
@@ -33,23 +33,22 @@ public:
};
Item
**
args
,
*
tmp_args
[
2
];
Item
**
args_copy
;
/* copy of arguments for PS */
uint
arg_count
;
bool
quick_group
;
/* If incremental update of fields */
void
mark_as_sum_func
();
Item_sum
()
:
arg
s_copy
(
0
),
arg
_count
(
0
),
quick_group
(
1
)
Item_sum
()
:
arg_count
(
0
),
quick_group
(
1
)
{
mark_as_sum_func
();
}
Item_sum
(
Item
*
a
)
:
args
(
tmp_args
),
arg
s_copy
(
0
),
arg
_count
(
1
),
quick_group
(
1
)
:
args
(
tmp_args
),
arg_count
(
1
),
quick_group
(
1
)
{
args
[
0
]
=
a
;
mark_as_sum_func
();
}
Item_sum
(
Item
*
a
,
Item
*
b
)
:
args
(
tmp_args
),
arg
s_copy
(
0
),
arg
_count
(
2
),
quick_group
(
1
)
:
args
(
tmp_args
),
arg_count
(
2
),
quick_group
(
1
)
{
args
[
0
]
=
a
;
args
[
1
]
=
b
;
mark_as_sum_func
();
...
...
@@ -57,7 +56,6 @@ public:
Item_sum
(
List
<
Item
>
&
list
);
//Copy constructor, need to perform subselects with temporary tables
Item_sum
(
THD
*
thd
,
Item_sum
*
item
);
void
cleanup
();
enum
Type
type
()
const
{
return
SUM_FUNC_ITEM
;
}
virtual
enum
Sumfunctype
sum_func
()
const
=
0
;
inline
bool
reset
()
{
clear
();
return
add
();
};
...
...
@@ -92,8 +90,6 @@ public:
virtual
bool
setup
(
THD
*
thd
)
{
return
0
;}
virtual
void
make_unique
()
{}
Item
*
get_tmp_table_item
(
THD
*
thd
);
bool
save_args_for_prepared_statement
(
THD
*
);
bool
save_args
(
Item_arena
*
arena
);
bool
walk
(
Item_processor
processor
,
byte
*
argument
);
};
...
...
sql/sql_select.cc
View file @
b2d9799b
...
...
@@ -4940,7 +4940,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
((
Item_sum
*
)
item
)
->
result_field
=
0
;
for
(
i
=
0
;
i
<
((
Item_sum
*
)
item
)
->
arg_count
;
i
++
)
{
Item
*
arg
=
((
Item_sum
*
)
item
)
->
args
[
i
];
Item
**
argp
=
((
Item_sum
*
)
item
)
->
args
+
i
;
Item
*
arg
=
*
argp
;
if
(
!
arg
->
const_item
())
{
Field
*
new_field
=
...
...
@@ -4956,7 +4957,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
*
blob_field
++=
new_field
;
blob_count
++
;
}
((
Item_sum
*
)
item
)
->
args
[
i
]
=
new
Item_field
(
new_field
);
thd
->
register_item_tree_change
(
argp
,
arg
,
&
thd
->
mem_root
);
*
argp
=
new
Item_field
(
new_field
);
if
(
!
(
new_field
->
flags
&
NOT_NULL_FLAG
))
{
null_count
++
;
...
...
@@ -4964,7 +4966,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
new_field->maybe_null() is still false, it will be
changed below. But we have to setup Item_field correctly
*/
(
(
Item_sum
*
)
item
)
->
args
[
i
]
->
maybe_null
=
1
;
(
*
argp
)
->
maybe_null
=
1
;
}
}
}
...
...
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