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
d4a3474b
Commit
d4a3474b
authored
Jun 26, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Gitlab::Database.bulk_insert for non-UTF-8 data
parent
676c5594
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
lib/gitlab/database.rb
lib/gitlab/database.rb
+1
-1
spec/lib/gitlab/database_spec.rb
spec/lib/gitlab/database_spec.rb
+4
-0
No files found.
lib/gitlab/database.rb
View file @
d4a3474b
...
@@ -93,7 +93,7 @@ module Gitlab
...
@@ -93,7 +93,7 @@ module Gitlab
row
.
values_at
(
*
keys
).
map
{
|
value
|
connection
.
quote
(
value
)
}
row
.
values_at
(
*
keys
).
map
{
|
value
|
connection
.
quote
(
value
)
}
end
end
connection
.
execute
<<-
EOF
.
strip_heredoc
connection
.
execute
<<-
EOF
INSERT INTO
#{
table
}
(
#{
columns
.
join
(
', '
)
}
)
INSERT INTO
#{
table
}
(
#{
columns
.
join
(
', '
)
}
)
VALUES
#{
tuples
.
map
{
|
tuple
|
"(
#{
tuple
.
join
(
', '
)
}
)"
}
.join(', ')}
VALUES
#{
tuples
.
map
{
|
tuple
|
"(
#{
tuple
.
join
(
', '
)
}
)"
}
.join(', ')}
EOF
EOF
...
...
spec/lib/gitlab/database_spec.rb
View file @
d4a3474b
...
@@ -176,6 +176,10 @@ describe Gitlab::Database, lib: true do
...
@@ -176,6 +176,10 @@ describe Gitlab::Database, lib: true do
described_class
.
bulk_insert
(
'test'
,
rows
)
described_class
.
bulk_insert
(
'test'
,
rows
)
end
end
it
'handles non-UTF-8 data'
do
expect
{
described_class
.
bulk_insert
(
'test'
,
[{
a:
"
\255
"
}])
}.
not_to
raise_error
end
end
end
describe
'.create_connection_pool'
do
describe
'.create_connection_pool'
do
...
...
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