Skip to content

Commit 735d082

Browse files
committed
Merge branch 'master' into force_latin1_to_utf8
* master: (56 commits) Remove leftover ifdef HAVE_RB_BIG_CMP Minor whitespace/variable rewording Prefix the methods in client.c with rb_mysql_ Prefix the methods in statement.c with rb_mysql_ Remove more 1.8.7, REE compatibility shims (brianmario#908) Style/SignalException Style/PercentLiteralDelimiters Style/NumericPredicate Style/MutableConstant Style/IfInsideElse Style/HashSyntax Style/GuardClause Style/Encoding Style/BlockDelimiters Style/Alias Performance/TimesMap Performance/RedundantMerge Performance/HashEachMethods Naming/HeredocDelimiterCase Lint/UnifiedInteger ...
2 parents 1a903eb + 245c3d1 commit 735d082

51 files changed

Lines changed: 1158 additions & 817 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.rubocop.yml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
11
inherit_from: .rubocop_todo.yml
22

33
AllCops:
4+
TargetRubyVersion: 1.9
5+
46
DisplayCopNames: true
57
Exclude:
68
- 'pkg/**/*'
79
- 'tmp/**/*'
810
- 'vendor/**/*'
911

12+
Layout/CaseIndentation:
13+
EnforcedStyle: end
14+
15+
Layout/IndentHash:
16+
EnforcedStyle: consistent
17+
18+
Layout/IndentHeredoc:
19+
EnforcedStyle: powerpack
20+
1021
Lint/EndAlignment:
11-
AlignWith: variable
22+
EnforcedStyleAlignWith: variable
1223

13-
Style/CaseIndentation:
14-
IndentWhenRelativeTo: end
24+
Style/Encoding:
25+
AutoCorrectEncodingComment: '# encoding: UTF-8'
26+
EnforcedStyle: always
1527

16-
Style/IndentHash:
17-
EnforcedStyle: consistent
28+
Style/TrailingCommaInArguments:
29+
EnforcedStyleForMultiline: consistent_comma
1830

19-
Style/TrailingComma:
31+
Style/TrailingCommaInLiteral:
2032
EnforcedStyleForMultiline: consistent_comma
2133

2234
Style/TrivialAccessors:
2335
AllowPredicates: true
24-
25-
# TODO: remove when we end support for < 1.9.3
26-
27-
Style/HashSyntax:
28-
EnforcedStyle: hash_rockets
29-
30-
Style/Lambda:
31-
Enabled: false

.rubocop_todo.yml

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,86 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2015-09-06 13:16:09 -0400 using RuboCop version 0.34.0.
3+
# on 2017-11-25 19:54:28 -0500 using RuboCop version 0.50.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

99
# Offense count: 2
1010
Metrics/AbcSize:
11-
Max: 85
11+
Max: 90
12+
13+
# Offense count: 31
14+
# Configuration parameters: CountComments, ExcludedMethods.
15+
Metrics/BlockLength:
16+
Max: 825
1217

1318
# Offense count: 1
19+
# Configuration parameters: CountBlocks.
1420
Metrics/BlockNesting:
1521
Max: 5
1622

1723
# Offense count: 1
24+
# Configuration parameters: CountComments.
1825
Metrics/ClassLength:
1926
Max: 125
2027

21-
# Offense count: 2
28+
# Offense count: 3
2229
Metrics/CyclomaticComplexity:
2330
Max: 30
2431

25-
# Offense count: 290
26-
# Configuration parameters: AllowURI, URISchemes.
32+
# Offense count: 313
33+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
34+
# URISchemes: http, https
2735
Metrics/LineLength:
2836
Max: 232
2937

30-
# Offense count: 5
38+
# Offense count: 6
3139
# Configuration parameters: CountComments.
3240
Metrics/MethodLength:
33-
Max: 60
41+
Max: 57
3442

35-
# Offense count: 1
43+
# Offense count: 2
3644
Metrics/PerceivedComplexity:
37-
Max: 26
45+
Max: 27
3846

39-
# Offense count: 40
40-
# Cop supports --auto-correct.
41-
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
42-
Style/BlockDelimiters:
43-
Enabled: false
47+
# Offense count: 3
48+
# Configuration parameters: Blacklist.
49+
# Blacklist: END, (?-mix:EO[A-Z]{1})
50+
Naming/HeredocDelimiterNaming:
51+
Exclude:
52+
- 'tasks/compile.rake'
4453

45-
# Offense count: 12
54+
# Offense count: 10
4655
Style/Documentation:
4756
Exclude:
57+
- 'spec/**/*'
58+
- 'test/**/*'
4859
- 'benchmark/active_record.rb'
4960
- 'benchmark/allocations.rb'
5061
- 'benchmark/query_with_mysql_casting.rb'
5162
- 'lib/mysql2.rb'
5263
- 'lib/mysql2/client.rb'
5364
- 'lib/mysql2/em.rb'
5465
- 'lib/mysql2/error.rb'
55-
- 'lib/mysql2/field.rb'
5666
- 'lib/mysql2/result.rb'
5767
- 'lib/mysql2/statement.rb'
58-
- 'lib/mysql2/version.rb'
5968

60-
# Offense count: 9
69+
# Offense count: 14
6170
# Configuration parameters: AllowedVariables.
6271
Style/GlobalVars:
6372
Exclude:
6473
- 'ext/mysql2/extconf.rb'
6574

66-
# Offense count: 14
75+
# Offense count: 17
6776
# Cop supports --auto-correct.
77+
# Configuration parameters: Strict.
6878
Style/NumericLiterals:
6979
MinDigits: 20
7080

71-
# Offense count: 680
81+
# Offense count: 726
7282
# Cop supports --auto-correct.
73-
# Configuration parameters: EnforcedStyle, SupportedStyles.
83+
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
84+
# SupportedStyles: single_quotes, double_quotes
7485
Style/StringLiterals:
7586
Enabled: false

.travis.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,6 @@ rvm:
2727
- ruby-head
2828
matrix:
2929
include:
30-
- rvm: 1.8.7
31-
dist: precise
32-
env: SPEC_OPTS="--order rand:11"
33-
addons:
34-
hosts:
35-
- mysql2gem.example.com
36-
apt:
37-
packages:
38-
- mysql-server-5.5
39-
- mysql-client-core-5.5
40-
- mysql-client-5.5
41-
- rvm: ree
42-
dist: precise
43-
env: SPEC_OPTS="--order rand:11"
44-
addons:
45-
hosts:
46-
- mysql2gem.example.com
47-
apt:
48-
packages:
49-
- mysql-server-5.5
50-
- mysql-client-core-5.5
51-
- mysql-client-5.5
5230
- rvm: 2.4
5331
env: DB=mariadb10.0
5432
addons:

.travis_mysql51.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -eux
55
apt-get purge -qq '^mysql*' '^libmysql*'
66
rm -fr /etc/mysql
77
rm -fr /var/lib/mysql
8-
apt-key adv --keyserver keys.gnupg.net --recv-keys 8507EFA5
8+
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key 9334A25F8507EFA5
99
add-apt-repository 'deb http://repo.percona.com/apt precise main'
1010
apt-get update -qq
1111
apt-get install -qq percona-server-server-5.1 percona-server-client-5.1 libmysqlclient16-dev

.travis_mysql57.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -eux
55
apt-get purge -qq '^mysql*' '^libmysql*'
66
rm -fr /etc/mysql
77
rm -fr /var/lib/mysql
8-
apt-key adv --keyserver pgp.mit.edu --recv-keys 5072E1F5
8+
apt-key add - < support/5072E1F5.asc
99
add-apt-repository 'deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7'
1010
apt-get update -qq
1111
apt-get install -qq mysql-server libmysqlclient-dev

.travis_mysql80.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -eux
55
apt-get purge -qq '^mysql*' '^libmysql*'
66
rm -fr /etc/mysql
77
rm -fr /var/lib/mysql
8-
apt-key adv --keyserver pgp.mit.edu --recv-keys 5072E1F5
8+
apt-key add - < support/5072E1F5.asc
99
add-apt-repository 'deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-8.0'
1010
apt-get update -qq
1111
apt-get install -qq mysql-server libmysqlclient-dev

.travis_setup.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ if [[ -n ${DB-} && x$DB =~ ^xmysql80 ]]; then
1717
sudo bash .travis_mysql80.sh
1818
fi
1919

20+
# Install MariaDB client headers after Travis CI fix for MariaDB 10.2 broke earlier 10.x
21+
if [[ -n ${DB-} && x$DB =~ ^xmariadb10.0 ]]; then
22+
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' libmariadbclient-dev
23+
fi
24+
25+
# Install MariaDB client headers after Travis CI fix for MariaDB 10.2 broke earlier 10.x
26+
if [[ -n ${DB-} && x$DB =~ ^xmariadb10.1 ]]; then
27+
sudo apt-get install -y -o Dpkg::Options::='--force-confnew' libmariadbclient-dev
28+
fi
29+
2030
# Install MariaDB 10.2 if DB=mariadb10.2
2131
# NOTE this is a workaround until Travis CI merges a fix to its mariadb addon.
2232
if [[ -n ${DB-} && x$DB =~ ^xmariadb10.2 ]]; then

Gemfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
# encoding: UTF-8
2+
13
source 'https://rubygems.org'
24

35
gemspec
46

57
gem 'rake', '~> 10.4.2'
6-
gem 'rake-compiler', '~> 0.9.5'
8+
gem 'rake-compiler', '~> 1.0'
79

810
group :test do
911
gem 'eventmachine' unless RUBY_PLATFORM =~ /mswin|mingw/
1012
gem 'rspec', '~> 3.2'
11-
gem 'rubocop', '~> 0.34.0' unless RUBY_VERSION =~ /1.8/
13+
# https://github.com/bbatsov/rubocop/pull/3328
14+
# https://github.com/bbatsov/rubocop/pull/4789
15+
gem 'rubocop', '~> 0.50.0' unless RUBY_VERSION =~ /1.9/
1216
end
1317

1418
group :benchmarks do
@@ -22,7 +26,7 @@ end
2226

2327
group :development do
2428
gem 'pry'
25-
gem 'rake-compiler-dock', '~> 0.5.1'
29+
gem 'rake-compiler-dock', '~> 0.6.0'
2630
end
2731

2832
platforms :rbx do

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ Mysql2::Client.new(
213213
:read_timeout = seconds,
214214
:write_timeout = seconds,
215215
:connect_timeout = seconds,
216+
:connect_attrs = {:program_name => $PROGRAM_NAME, ...},
216217
:reconnect = true/false,
217218
:local_infile = true/false,
218219
:secure_auth = true/false,
@@ -519,8 +520,7 @@ As for field values themselves, I'm workin on it - but expect that soon.
519520

520521
This gem is tested with the following Ruby versions on Linux and Mac OS X:
521522

522-
* Ruby MRI 1.8.7, 1.9.3, 2.0.0, 2.1.x, 2.2.x, 2.3.x, 2.4.x
523-
* Ruby Enterprise Edition (based on MRI 1.8.7)
523+
* Ruby MRI 1.9.3, 2.0.0, 2.1.x, 2.2.x, 2.3.x, 2.4.x
524524
* Rubinius 2.x and 3.x do work but may fail under some workloads
525525

526526
This gem is tested with the following MySQL and MariaDB versions:

Rakefile

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# encoding: UTF-8
2+
23
require 'rake'
34

45
# Load custom tasks (careful attention to define tasks before prerequisites)
@@ -8,18 +9,11 @@ load 'tasks/compile.rake'
89
load 'tasks/generate.rake'
910
load 'tasks/benchmarks.rake'
1011

11-
# TODO: remove engine check when rubinius stops crashing on RuboCop
12-
# TODO: remove defined?(Encoding) when we end support for < 1.9.3
13-
has_rubocop = if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' && defined?(Encoding)
14-
begin
15-
require 'rubocop/rake_task'
16-
RuboCop::RakeTask.new
17-
task :default => [:spec, :rubocop]
18-
rescue LoadError # rubocop:disable Lint/HandleExceptions
19-
end
20-
end
21-
22-
unless has_rubocop
12+
begin
13+
require 'rubocop/rake_task'
14+
RuboCop::RakeTask.new
15+
task default: [:spec, :rubocop]
16+
rescue LoadError
2317
warn 'RuboCop is not available'
24-
task :default => :spec
18+
task default: :spec
2519
end

0 commit comments

Comments
 (0)