Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
c141d543
Commit
c141d543
authored
Jun 22, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure this work both on PostgreSQL and MySQL
parent
60df8742
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
app/models/ee/project.rb
app/models/ee/project.rb
+1
-1
spec/lib/gitlab/sql/glob_spec.rb
spec/lib/gitlab/sql/glob_spec.rb
+10
-10
No files found.
app/models/ee/project.rb
View file @
c141d543
...
...
@@ -209,7 +209,7 @@ module EE
values
=
{
wildcard:
'*'
,
environment_name:
environment
.
name
,
environment_name:
environment
.
name
}
quoted_values
=
...
...
spec/lib/gitlab/sql/glob_spec.rb
View file @
c141d543
...
...
@@ -32,19 +32,19 @@ describe Gitlab::SQL::Glob, lib: true do
end
def
match
(
string
,
pattern
)
query
(
"SELECT
#{
quote
(
string
)
}
LIKE
#{
pattern
}
AS match"
)
.
first
[
'match'
]
value
=
query
(
"SELECT
#{
quote
(
string
)
}
LIKE
#{
pattern
}
"
)
.
rows
.
flatten
.
first
case
value
when
't'
,
1
true
else
false
end
end
def
query
(
sql
)
result
=
ActiveRecord
::
Base
.
connection
.
exec_query
(
sql
)
result
.
map
do
|
row
|
row
.
each_with_object
({})
do
|
(
column
,
value
),
hash
|
hash
[
column
]
=
result
.
column_types
[
column
].
type_cast_from_database
(
value
)
end
end
ActiveRecord
::
Base
.
connection
.
select_all
(
sql
)
end
def
quote
(
string
)
...
...
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