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
234c80b6
Commit
234c80b6
authored
Oct 08, 2004
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deployment of centralized Item change registry, step 2: Item_ref
doesn't need to have it's own recovery mechanism.
parent
b0154e21
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
51 additions
and
66 deletions
+51
-66
sql/item.cc
sql/item.cc
+2
-15
sql/item.h
sql/item.h
+10
-17
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+6
-3
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+1
-1
sql/item_func.cc
sql/item_func.cc
+5
-3
sql/item_func.h
sql/item_func.h
+1
-1
sql/item_row.cc
sql/item_row.cc
+5
-3
sql/item_row.h
sql/item_row.h
+1
-1
sql/item_strfunc.cc
sql/item_strfunc.cc
+10
-9
sql/item_strfunc.h
sql/item_strfunc.h
+2
-2
sql/item_subselect.cc
sql/item_subselect.cc
+1
-4
sql/sql_base.cc
sql/sql_base.cc
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+5
-5
No files found.
sql/item.cc
View file @
234c80b6
...
...
@@ -1334,7 +1334,6 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
Item_ref
*
rf
;
*
ref
=
rf
=
new
Item_ref
(
last
->
ref_pointer_array
+
counter
,
0
,
(
char
*
)
table_name
,
(
char
*
)
field_name
);
thd
->
register_item_tree_change
(
ref
,
this
,
&
thd
->
mem_root
);
...
...
@@ -1357,10 +1356,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
Item_ref
*
rf
;
thd
->
register_item_tree_change
(
ref
,
*
ref
,
&
thd
->
mem_root
);
*
ref
=
rf
=
new
Item_ref
(
ref
,
0
,
(
where
->
db
[
0
]
?
where
->
db
:
0
),
(
char
*
)
where
->
alias
,
(
char
*
)
field_name
);
*
ref
=
rf
=
new
Item_ref
((
where
->
db
[
0
]
?
where
->
db
:
0
),
(
char
*
)
where
->
alias
,
(
char
*
)
field_name
);
if
(
!
rf
)
return
1
;
/*
...
...
@@ -2061,16 +2058,6 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
}
void
Item_ref
::
cleanup
()
{
DBUG_ENTER
(
"Item_ref::cleanup"
);
Item_ident
::
cleanup
();
if
(
hook_ptr
)
*
hook_ptr
=
orig_item
;
DBUG_VOID_RETURN
;
}
void
Item_ref
::
print
(
String
*
str
)
{
if
(
ref
&&
*
ref
)
...
...
sql/item.h
View file @
234c80b6
...
...
@@ -237,7 +237,8 @@ class Item {
virtual
void
print
(
String
*
str_arg
)
{
str_arg
->
append
(
full_name
());
}
void
print_item_w_name
(
String
*
);
virtual
void
update_used_tables
()
{}
virtual
void
split_sum_func
(
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
{}
virtual
void
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
{}
virtual
bool
get_date
(
TIME
*
ltime
,
uint
fuzzydate
);
virtual
bool
get_time
(
TIME
*
ltime
);
virtual
bool
get_date_result
(
TIME
*
ltime
,
uint
fuzzydate
)
...
...
@@ -781,20 +782,13 @@ class Item_ref :public Item_ident
public:
Field
*
result_field
;
/* Save result here */
Item
**
ref
;
Item
**
hook_ptr
;
/* These two to restore */
Item
*
orig_item
;
/* things in 'cleanup()' */
Item_ref
(
Item
**
hook
,
Item
*
original
,
const
char
*
db_par
,
const
char
*
table_name_par
,
const
char
*
field_name_par
)
:
Item_ident
(
db_par
,
table_name_par
,
field_name_par
),
ref
(
0
),
hook_ptr
(
hook
),
orig_item
(
original
)
{}
Item_ref
(
Item
**
item
,
Item
**
hook
,
const
char
*
table_name_par
,
const
char
*
field_name_par
)
:
Item_ident
(
NullS
,
table_name_par
,
field_name_par
),
ref
(
item
),
hook_ptr
(
hook
),
orig_item
(
hook
?
*
hook
:
0
)
{}
// Constructor need to process subselect with temporary tables (see Item)
Item_ref
(
THD
*
thd
,
Item_ref
*
item
,
Item
**
hook
)
:
Item_ident
(
thd
,
item
),
ref
(
item
->
ref
),
hook_ptr
(
hook
),
orig_item
(
hook
?
*
hook
:
0
)
{}
Item_ref
(
const
char
*
db_par
,
const
char
*
table_name_par
,
const
char
*
field_name_par
)
:
Item_ident
(
db_par
,
table_name_par
,
field_name_par
),
ref
(
0
)
{}
Item_ref
(
Item
**
item
,
const
char
*
table_name_par
,
const
char
*
field_name_par
)
:
Item_ident
(
NullS
,
table_name_par
,
field_name_par
),
ref
(
item
)
{}
/* Constructor need to process subselect with temporary tables (see Item) */
Item_ref
(
THD
*
thd
,
Item_ref
*
item
)
:
Item_ident
(
thd
,
item
),
ref
(
item
->
ref
)
{}
enum
Type
type
()
const
{
return
REF_ITEM
;
}
bool
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
{
return
ref
&&
(
*
ref
)
->
eq
(
item
,
binary_cmp
);
}
...
...
@@ -845,7 +839,6 @@ class Item_ref :public Item_ident
}
Item
*
real_item
()
{
return
*
ref
;
}
void
print
(
String
*
str
);
void
cleanup
();
};
class
Item_in_subselect
;
...
...
@@ -856,7 +849,7 @@ class Item_ref_null_helper: public Item_ref
public:
Item_ref_null_helper
(
Item_in_subselect
*
master
,
Item
**
item
,
const
char
*
table_name_par
,
const
char
*
field_name_par
)
:
Item_ref
(
item
,
NULL
,
table_name_par
,
field_name_par
),
owner
(
master
)
{}
Item_ref
(
item
,
table_name_par
,
field_name_par
),
owner
(
master
)
{}
double
val
();
longlong
val_int
();
String
*
val_str
(
String
*
s
);
...
...
sql/item_cmpfunc.cc
View file @
234c80b6
...
...
@@ -2018,7 +2018,8 @@ bool Item_cond::walk(Item_processor processor, byte *arg)
return
Item_func
::
walk
(
processor
,
arg
);
}
void
Item_cond
::
split_sum_func
(
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
void
Item_cond
::
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
{
List_iterator
<
Item
>
li
(
list
);
Item
*
item
;
...
...
@@ -2027,13 +2028,15 @@ void Item_cond::split_sum_func(Item **ref_pointer_array, List<Item> &fields)
while
((
item
=
li
++
))
{
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
SUM_FUNC_ITEM
)
item
->
split_sum_func
(
ref_pointer_array
,
fields
);
item
->
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
else
if
(
item
->
used_tables
()
||
item
->
type
()
==
SUM_FUNC_ITEM
)
{
Item
**
ref
=
li
.
ref
();
uint
el
=
fields
.
elements
;
fields
.
push_front
(
item
);
ref_pointer_array
[
el
]
=
item
;
li
.
replace
(
new
Item_ref
(
ref_pointer_array
+
el
,
li
.
ref
(),
0
,
item
->
name
));
thd
->
register_item_tree_change
(
ref
,
*
ref
,
&
thd
->
mem_root
);
li
.
replace
(
new
Item_ref
(
ref_pointer_array
+
el
,
0
,
item
->
name
));
}
item
->
update_used_tables
();
used_tables_cache
|=
item
->
used_tables
();
...
...
sql/item_cmpfunc.h
View file @
234c80b6
...
...
@@ -931,7 +931,7 @@ class Item_cond :public Item_bool_func
table_map
used_tables
()
const
;
void
update_used_tables
();
void
print
(
String
*
str
);
void
split_sum_func
(
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
);
void
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
);
friend
int
setup_conds
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
**
conds
);
void
top_level_item
()
{
abort_on_null
=
1
;
}
void
copy_andor_arguments
(
THD
*
thd
,
Item_cond
*
item
);
...
...
sql/item_func.cc
View file @
234c80b6
...
...
@@ -257,20 +257,22 @@ bool Item_func::walk (Item_processor processor, byte *argument)
return
(
this
->*
processor
)(
argument
);
}
void
Item_func
::
split_sum_func
(
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
void
Item_func
::
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
{
Item
**
arg
,
**
arg_end
;
for
(
arg
=
args
,
arg_end
=
args
+
arg_count
;
arg
!=
arg_end
;
arg
++
)
{
Item
*
item
=*
arg
;
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
SUM_FUNC_ITEM
)
item
->
split_sum_func
(
ref_pointer_array
,
fields
);
item
->
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
else
if
(
item
->
used_tables
()
||
item
->
type
()
==
SUM_FUNC_ITEM
)
{
uint
el
=
fields
.
elements
;
fields
.
push_front
(
item
);
ref_pointer_array
[
el
]
=
item
;
*
arg
=
new
Item_ref
(
ref_pointer_array
+
el
,
arg
,
0
,
item
->
name
);
thd
->
register_item_tree_change
(
arg
,
*
arg
,
&
thd
->
mem_root
);
*
arg
=
new
Item_ref
(
ref_pointer_array
+
el
,
0
,
item
->
name
);
}
}
}
...
...
sql/item_func.h
View file @
234c80b6
...
...
@@ -121,7 +121,7 @@ class Item_func :public Item_result_field
void
set_arguments
(
List
<
Item
>
&
list
);
inline
uint
argument_count
()
const
{
return
arg_count
;
}
inline
void
remove_arguments
()
{
arg_count
=
0
;
}
v
irtual
void
split_sum_func
(
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
);
v
oid
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
);
void
print
(
String
*
str
);
void
print_op
(
String
*
str
);
void
print_args
(
String
*
str
,
uint
from
);
...
...
sql/item_row.cc
View file @
234c80b6
...
...
@@ -84,19 +84,21 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref)
return
0
;
}
void
Item_row
::
split_sum_func
(
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
void
Item_row
::
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
{
Item
**
arg
,
**
arg_end
;
for
(
arg
=
items
,
arg_end
=
items
+
arg_count
;
arg
!=
arg_end
;
arg
++
)
{
if
((
*
arg
)
->
with_sum_func
&&
(
*
arg
)
->
type
()
!=
SUM_FUNC_ITEM
)
(
*
arg
)
->
split_sum_func
(
ref_pointer_array
,
fields
);
(
*
arg
)
->
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
else
if
((
*
arg
)
->
used_tables
()
||
(
*
arg
)
->
type
()
==
SUM_FUNC_ITEM
)
{
uint
el
=
fields
.
elements
;
fields
.
push_front
(
*
arg
);
ref_pointer_array
[
el
]
=
*
arg
;
*
arg
=
new
Item_ref
(
ref_pointer_array
+
el
,
arg
,
0
,
(
*
arg
)
->
name
);
thd
->
register_item_tree_change
(
arg
,
*
arg
,
&
thd
->
mem_root
);
*
arg
=
new
Item_ref
(
ref_pointer_array
+
el
,
0
,
(
*
arg
)
->
name
);
}
}
}
...
...
sql/item_row.h
View file @
234c80b6
...
...
@@ -57,7 +57,7 @@ class Item_row: public Item
return
0
;
};
bool
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
**
ref
);
void
split_sum_func
(
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
);
void
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
);
table_map
used_tables
()
const
{
return
used_tables_cache
;
};
bool
const_item
()
const
{
return
const_item_cache
;
};
enum
Item_result
result_type
()
const
{
return
ROW_RESULT
;
}
...
...
sql/item_strfunc.cc
View file @
234c80b6
...
...
@@ -635,20 +635,20 @@ String *Item_func_concat_ws::val_str(String *str)
return
0
;
}
void
Item_func_concat_ws
::
split_sum_func
(
Item
**
ref_pointer_array
,
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
(
ref_pointer_array
,
fields
);
separator
->
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
else
if
(
separator
->
used_tables
()
||
separator
->
type
()
==
SUM_FUNC_ITEM
)
{
uint
el
=
fields
.
elements
;
fields
.
push_front
(
separator
);
ref_pointer_array
[
el
]
=
separator
;
separator
=
new
Item_ref
(
ref_pointer_array
+
el
,
&
separator
,
0
,
separator
->
name
);
thd
->
register_item_tree_change
(
&
separator
,
separator
,
&
thd
->
mem_root
);
separator
=
new
Item_ref
(
ref_pointer_array
+
el
,
0
,
separator
->
name
);
}
Item_str_func
::
split_sum_func
(
ref_pointer_array
,
fields
);
Item_str_func
::
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
}
void
Item_func_concat_ws
::
fix_length_and_dec
()
...
...
@@ -1771,19 +1771,20 @@ String *Item_func_elt::val_str(String *str)
}
void
Item_func_make_set
::
split_sum_func
(
Item
**
ref_pointer_array
,
void
Item_func_make_set
::
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
{
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
SUM_FUNC_ITEM
)
item
->
split_sum_func
(
ref_pointer_array
,
fields
);
item
->
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
else
if
(
item
->
used_tables
()
||
item
->
type
()
==
SUM_FUNC_ITEM
)
{
uint
el
=
fields
.
elements
;
fields
.
push_front
(
item
);
ref_pointer_array
[
el
]
=
item
;
item
=
new
Item_ref
(
ref_pointer_array
+
el
,
&
item
,
0
,
item
->
name
);
thd
->
register_item_tree_change
(
&
item
,
item
,
&
thd
->
mem_root
);
item
=
new
Item_ref
(
ref_pointer_array
+
el
,
0
,
item
->
name
);
}
Item_str_func
::
split_sum_func
(
ref_pointer_array
,
fields
);
Item_str_func
::
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
}
...
...
sql/item_strfunc.h
View file @
234c80b6
...
...
@@ -105,7 +105,7 @@ class Item_func_concat_ws :public Item_str_func
separator
->
check_cols
(
1
)
||
Item_func
::
fix_fields
(
thd
,
tlist
,
ref
));
}
void
split_sum_func
(
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
);
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
)
{
...
...
@@ -418,7 +418,7 @@ class Item_func_make_set :public Item_str_func
item
->
check_cols
(
1
)
||
Item_func
::
fix_fields
(
thd
,
tlist
,
ref
));
}
void
split_sum_func
(
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
);
void
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
);
void
fix_length_and_dec
();
void
update_used_tables
();
const
char
*
func_name
()
const
{
return
"make_set"
;
}
...
...
sql/item_subselect.cc
View file @
234c80b6
...
...
@@ -770,7 +770,6 @@ Item_in_subselect::single_value_transformer(JOIN *join,
we can use same item for all selects.
*/
expr
=
new
Item_ref
((
Item
**
)
optimizer
->
get_cache
(),
NULL
,
(
char
*
)
"<no matter>"
,
(
char
*
)
in_left_expr_name
);
...
...
@@ -966,9 +965,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
(
char
*
)
"<no matter>"
,
(
char
*
)
"<list ref>"
);
func
=
eq_creator
.
create
(
new
Item_ref
((
*
optimizer
->
get_cache
())
->
addr
(
i
),
NULL
,
eq_creator
.
create
(
new
Item_ref
((
*
optimizer
->
get_cache
())
->
addr
(
i
),
(
char
*
)
"<no matter>"
,
(
char
*
)
in_left_expr_name
),
func
);
...
...
sql/sql_base.cc
View file @
234c80b6
...
...
@@ -2384,7 +2384,7 @@ int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
*
(
ref
++
)
=
item
;
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
Item
::
SUM_FUNC_ITEM
&&
sum_func_list
)
item
->
split_sum_func
(
ref_pointer_array
,
*
sum_func_list
);
item
->
split_sum_func
(
thd
,
ref_pointer_array
,
*
sum_func_list
);
thd
->
used_tables
|=
item
->
used_tables
();
}
DBUG_RETURN
(
test
(
thd
->
net
.
report_error
));
...
...
sql/sql_select.cc
View file @
234c80b6
...
...
@@ -292,7 +292,7 @@ JOIN::prepare(Item ***rref_pointer_array,
if
(
having_fix_rc
||
thd
->
net
.
report_error
)
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
if
(
having
->
with_sum_func
)
having
->
split_sum_func
(
ref_pointer_array
,
all_fields
);
having
->
split_sum_func
(
thd
,
ref_pointer_array
,
all_fields
);
}
// Is it subselect
...
...
sql/sql_yacc.yy
View file @
234c80b6
...
...
@@ -4879,7 +4879,7 @@ simple_ident:
$$= (sel->parsing_place != IN_HAVING ||
sel->get_in_sum_expr() > 0) ?
(Item*) new Item_field(NullS,NullS,$1.str) :
(Item*) new Item_ref(
0,0, NullS,NullS,
$1.str);
(Item*) new Item_ref(
NullS, NullS,
$1.str);
}
| ident '.' ident
{
...
...
@@ -4895,7 +4895,7 @@ simple_ident:
$$= (sel->parsing_place != IN_HAVING ||
sel->get_in_sum_expr() > 0) ?
(Item*) new Item_field(NullS,$1.str,$3.str) :
(Item*) new Item_ref(
0,0,NullS,$1.str,
$3.str);
(Item*) new Item_ref(
NullS, $1.str,
$3.str);
}
| '.' ident '.' ident
{
...
...
@@ -4911,7 +4911,7 @@ simple_ident:
$$= (sel->parsing_place != IN_HAVING ||
sel->get_in_sum_expr() > 0) ?
(Item*) new Item_field(NullS,$2.str,$4.str) :
(Item*) new Item_ref(
0,0,NullS,$2.str,
$4.str);
(Item*) new Item_ref(
NullS, $2.str,
$4.str);
}
| ident '.' ident '.' ident
{
...
...
@@ -4929,8 +4929,8 @@ simple_ident:
(Item*) new Item_field((YYTHD->client_capabilities &
CLIENT_NO_SCHEMA ? NullS : $1.str),
$3.str, $5.str) :
(Item*) new Item_ref(
0,0,
(YYTHD->client_capabilities &
CLIENT_NO_SCHEMA ? NullS : $1.str),
(Item*) new Item_ref((YYTHD->client_capabilities &
CLIENT_NO_SCHEMA ? NullS : $1.str),
$3.str, $5.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