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
f8ff8fc6
Commit
f8ff8fc6
authored
Nov 27, 2002
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
after review changes in IN/ALL/ANY/SOME (SCRUM)
parent
aa9bfb44
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
22 deletions
+69
-22
sql/item.cc
sql/item.cc
+37
-15
sql/item.h
sql/item.h
+4
-4
sql/item_subselect.cc
sql/item_subselect.cc
+3
-3
sql/mysql_priv.h
sql/mysql_priv.h
+2
-0
sql/sql_base.cc
sql/sql_base.cc
+23
-0
No files found.
sql/item.cc
View file @
f8ff8fc6
...
...
@@ -457,30 +457,52 @@ bool Item_asterisk_remover::fix_fields(THD *thd,
{
DBUG_ENTER
(
"Item_asterisk_remover::fix_fields"
);
bool
res
;
bool
res
=
1
;
if
(
item
)
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
&&
((
Item_field
*
)
item
)
->
field_name
[
0
]
==
'*'
)
{
List
<
Item
>
fields
;
fields
.
push_back
(
item
);
List_iterator
<
Item
>
it
(
fields
);
it
++
;
uint
elem
=
fields
.
elements
;
if
(
insert_fields
(
thd
,
list
,
((
Item_field
*
)
item
)
->
db_name
,
((
Item_field
*
)
item
)
->
table_name
,
&
it
))
res
=
-
1
;
else
if
(
fields
.
elements
>
1
)
Item_field
*
fitem
=
(
Item_field
*
)
item
;
if
(
!
list
->
next
||
fitem
->
db_name
||
fitem
->
table_name
)
{
TABLE_LIST
*
table
=
find_table_in_list
(
thd
,
list
,
fitem
->
db_name
,
fitem
->
table_name
);
if
(
table
)
{
TABLE
*
tb
=
table
->
table
;
if
(
find_table_in_list
(
thd
,
table
->
next
,
fitem
->
db_name
,
fitem
->
table_name
)
!=
0
||
tb
->
fields
==
1
)
{
my_message
(
ER_SUBSELECT_NO_1_COL
,
ER
(
ER_SUBSELECT_NO_1_COL
),
MYF
(
0
));
res
=
-
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
=
1
;
// can't create Item => out of memory
}
else
my_message
(
ER_SUBSELECT_NO_1_COL
,
ER
(
ER_SUBSELECT_NO_1_COL
),
MYF
(
0
));
}
else
if
(
!
fitem
->
table_name
)
my_error
(
ER_NO_TABLES_USED
,
MYF
(
0
));
else
my_error
(
ER_BAD_TABLE_ERROR
,
MYF
(
0
),
fitem
->
table_name
);
}
else
my_message
(
ER_SUBSELECT_NO_1_COL
,
ER
(
ER_SUBSELECT_NO_1_COL
),
MYF
(
0
));
}
else
res
=
item
->
fix_fields
(
thd
,
list
,
&
item
);
else
res
=
-
1
;
thd
->
fatal_error
=
1
;
// no item given => out of memory
*
ref
=
item
;
DBUG_RETURN
(
res
);
}
...
...
sql/item.h
View file @
f8ff8fc6
...
...
@@ -124,9 +124,9 @@ public:
class
Item_outer_select_context_saver
:
public
Item_wrapper
{
public:
Item_outer_select_context_saver
(
Item
*
i
)
Item_outer_select_context_saver
(
Item
*
i
t
)
{
item
=
i
;
item
=
i
t
;
}
bool
fix_fields
(
THD
*
,
struct
st_table_list
*
,
Item
**
ref
);
};
...
...
@@ -137,9 +137,9 @@ public:
class
Item_asterisk_remover
:
public
Item_wrapper
{
public:
Item_asterisk_remover
(
Item
*
i
)
Item_asterisk_remover
(
Item
*
i
t
)
{
item
=
i
;
item
=
i
t
;
}
bool
fix_fields
(
THD
*
,
struct
st_table_list
*
,
Item
**
ref
);
};
...
...
sql/item_subselect.cc
View file @
f8ff8fc6
...
...
@@ -280,13 +280,13 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex,
compare_func_creator
func
)
{
DBUG_ENTER
(
"Item_in_subselect::single_value_transformer"
);
for
(
SELECT_LEX
*
sl
=
select_lex
;
sl
;
sl
=
sl
->
next_select
())
for
(
SELECT_LEX
*
sl
=
select_lex
;
sl
;
sl
=
sl
->
next_select
())
{
Item
*
item
;
if
(
sl
->
item_list
.
elements
>
1
)
{
my_message
(
ER_SUBSELECT_NO_1_COL
,
ER
(
ER_SUBSELECT_NO_1_COL
),
MYF
(
0
));
item
=
0
;
// Item_asterisk_remover m
a
st fail
item
=
0
;
// Item_asterisk_remover m
u
st fail
}
else
item
=
(
Item
*
)
sl
->
item_list
.
pop
();
...
...
@@ -408,7 +408,7 @@ void subselect_union_engine::fix_length_and_dec()
{
uint32
mlen
=
0
,
len
;
Item
*
sel_item
=
0
;
for
(
SELECT_LEX
*
sl
=
unit
->
first_select
();
sl
;
sl
=
sl
->
next_select
())
for
(
SELECT_LEX
*
sl
=
unit
->
first_select
();
sl
;
sl
=
sl
->
next_select
())
{
List_iterator_fast
<
Item
>
li
(
sl
->
item_list
);
Item
*
s_item
=
li
++
;
...
...
sql/mysql_priv.h
View file @
f8ff8fc6
...
...
@@ -578,6 +578,8 @@ bool close_thread_table(THD *thd, TABLE **table_ptr);
void
close_thread_tables
(
THD
*
thd
,
bool
locked
=
0
);
bool
close_thread_table
(
THD
*
thd
,
TABLE
**
table_ptr
);
void
close_temporary_tables
(
THD
*
thd
);
TABLE_LIST
*
find_table_in_list
(
TABLE_LIST
*
table
,
const
char
*
db_name
,
const
char
*
table_name
);
TABLE
**
find_temporary_table
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
bool
close_temporary_table
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
void
close_temporary
(
TABLE
*
table
,
bool
delete_table
=
1
);
...
...
sql/sql_base.cc
View file @
f8ff8fc6
...
...
@@ -743,6 +743,29 @@ void close_temporary_tables(THD *thd)
thd
->
temporary_tables
=
0
;
}
/*
Find first suitable table in given list.
SYNOPSIS
find_table_in_list()
table - pointer to table list
db_name - data base name or 0 for any
table_name - table name or 0 for any
RETURN VALUES
NULL Table not found
# Pointer to found table.
*/
TABLE_LIST
*
find_table_in_list
(
TABLE_LIST
*
table
,
const
char
*
db_name
,
const
char
*
table_name
)
{
for
(;
table
;
table
=
table
->
next
)
if
((
!
db_name
||
!
strcmp
(
table
->
db
,
db_name
))
&&
(
!
table_name
||
!
strcmp
(
table
->
alias
,
table_name
)))
break
;
return
table
;
}
TABLE
**
find_temporary_table
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
)
{
...
...
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