Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
f5b60b13
Commit
f5b60b13
authored
Jul 12, 2004
by
bugreport%peshkin.net
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 245158: Combine multiple redundant LEFT JOINs into a single LEFT JOIN in Search.pm
r=zach,justdave a=justdave
parent
70d3f400
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
Search.pm
Bugzilla/Search.pm
+16
-4
No files found.
Bugzilla/Search.pm
View file @
f5b60b13
...
...
@@ -980,6 +980,8 @@ sub init {
# @supptables = Tables and/or table aliases used in query
# %suppseen = A hash used to store all the tables in supptables to weed
# out duplicates.
# @supplist = A list used to accumulate all the JOIN clauses for each
# chart to merge the ON sections of each.
# $suppstring = String which is pasted into query containing all table names
# get a list of field names to verify the user-submitted chart fields against
...
...
@@ -1061,15 +1063,25 @@ sub init {
}
my
%
suppseen
=
(
"bugs"
=>
1
);
my
$suppstring
=
"bugs"
;
my
@supplist
=
(
" "
);
foreach
my
$str
(
@supptables
)
{
if
(
!
$suppseen
{
$str
})
{
if
(
$str
!~
/^(LEFT|INNER) JOIN/i
)
{
$suppstring
.=
","
;
if
(
$str
=~
/^(LEFT|INNER) JOIN/i
)
{
$str
=~
/^(.*?)\s+ON\s+(.*)$/i
;
my
(
$leftside
,
$rightside
)
=
(
$1
,
$2
);
if
(
$suppseen
{
$leftside
})
{
$supplist
[
$suppseen
{
$leftside
}]
.=
" AND ($rightside)"
;
}
else
{
$suppseen
{
$leftside
}
=
scalar
@supplist
;
push
@supplist
,
" $leftside ON ($rightside)"
;
}
}
else
{
$suppstring
.=
", $str"
;
$suppseen
{
$str
}
=
1
;
}
$suppstring
.=
" $str"
;
$suppseen
{
$str
}
=
1
;
}
}
$suppstring
.=
join
(
''
,
@supplist
);
# Make sure we create a legal SQL query.
@andlist
=
(
"1 = 1"
)
if
!
@andlist
;
...
...
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