BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9eefae69
Commit
9eefae69
authored
Nov 18, 2015
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix UNION syntax for MySQL
Apparently MySQL doesn't support this syntax: (...) UNION (...) instead it only supports: ... UNION ...
parent
cc11c44b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
union.rb
lib/gitlab/sql/union.rb
+2
-2
union_spec.rb
spec/lib/gitlab/sql/union_spec.rb
+1
-1
No files found.
lib/gitlab/sql/union.rb
View file @
9eefae69
...
...
@@ -23,11 +23,11 @@ module Gitlab
# (thus fixing this problem), at a slight performance cost.
fragments
=
ActiveRecord
::
Base
.
connection
.
unprepared_statement
do
@relations
.
map
do
|
rel
|
"(
#{
rel
.
reorder
(
nil
).
to_sql
}
)"
rel
.
reorder
(
nil
).
to_sql
end
end
fragments
.
join
(
' UNION '
)
fragments
.
join
(
"
\n
UNION
\n
"
)
end
end
end
...
...
spec/lib/gitlab/sql/union_spec.rb
View file @
9eefae69
...
...
@@ -10,7 +10,7 @@ describe Gitlab::SQL::Union do
sql1
=
rel1
.
reorder
(
nil
).
to_sql
sql2
=
rel2
.
reorder
(
nil
).
to_sql
expect
(
union
.
to_sql
).
to
eq
(
"
(
#{
sql1
}
) UNION (
#{
sql2
}
)
"
)
expect
(
union
.
to_sql
).
to
eq
(
"
#{
sql1
}
\n
UNION
\n
#{
sql2
}
"
)
end
end
end
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