ruby-mysql 2.10.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/test_mysql.rb CHANGED
@@ -20,7 +20,7 @@ MYSQL_SOCKET = ENV['MYSQL_SOCKET']
20
20
  class TestMysql < Test::Unit::TestCase
21
21
  sub_test_case 'Mysql::VERSION' do
22
22
  test 'returns client version' do
23
- assert{ Mysql::VERSION == 21000 }
23
+ assert{ Mysql::VERSION == 21100 }
24
24
  end
25
25
  end
26
26
 
@@ -140,8 +140,8 @@ class TestMysql < Test::Unit::TestCase
140
140
  end
141
141
  test 'OPT_CONNECT_TIMEOUT: set timeout for connecting' do
142
142
  assert{ @m.options(Mysql::OPT_CONNECT_TIMEOUT, 0.1) == @m }
143
- stub(UNIXSocket).new{ sleep 1}
144
- stub(TCPSocket).new{ sleep 1}
143
+ stub(Socket).tcp{ raise Errno::ETIMEDOUT }
144
+ stub(Socket).unix{ raise Errno::ETIMEDOUT }
145
145
  assert_raise Mysql::ClientError, 'connection timeout' do
146
146
  @m.connect(MYSQL_SERVER, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, MYSQL_PORT, MYSQL_SOCKET)
147
147
  end
@@ -190,20 +190,33 @@ class TestMysql < Test::Unit::TestCase
190
190
  tmpf.close
191
191
  @m.connect(MYSQL_SERVER, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, MYSQL_PORT, MYSQL_SOCKET)
192
192
  @m.query('create temporary table t (i int, c char(10))')
193
- assert_raise Mysql::ServerError::NotAllowedCommand, 'The used command is not allowed with this MySQL version' do
194
- @m.query("load data local infile '#{tmpf.path}' into table t")
193
+ if @m.server_version >= 80000
194
+ assert_raise Mysql::ServerError, 'Loading local data is disabled; this must be enabled on both the client and server sides' do
195
+ @m.query("load data local infile '#{tmpf.path}' into table t")
196
+ end
197
+ else
198
+ assert_raise Mysql::ServerError::NotAllowedCommand, 'The used command is not allowed with this MySQL version' do
199
+ @m.query("load data local infile '#{tmpf.path}' into table t")
200
+ end
195
201
  end
196
202
  end
197
203
  test 'OPT_READ_TIMEOUT: set timeout for reading packet' do
198
- assert{ @m.options(Mysql::OPT_READ_TIMEOUT, 10) == @m }
204
+ assert{ @m.options(Mysql::OPT_READ_TIMEOUT, 1) == @m }
205
+ @m.connect(MYSQL_SERVER, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, MYSQL_PORT, MYSQL_SOCKET)
206
+ @m.query("select 123").entries
199
207
  end
200
208
  test 'OPT_WRITE_TIMEOUT: set timeout for writing packet' do
201
- assert{ @m.options(Mysql::OPT_WRITE_TIMEOUT, 10) == @m }
209
+ assert{ @m.options(Mysql::OPT_WRITE_TIMEOUT, 1) == @m }
210
+ @m.connect(MYSQL_SERVER, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, MYSQL_PORT, MYSQL_SOCKET)
211
+ @m.query("select 123").entries
202
212
  end
203
213
  test 'SET_CHARSET_NAME: set charset for connection' do
204
- assert{ @m.options(Mysql::SET_CHARSET_NAME, 'utf8') == @m }
214
+ assert{ @m.options(Mysql::SET_CHARSET_NAME, 'utf8mb3') == @m }
205
215
  @m.connect(MYSQL_SERVER, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, MYSQL_PORT, MYSQL_SOCKET)
206
- assert{ @m.query('select @@character_set_connection').fetch_row == ['utf8'] }
216
+ assert do
217
+ @m.query('select @@character_set_connection').fetch_row == ['utf8mb3'] ||
218
+ @m.query('select @@character_set_connection').fetch_row == ['utf8']
219
+ end
207
220
  end
208
221
  end
209
222
 
@@ -1039,12 +1052,6 @@ class TestMysql < Test::Unit::TestCase
1039
1052
  assert{ @s.fetch == [123, 9, 1, 20091208100446] }
1040
1053
  end
1041
1054
 
1042
- test '(Fixnum) make result format to be Integer value' do
1043
- @s.bind_result Fixnum, Fixnum, Fixnum, Fixnum
1044
- @s.execute
1045
- assert{ @s.fetch == [123, 9, 1, 20091208100446] }
1046
- end
1047
-
1048
1055
  test '(String) make result format to be String value' do
1049
1056
  @s.bind_result String, String, String, String
1050
1057
  @s.execute
@@ -1809,13 +1816,19 @@ class TestMysql < Test::Unit::TestCase
1809
1816
  end
1810
1817
 
1811
1818
  teardown do
1819
+ v = $VERBOSE
1820
+ $VERBOSE = false
1812
1821
  Encoding.default_internal = @default_internal
1822
+ $VERBOSE = v
1813
1823
  end
1814
1824
 
1815
1825
  sub_test_case 'default_internal is CP932' do
1816
1826
  setup do
1817
1827
  @m.prepare("insert into t (utf8,cp932,eucjp,bin) values (?,?,?,?)").execute @utf8, @cp932, @eucjp, @bin
1828
+ v = $VERBOSE
1829
+ $VERBOSE = false
1818
1830
  Encoding.default_internal = 'CP932'
1831
+ $VERBOSE = v
1819
1832
  end
1820
1833
  test 'is converted to CP932' do
1821
1834
  assert @m.query('select "あいう"').fetch == ["\x82\xA0\x82\xA2\x82\xA4".force_encoding("CP932")]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-mysql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.0
4
+ version: 2.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomita Masahiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-23 00:00:00.000000000 Z
11
+ date: 2021-10-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This is MySQL connector. pure Ruby version
14
14
  email: tommy@tmtm.org
@@ -19,6 +19,10 @@ extra_rdoc_files:
19
19
  files:
20
20
  - README.rdoc
21
21
  - lib/mysql.rb
22
+ - lib/mysql/authenticator.rb
23
+ - lib/mysql/authenticator/caching_sha2_password.rb
24
+ - lib/mysql/authenticator/mysql_native_password.rb
25
+ - lib/mysql/authenticator/sha256_password.rb
22
26
  - lib/mysql/charset.rb
23
27
  - lib/mysql/constants.rb
24
28
  - lib/mysql/error.rb