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
b1beb314
Commit
b1beb314
authored
Dec 07, 2002
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Row item fixing (SCRUM related)
Inserted comment
parent
ed8cc2a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
6 deletions
+39
-6
sql/item_row.cc
sql/item_row.cc
+20
-3
sql/item_row.h
sql/item_row.h
+9
-3
sql/sql_select.cc
sql/sql_select.cc
+10
-0
No files found.
sql/item_row.cc
View file @
b1beb314
...
@@ -18,8 +18,10 @@
...
@@ -18,8 +18,10 @@
#include "assert.h"
#include "assert.h"
Item_row
::
Item_row
(
List
<
Item
>
&
arg
)
:
Item_row
::
Item_row
(
List
<
Item
>
&
arg
)
:
Item
(),
array_holder
(
1
)
Item
(),
array_holder
(
1
)
,
used_tables_cache
(
0
),
const_item_cache
(
1
)
{
{
//TODO: think placing 2-3 component items in item (as it done for function)
if
((
arg_count
=
arg
.
elements
))
if
((
arg_count
=
arg
.
elements
))
items
=
(
Item
**
)
sql_alloc
(
sizeof
(
Item
*
)
*
arg_count
);
items
=
(
Item
**
)
sql_alloc
(
sizeof
(
Item
*
)
*
arg_count
);
else
else
...
@@ -45,16 +47,31 @@ void Item_row::illegal_method_call(const char *method)
...
@@ -45,16 +47,31 @@ void Item_row::illegal_method_call(const char *method)
bool
Item_row
::
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tabl
,
Item
**
ref
)
bool
Item_row
::
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tabl
,
Item
**
ref
)
{
{
tables
=
0
;
null_value
=
0
;
maybe_null
=
0
;
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
{
{
if
(
items
[
i
]
->
fix_fields
(
thd
,
tabl
,
items
+
i
))
if
(
items
[
i
]
->
fix_fields
(
thd
,
tabl
,
items
+
i
))
return
1
;
return
1
;
tables
|=
items
[
i
]
->
used_tables
();
used_tables_cache
|=
items
[
i
]
->
used_tables
();
const_item_cache
&=
items
[
i
]
->
const_item
();
maybe_null
|=
items
[
i
]
->
maybe_null
;
}
}
return
0
;
return
0
;
}
}
void
Item_row
::
update_used_tables
()
{
used_tables_cache
=
0
;
const_item_cache
=
1
;
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
{
items
[
i
]
->
update_used_tables
();
used_tables_cache
|=
items
[
i
]
->
used_tables
();
const_item_cache
&=
items
[
i
]
->
const_item
();
}
}
bool
Item_row
::
check_cols
(
uint
c
)
bool
Item_row
::
check_cols
(
uint
c
)
{
{
if
(
c
!=
arg_count
)
if
(
c
!=
arg_count
)
...
...
sql/item_row.h
View file @
b1beb314
...
@@ -17,13 +17,17 @@
...
@@ -17,13 +17,17 @@
class
Item_row
:
public
Item
class
Item_row
:
public
Item
{
{
bool
array_holder
;
bool
array_holder
;
table_map
tables
;
table_map
used_tables_cache
;
bool
const_item_cache
;
uint
arg_count
;
uint
arg_count
;
Item
**
items
;
Item
**
items
;
public:
public:
Item_row
(
List
<
Item
>
&
);
Item_row
(
List
<
Item
>
&
);
Item_row
(
Item_row
*
item
)
:
Item_row
(
Item_row
*
item
)
:
Item
(),
array_holder
(
0
),
tables
(
item
->
tables
),
arg_count
(
item
->
arg_count
),
Item
(),
array_holder
(
0
),
used_tables_cache
(
item
->
used_tables_cache
),
const_item_cache
(
item
->
const_item_cache
),
arg_count
(
item
->
arg_count
),
items
(
item
->
items
)
items
(
item
->
items
)
{}
{}
...
@@ -56,8 +60,10 @@ public:
...
@@ -56,8 +60,10 @@ public:
return
0
;
return
0
;
};
};
bool
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
**
ref
);
bool
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
**
ref
);
table_map
used_tables
()
const
{
return
tables
;
};
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
;
}
enum
Item_result
result_type
()
const
{
return
ROW_RESULT
;
}
void
update_used_tables
();
virtual
uint
cols
()
{
return
arg_count
;
}
virtual
uint
cols
()
{
return
arg_count
;
}
virtual
Item
*
el
(
uint
i
)
{
return
items
[
i
];
}
virtual
Item
*
el
(
uint
i
)
{
return
items
[
i
];
}
...
...
sql/sql_select.cc
View file @
b1beb314
...
@@ -763,6 +763,16 @@ JOIN::exec()
...
@@ -763,6 +763,16 @@ JOIN::exec()
select_options
,
unit
)))
select_options
,
unit
)))
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
/*
We don't have to store rows in temp table that doesn't match HAVING if:
- we are sorting the table and writing complete group rows to the
temp table.
- We are using DISTINCT without resolving the distinct as a GROUP BY
on all columns.
If having is not handled here, it will be checked before the row
is sent to the client.
*/
if
(
having_list
&&
if
(
having_list
&&
(
sort_and_group
||
(
exec_tmp_table
->
distinct
&&
!
group_list
)))
(
sort_and_group
||
(
exec_tmp_table
->
distinct
&&
!
group_list
)))
having
=
having_list
;
having
=
having_list
;
...
...
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