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
22f2f674
Commit
22f2f674
authored
Feb 21, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@work.mysql.com:/home/bk/mysql-4.0
into sinisa.nasamreza.org:/mnt/hdc/Sinisa/mysql-4.0
parents
c9c61df6
c0b5bf5e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
174 additions
and
131 deletions
+174
-131
sql/sql_select.cc
sql/sql_select.cc
+168
-131
sql/sql_union.cc
sql/sql_union.cc
+6
-0
No files found.
sql/sql_select.cc
View file @
22f2f674
...
...
@@ -144,7 +144,7 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab);
static
void
init_sum_functions
(
Item_sum
**
func
);
static
bool
update_sum_func
(
Item_sum
**
func
);
static
void
select_describe
(
JOIN
*
join
,
bool
need_tmp_table
,
bool
need_order
,
bool
distinct
);
bool
distinct
,
const
char
*
message
=
NullS
);
static
void
describe_info
(
THD
*
thd
,
const
char
*
info
);
/*
...
...
@@ -195,6 +195,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
Procedure
*
procedure
;
List
<
Item
>
all_fields
(
fields
);
bool
select_distinct
;
SELECT_LEX
*
select_lex
=
&
(
thd
->
lex
.
select_lex
);
DBUG_ENTER
(
"mysql_select"
);
/* Check that all tables, fields, conds and order are ok */
...
...
@@ -350,6 +351,9 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
}
if
(
cond_value
==
Item
::
COND_FALSE
||
!
thd
->
select_limit
)
{
/* Impossible cond */
if
(
select_options
&
SELECT_DESCRIBE
&&
select_lex
->
next
)
select_describe
(
&
join
,
false
,
false
,
false
,
"Impossible WHERE"
);
else
error
=
return_zero_rows
(
result
,
tables
,
fields
,
join
.
tmp_table_param
.
sum_func_count
!=
0
&&
!
group
,
select_options
,
"Impossible WHERE"
,
having
,
...
...
@@ -366,6 +370,9 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
{
if
(
res
<
0
)
{
if
(
select_options
&
SELECT_DESCRIBE
&&
select_lex
->
next
)
select_describe
(
&
join
,
false
,
false
,
false
,
"No matching min/max row"
);
else
error
=
return_zero_rows
(
result
,
tables
,
fields
,
!
group
,
select_options
,
"No matching min/max row"
,
having
,
procedure
);
...
...
@@ -374,9 +381,12 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
}
if
(
select_options
&
SELECT_DESCRIBE
)
{
if
(
select_lex
->
next
)
select_describe
(
&
join
,
false
,
false
,
false
,
"Select tables optimized away"
);
else
describe_info
(
thd
,
"Select tables optimized away"
);
delete
procedure
;
DBUG_RETURN
(
0
);
DBUG_RETURN
(
error
);
}
tables
=
0
;
// All tables resolved
}
...
...
@@ -385,7 +395,12 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
{
// Only test of functions
error
=
0
;
if
(
select_options
&
SELECT_DESCRIBE
)
{
if
(
select_lex
->
next
)
select_describe
(
&
join
,
false
,
false
,
false
,
"No tables used"
);
else
describe_info
(
thd
,
"No tables used"
);
}
else
{
result
->
send_fields
(
fields
,
1
);
...
...
@@ -463,6 +478,9 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
}
if
(
make_join_select
(
&
join
,
select
,
conds
))
{
if
(
select_options
&
SELECT_DESCRIBE
&&
select_lex
->
next
)
select_describe
(
&
join
,
false
,
false
,
false
,
"Impossible WHERE noticed after reading const tables"
);
else
error
=
return_zero_rows
(
result
,
tables
,
fields
,
join
.
tmp_table_param
.
sum_func_count
!=
0
&&
!
group
,
select_options
,
...
...
@@ -535,7 +553,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
make_join_readinfo
(
&
join
,
(
select_options
&
(
SELECT_DESCRIBE
|
SELECT_NO_JOIN_CACHE
))
|
(
thd
->
lex
.
select_lex
.
ftfunc_list
.
elements
?
SELECT_NO_JOIN_CACHE
:
0
));
(
select_lex
->
ftfunc_list
.
elements
?
SELECT_NO_JOIN_CACHE
:
0
));
/* Need to tell Innobase that to play it safe, it should fetch all
columns of the tables: this is because MySQL
...
...
@@ -2516,6 +2534,7 @@ static void
make_join_readinfo
(
JOIN
*
join
,
uint
options
)
{
uint
i
;
SELECT_LEX
*
select_lex
=
&
(
join
->
thd
->
lex
.
select_lex
);
DBUG_ENTER
(
"make_join_readinfo"
);
for
(
i
=
join
->
const_tables
;
i
<
join
->
tables
;
i
++
)
...
...
@@ -2598,7 +2617,7 @@ make_join_readinfo(JOIN *join,uint options)
/* These init changes read_record */
if
(
tab
->
use_quick
==
2
)
{
join
->
thd
->
lex
.
select_lex
.
options
|=
QUERY_NO_GOOD_INDEX_USED
;
select_lex
->
options
|=
QUERY_NO_GOOD_INDEX_USED
;
tab
->
read_first_record
=
join_init_quick_read_record
;
statistic_increment
(
select_range_check_count
,
&
LOCK_status
);
}
...
...
@@ -2613,7 +2632,7 @@ make_join_readinfo(JOIN *join,uint options)
}
else
{
join
->
thd
->
lex
.
select_lex
.
options
|=
QUERY_NO_INDEX_USED
;
select_lex
->
options
|=
QUERY_NO_INDEX_USED
;
statistic_increment
(
select_scan_count
,
&
LOCK_status
);
}
}
...
...
@@ -2625,7 +2644,7 @@ make_join_readinfo(JOIN *join,uint options)
}
else
{
join
->
thd
->
lex
.
select_lex
.
options
|=
QUERY_NO_INDEX_USED
;
select_lex
->
options
|=
QUERY_NO_INDEX_USED
;
statistic_increment
(
select_full_join_count
,
&
LOCK_status
);
}
}
...
...
@@ -6940,16 +6959,17 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab)
****************************************************************************/
static
void
select_describe
(
JOIN
*
join
,
bool
need_tmp_table
,
bool
need_order
,
bool
distinct
)
bool
distinct
,
const
char
*
message
)
{
List
<
Item
>
field_list
;
Item
*
item
;
THD
*
thd
=
join
->
thd
;
SELECT_LEX
*
select_lex
=
&
(
join
->
thd
->
lex
.
select_lex
);
DBUG_ENTER
(
"select_describe"
);
/* Don't log this into the slow query log */
join
->
thd
->
lex
.
select_lex
.
options
&=
~
(
QUERY_NO_INDEX_USED
|
QUERY_NO_GOOD_INDEX_USED
);
if
(
join
->
thd
->
lex
.
select
==
&
join
->
thd
->
lex
.
select_lex
)
select_lex
->
options
&=
~
(
QUERY_NO_INDEX_USED
|
QUERY_NO_GOOD_INDEX_USED
);
if
(
join
->
thd
->
lex
.
select
==
select_lex
)
{
field_list
.
push_back
(
new
Item_empty_string
(
"table"
,
NAME_LEN
));
field_list
.
push_back
(
new
Item_empty_string
(
"type"
,
10
));
...
...
@@ -6970,6 +6990,22 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
}
char
buff
[
512
],
*
buff_ptr
;
String
tmp
(
buff
,
sizeof
(
buff
)),
*
packet
=
&
thd
->
packet
;
if
(
message
)
{
packet
->
length
(
0
);
net_store_null
(
packet
);
net_store_null
(
packet
);
net_store_null
(
packet
);
net_store_null
(
packet
);
net_store_null
(
packet
);
net_store_null
(
packet
);
net_store_null
(
packet
);
net_store_data
(
packet
,
message
,
strlen
(
message
));
if
(
my_net_write
(
&
thd
->
net
,(
char
*
)
packet
->
ptr
(),
packet
->
length
()))
DBUG_VOID_RETURN
;
}
else
{
table_map
used_tables
=
0
;
for
(
uint
i
=
0
;
i
<
join
->
tables
;
i
++
)
{
...
...
@@ -7093,11 +7129,12 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
}
net_store_data
(
packet
,
buff
,(
uint
)
(
buff_ptr
-
buff
));
if
(
my_net_write
(
&
thd
->
net
,(
char
*
)
packet
->
ptr
(),
packet
->
length
()))
DBUG_VOID_RETURN
;
/* purecov: i
nspected */
DBUG_VOID_RETURN
;
/* Purecov: I
nspected */
// For next iteration
used_tables
|=
table
->
map
;
}
}
if
(
!
join
->
thd
->
lex
.
select
->
next
)
send_eof
(
&
thd
->
net
);
DBUG_VOID_RETURN
;
...
...
sql/sql_union.cc
View file @
22f2f674
...
...
@@ -76,6 +76,12 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
for
(
sl
=
&
lex
->
select_lex
;
sl
;
sl
=
sl
->
next
)
{
lex
->
select
=
sl
;
thd
->
offset_limit
=
sl
->
offset_limit
;
thd
->
select_limit
=
sl
->
select_limit
+
sl
->
offset_limit
;
if
(
thd
->
select_limit
<
sl
->
select_limit
)
thd
->
select_limit
=
HA_POS_ERROR
;
// no limit
if
(
thd
->
select_limit
==
HA_POS_ERROR
)
sl
->
options
&=
~
OPTION_FOUND_ROWS
;
res
=
mysql_select
(
thd
,
(
TABLE_LIST
*
)
sl
->
table_list
.
first
,
sl
->
item_list
,
sl
->
where
,
...
...
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