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
55094f90
Commit
55094f90
authored
Aug 16, 2003
by
bell@laptop.sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
As far as now transformer called after setup_wild() it is impossible to have '*'
parent
75812927
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
114 deletions
+13
-114
sql/item.cc
sql/item.cc
+0
-53
sql/item.h
sql/item.h
+10
-26
sql/item_subselect.cc
sql/item_subselect.cc
+3
-34
sql/item_subselect.h
sql/item_subselect.h
+0
-1
No files found.
sql/item.cc
View file @
55094f90
...
...
@@ -722,59 +722,6 @@ bool Item::fix_fields(THD *thd,
return
0
;
}
bool
Item_asterisk_remover
::
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
list
,
Item
**
ref
)
{
DBUG_ENTER
(
"Item_asterisk_remover::fix_fields"
);
bool
res
=
1
;
if
(
item
)
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
&&
((
Item_field
*
)
item
)
->
field_name
[
0
]
==
'*'
)
{
Item_field
*
fitem
=
(
Item_field
*
)
item
;
if
(
list
)
if
(
!
list
->
next
||
fitem
->
db_name
||
fitem
->
table_name
)
{
TABLE_LIST
*
table
=
find_table_in_list
(
list
,
fitem
->
db_name
,
fitem
->
table_name
);
if
(
table
)
{
TABLE
*
tb
=
table
->
table
;
if
(
find_table_in_list
(
table
->
next
,
fitem
->
db_name
,
fitem
->
table_name
)
!=
0
||
tb
->
fields
==
1
)
{
if
((
item
=
new
Item_field
(
tb
->
field
[
0
])))
{
res
=
0
;
tb
->
field
[
0
]
->
query_id
=
thd
->
query_id
;
tb
->
used_keys
&=
tb
->
field
[
0
]
->
part_of_key
;
tb
->
used_fields
=
tb
->
fields
;
}
else
thd
->
fatal_error
();
// can't create Item => out of memory
}
else
my_error
(
ER_CARDINALITY_COL
,
MYF
(
0
),
1
);
}
else
my_error
(
ER_BAD_TABLE_ERROR
,
MYF
(
0
),
fitem
->
table_name
);
}
else
my_error
(
ER_CARDINALITY_COL
,
MYF
(
0
),
1
);
else
my_error
(
ER_NO_TABLES_USED
,
MYF
(
0
));
}
else
res
=
item
->
fix_fields
(
thd
,
list
,
&
item
);
else
thd
->
fatal_error
();
// no item given => out of memory
DBUG_RETURN
(
res
);
}
bool
Item_ref_on_list_position
::
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tables
,
Item
**
reference
)
...
...
sql/item.h
View file @
55094f90
...
...
@@ -626,6 +626,16 @@ public:
}
};
class
Item_null_helper
:
public
Item_ref_null_helper
{
Item
*
store
;
public:
Item_null_helper
(
Item_in_subselect
*
master
,
Item
*
item
,
const
char
*
table_name_par
,
const
char
*
field_name_par
)
:
Item_ref_null_helper
(
master
,
&
store
,
table_name_par
,
field_name_par
),
store
(
item
)
{}
};
/*
Used to find item in list of select items after '*' items processing.
...
...
@@ -654,32 +664,6 @@ public:
bool
fix_fields
(
THD
*
,
struct
st_table_list
*
,
Item
**
ref
);
};
/*
To resolve '*' field moved to condition
and register NULL values
*/
class
Item_asterisk_remover
:
public
Item_ref_null_helper
{
Item
*
item
;
public:
Item_asterisk_remover
(
Item_in_subselect
*
master
,
Item
*
it
,
char
*
table
,
char
*
field
)
:
Item_ref_null_helper
(
master
,
&
item
,
table
,
field
),
item
(
it
)
{}
bool
fix_fields
(
THD
*
,
struct
st_table_list
*
,
Item
**
ref
);
Item
**
storage
()
{
return
&
item
;}
void
print
(
String
*
str
)
{
str
->
append
(
"ref_null_helper('"
);
if
(
item
)
item
->
print
(
str
);
else
str
->
append
(
'?'
);
str
->
append
(
')'
);
}
};
/*
The following class is used to optimize comparing of date columns
We need to save the original item, to be able to set the field to the
...
...
sql/item_subselect.cc
View file @
55094f90
...
...
@@ -559,27 +559,6 @@ Item_in_subselect::single_value_transformer(JOIN *join,
if
(
select_lex
->
table_list
.
elements
)
{
Item
*
having
=
item
,
*
isnull
=
item
;
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
&&
((
Item_field
*
)
item
)
->
field_name
[
0
]
==
'*'
)
{
Item_asterisk_remover
*
remover
;
item
=
remover
=
new
Item_asterisk_remover
(
this
,
item
,
(
char
*
)
"<no matter>"
,
(
char
*
)
"<result>"
);
if
(
!
abort_on_null
)
{
having
=
new
Item_is_not_null_test
(
this
,
new
Item_ref
(
remover
->
storage
(),
(
char
*
)
"<no matter>"
,
(
char
*
)
"<null test>"
));
isnull
=
new
Item_is_not_null_test
(
this
,
new
Item_ref
(
remover
->
storage
(),
(
char
*
)
"<no matter>"
,
(
char
*
)
"<null test>"
));
}
}
item
=
(
*
func
)(
expr
,
item
);
if
(
!
abort_on_null
)
{
...
...
@@ -603,22 +582,12 @@ Item_in_subselect::single_value_transformer(JOIN *join,
}
else
{
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
&&
((
Item_field
*
)
item
)
->
field_name
[
0
]
==
'*'
)
{
my_error
(
ER_NO_TABLES_USED
,
MYF
(
0
));
DBUG_RETURN
(
ERROR
);
}
if
(
select_lex
->
master_unit
()
->
first_select
()
->
next_select
())
{
/*
It is in union => we should perform it.
Item_asterisk_remover used only as wrapper to receine NULL value
*/
join
->
having
=
(
*
func
)(
expr
,
new
Item_
asterisk_remov
er
(
this
,
item
,
(
char
*
)
"<no matter>"
,
(
char
*
)
"<result>"
));
new
Item_
null_help
er
(
this
,
item
,
(
char
*
)
"<no matter>"
,
(
char
*
)
"<result>"
));
select_lex
->
having_fix_field
=
1
;
if
(
join
->
having
->
fix_fields
(
thd
,
join
->
tables_list
,
&
join
->
having
))
{
...
...
sql/item_subselect.h
View file @
55094f90
...
...
@@ -225,7 +225,6 @@ public:
void
top_level_item
()
{
abort_on_null
=
1
;
}
bool
test_limit
(
st_select_lex_unit
*
unit
);
friend
class
Item_asterisk_remover
;
friend
class
Item_ref_null_helper
;
friend
class
Item_is_not_null_test
;
friend
class
subselect_indexin_engine
;
...
...
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