mysql2 0.3.20 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -0
  3. data/README.md +132 -55
  4. data/examples/eventmachine.rb +1 -1
  5. data/examples/threaded.rb +4 -6
  6. data/ext/mysql2/client.c +323 -140
  7. data/ext/mysql2/client.h +13 -3
  8. data/ext/mysql2/extconf.rb +111 -44
  9. data/ext/mysql2/infile.c +2 -2
  10. data/ext/mysql2/mysql2_ext.c +1 -0
  11. data/ext/mysql2/mysql2_ext.h +5 -10
  12. data/ext/mysql2/mysql_enc_name_to_ruby.h +2 -2
  13. data/ext/mysql2/mysql_enc_to_ruby.h +25 -22
  14. data/ext/mysql2/result.c +491 -97
  15. data/ext/mysql2/result.h +12 -4
  16. data/ext/mysql2/statement.c +595 -0
  17. data/ext/mysql2/statement.h +19 -0
  18. data/lib/mysql2/client.rb +82 -27
  19. data/lib/mysql2/console.rb +1 -1
  20. data/lib/mysql2/em.rb +5 -6
  21. data/lib/mysql2/error.rb +17 -26
  22. data/lib/mysql2/field.rb +3 -0
  23. data/lib/mysql2/statement.rb +17 -0
  24. data/lib/mysql2/version.rb +1 -1
  25. data/lib/mysql2.rb +38 -18
  26. data/spec/configuration.yml.example +0 -6
  27. data/spec/em/em_spec.rb +22 -21
  28. data/spec/mysql2/client_spec.rb +498 -380
  29. data/spec/mysql2/error_spec.rb +38 -39
  30. data/spec/mysql2/result_spec.rb +260 -229
  31. data/spec/mysql2/statement_spec.rb +776 -0
  32. data/spec/spec_helper.rb +80 -59
  33. data/spec/ssl/ca-cert.pem +17 -0
  34. data/spec/ssl/ca-key.pem +27 -0
  35. data/spec/ssl/ca.cnf +22 -0
  36. data/spec/ssl/cert.cnf +22 -0
  37. data/spec/ssl/client-cert.pem +17 -0
  38. data/spec/ssl/client-key.pem +27 -0
  39. data/spec/ssl/client-req.pem +15 -0
  40. data/spec/ssl/gen_certs.sh +48 -0
  41. data/spec/ssl/pkcs8-client-key.pem +28 -0
  42. data/spec/ssl/pkcs8-server-key.pem +28 -0
  43. data/spec/ssl/server-cert.pem +17 -0
  44. data/spec/ssl/server-key.pem +27 -0
  45. data/spec/ssl/server-req.pem +15 -0
  46. data/support/5072E1F5.asc +432 -0
  47. data/support/mysql_enc_to_ruby.rb +7 -8
  48. data/support/ruby_enc_to_mysql.rb +1 -1
  49. metadata +50 -55
data/spec/spec_helper.rb CHANGED
@@ -7,81 +7,102 @@ require 'yaml'
7
7
  DatabaseCredentials = YAML.load_file('spec/configuration.yml')
8
8
 
9
9
  RSpec.configure do |config|
10
+ config.disable_monkey_patching!
11
+
10
12
  def with_internal_encoding(encoding)
11
13
  old_enc = Encoding.default_internal
14
+ old_verbose = $VERBOSE
15
+ $VERBOSE = nil
12
16
  Encoding.default_internal = encoding
17
+ $VERBOSE = old_verbose
13
18
 
14
19
  yield
15
20
  ensure
21
+ $VERBOSE = nil
16
22
  Encoding.default_internal = old_enc
23
+ $VERBOSE = old_verbose
24
+ end
25
+
26
+ def new_client(option_overrides = {})
27
+ client = Mysql2::Client.new(DatabaseCredentials['root'].merge(option_overrides))
28
+ @clients ||= []
29
+ @clients << client
30
+ return client unless block_given?
31
+ begin
32
+ yield client
33
+ ensure
34
+ client.close
35
+ @clients.delete(client)
36
+ end
17
37
  end
18
38
 
19
39
  config.before :each do
20
- @client = Mysql2::Client.new DatabaseCredentials['root']
40
+ @client = new_client
21
41
  end
22
42
 
23
43
  config.after :each do
24
- @client.close
44
+ @clients.each(&:close)
25
45
  end
26
46
 
27
47
  config.before(:all) do
28
- client = Mysql2::Client.new DatabaseCredentials['root']
29
- client.query %[
30
- CREATE TABLE IF NOT EXISTS mysql2_test (
31
- id MEDIUMINT NOT NULL AUTO_INCREMENT,
32
- null_test VARCHAR(10),
33
- bit_test BIT(64),
34
- single_bit_test BIT(1),
35
- tiny_int_test TINYINT,
36
- bool_cast_test TINYINT(1),
37
- small_int_test SMALLINT,
38
- medium_int_test MEDIUMINT,
39
- int_test INT,
40
- big_int_test BIGINT,
41
- float_test FLOAT(10,3),
42
- float_zero_test FLOAT(10,3),
43
- double_test DOUBLE(10,3),
44
- decimal_test DECIMAL(10,3),
45
- decimal_zero_test DECIMAL(10,3),
46
- date_test DATE,
47
- date_time_test DATETIME,
48
- timestamp_test TIMESTAMP,
49
- time_test TIME,
50
- year_test YEAR(4),
51
- char_test CHAR(10),
52
- varchar_test VARCHAR(10),
53
- binary_test BINARY(10),
54
- varbinary_test VARBINARY(10),
55
- tiny_blob_test TINYBLOB,
56
- tiny_text_test TINYTEXT,
57
- blob_test BLOB,
58
- text_test TEXT,
59
- medium_blob_test MEDIUMBLOB,
60
- medium_text_test MEDIUMTEXT,
61
- long_blob_test LONGBLOB,
62
- long_text_test LONGTEXT,
63
- enum_test ENUM('val1', 'val2'),
64
- set_test SET('val1', 'val2'),
65
- PRIMARY KEY (id)
66
- )
67
- ]
68
- client.query "DELETE FROM mysql2_test;"
69
- client.query %[
70
- INSERT INTO mysql2_test (
71
- null_test, bit_test, single_bit_test, tiny_int_test, bool_cast_test, small_int_test, medium_int_test, int_test, big_int_test,
72
- float_test, float_zero_test, double_test, decimal_test, decimal_zero_test, date_test, date_time_test, timestamp_test, time_test,
73
- year_test, char_test, varchar_test, binary_test, varbinary_test, tiny_blob_test,
74
- tiny_text_test, blob_test, text_test, medium_blob_test, medium_text_test,
75
- long_blob_test, long_text_test, enum_test, set_test
76
- )
48
+ new_client do |client|
49
+ client.query %[
50
+ CREATE TABLE IF NOT EXISTS mysql2_test (
51
+ id MEDIUMINT NOT NULL AUTO_INCREMENT,
52
+ null_test VARCHAR(10),
53
+ bit_test BIT(64),
54
+ single_bit_test BIT(1),
55
+ tiny_int_test TINYINT,
56
+ bool_cast_test TINYINT(1),
57
+ small_int_test SMALLINT,
58
+ medium_int_test MEDIUMINT,
59
+ int_test INT,
60
+ big_int_test BIGINT,
61
+ float_test FLOAT(10,3),
62
+ float_zero_test FLOAT(10,3),
63
+ double_test DOUBLE(10,3),
64
+ decimal_test DECIMAL(10,3),
65
+ decimal_zero_test DECIMAL(10,3),
66
+ date_test DATE,
67
+ date_time_test DATETIME,
68
+ timestamp_test TIMESTAMP,
69
+ time_test TIME,
70
+ year_test YEAR(4),
71
+ char_test CHAR(10),
72
+ varchar_test VARCHAR(10),
73
+ binary_test BINARY(10),
74
+ varbinary_test VARBINARY(10),
75
+ tiny_blob_test TINYBLOB,
76
+ tiny_text_test TINYTEXT,
77
+ blob_test BLOB,
78
+ text_test TEXT,
79
+ medium_blob_test MEDIUMBLOB,
80
+ medium_text_test MEDIUMTEXT,
81
+ long_blob_test LONGBLOB,
82
+ long_text_test LONGTEXT,
83
+ enum_test ENUM('val1', 'val2'),
84
+ set_test SET('val1', 'val2'),
85
+ PRIMARY KEY (id)
86
+ )
87
+ ]
88
+ client.query "DELETE FROM mysql2_test;"
89
+ client.query %[
90
+ INSERT INTO mysql2_test (
91
+ null_test, bit_test, single_bit_test, tiny_int_test, bool_cast_test, small_int_test, medium_int_test, int_test, big_int_test,
92
+ float_test, float_zero_test, double_test, decimal_test, decimal_zero_test, date_test, date_time_test, timestamp_test, time_test,
93
+ year_test, char_test, varchar_test, binary_test, varbinary_test, tiny_blob_test,
94
+ tiny_text_test, blob_test, text_test, medium_blob_test, medium_text_test,
95
+ long_blob_test, long_text_test, enum_test, set_test
96
+ )
77
97
 
78
- VALUES (
79
- NULL, b'101', b'1', 1, 1, 10, 10, 10, 10,
80
- 10.3, 0, 10.3, 10.3, 0, '2010-4-4', '2010-4-4 11:44:00', '2010-4-4 11:44:00', '11:44:00',
81
- 2009, "test", "test", "test", "test", "test",
82
- "test", "test", "test", "test", "test",
83
- "test", "test", 'val1', 'val1,val2'
84
- )
85
- ]
98
+ VALUES (
99
+ NULL, b'101', b'1', 1, 1, 10, 10, 10, 10,
100
+ 10.3, 0, 10.3, 10.3, 0, '2010-4-4', '2010-4-4 11:44:00', '2010-4-4 11:44:00', '11:44:00',
101
+ 2009, "test", "test", "test", "test", "test",
102
+ "test", "test", "test", "test", "test",
103
+ "test", "test", 'val1', 'val1,val2'
104
+ )
105
+ ]
106
+ end
86
107
  end
87
108
  end
@@ -0,0 +1,17 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIICqjCCAZICCQDbDS+Z2mpWkDANBgkqhkiG9w0BAQsFADAXMRUwEwYDVQQDDAxj
3
+ YV9teXNxbDJnZW0wHhcNMTUwOTA5MDQ1NzIxWhcNMjUwNzE4MDQ1NzIxWjAXMRUw
4
+ EwYDVQQDDAxjYV9teXNxbDJnZW0wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
5
+ AoIBAQDFnpc22lPFtdPELsIffsDt8cD2Hkt47nGMcKQ9n4U98yAg+fodipyP1Bn0
6
+ 2OeaONqpttJIET7HxlGrtugPtV/O8XZHlhfAHrRUDMFZJhgnnqK+c/7fRGeB0Eqw
7
+ ljBlRD/dDL3bFq5hVBC9QsGi5k03r+xLPKm5ccAr4WtofcoKXqEbSO6koTSrsGG5
8
+ 7inlldM2AVzrY2kXbe0jAyNvYmDL2ycN8G2wObogPWDfITQRhOxfkzKIQiEhQF2Y
9
+ /DlhT7IbIarBIm6abf6JxZ6/Sm5XyVNEWOnryXM6rKyVeGktCxLHNmxx5eKYs440
10
+ 8hNgURa8pB+aZaiokkwhM1+jmE83AgMBAAEwDQYJKoZIhvcNAQELBQADggEBACrQ
11
+ umqygXkkbff5Jqf6AYi30U3c+byX+IButRKXN9Ete2LPcT76o/snS9Lexf3KQsIy
12
+ a2Tcc9adak7pBf7FgHdiZkWiQp3MDgx2gJu6Uu6TNzfT8jy2JrHyBWw4ydEvhyA8
13
+ cgelTHSaudafKeQgU4KYc8bqafYFILkWxPzgtwitENIDfx/SHt65BWaQZjYJlFou
14
+ zPZXeoT3lAwKGYqIvwPvBTC23cXg/Swt/mcKe3/Xxjx85Dw/9vi6a9+VQwlOojgd
15
+ w2o07xkIcJcI0Oxyp3mD0U5wAmBQGI76Yi9ZDROHF65KEXfQ3tYKl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 efYrdjTKI5eK9aiVJyoh57BEPOsTsave2U+R8Q+fErQ0QD0UmbWgwYGgkPuDrFYT
17
+ owg09EEz88KONv18VZ+mB1qfyQUoOL6rWIGxXC08upy2i9100PaBFiYlkLNoK7yJ
18
+ bze0rFSiFclJJXZGzEaVvcEdKnXxfhttaJwQGK6VAoGBAOQEUvJzuwWU5/CqCdvA
19
+ JCa84eEv00RxtZwAeDM6oIBO4+/O6cyoL3nmCTTu20YebjjPUHF4IxuOoREFz2lC
20
+ XIY8ljbLpzG5N0BOu5Q0SkzdnTzdoZGXtm55se+MX2nsu7qERXsqIpl0rIVLUo53
21
+ kZwCABPNSGuCeKwUYNDukAg1AoGBALiHHSqEVKhIOn4FDgqM0uM49CA9t6NPyqI9
22
+ sq6r2GWcgpNPXDLPL3e0KGlK3gBkTLApbULsXt1HVpZT9HlJ+nD/0/UieHS6BUgh
23
+ Txxkrgbe/GQ6vZBuEYJQFBxiQHlm9Fcu/zsOOMvn94W4edD5bkCYmfChtxHAYcKF
24
+ 2cWlnJbNAoGAWMV4GIY2DYlztXdyMVuPwsjPcSPMmL8Nc2ATWYRfcoG0Zl0yvwPh
25
+ 2VOu7Q/7bNF2LOe6lPe1hoeB6rT44IYZaWMo3ikY8xW9RztOLSv8E9uE1K9yq8OA
26
+ P8QzXmr1Lga+hoEmMHc2biEJNeF6iAcAFfrHj9Sr7w5PC8g4A3PlCvU=
27
+ -----END RSA PRIVATE KEY-----
data/spec/ssl/ca.cnf ADDED
@@ -0,0 +1,22 @@
1
+
2
+ [ ca ]
3
+ # January 1, 2015
4
+ default_startdate = 2015010360000Z
5
+
6
+ [ req ]
7
+ distinguished_name = req_distinguished_name
8
+
9
+ [ req_distinguished_name ]
10
+ # If this isn't set, the error is error, no objects specified in config file
11
+ commonName = Common Name (hostname, IP, or your name)
12
+
13
+ countryName_default = US
14
+ stateOrProvinceName_default = CA
15
+ localityName_default = San Francisco
16
+ 0.organizationName_default = mysql2_gem
17
+ organizationalUnitName_default = Mysql2Gem
18
+ emailAddress_default = mysql2gem@example.com
19
+
20
+
21
+ commonName_default = ca_mysql2gem
22
+
data/spec/ssl/cert.cnf ADDED
@@ -0,0 +1,22 @@
1
+
2
+ [ ca ]
3
+ # January 1, 2015
4
+ default_startdate = 2015010360000Z
5
+
6
+ [ req ]
7
+ distinguished_name = req_distinguished_name
8
+
9
+ [ req_distinguished_name ]
10
+ # If this isn't set, the error is error, no objects specified in config file
11
+ commonName = Common Name (hostname, IP, or your name)
12
+
13
+ countryName_default = US
14
+ stateOrProvinceName_default = CA
15
+ localityName_default = San Francisco
16
+ 0.organizationName_default = mysql2_gem
17
+ organizationalUnitName_default = Mysql2Gem
18
+ emailAddress_default = mysql2gem@example.com
19
+
20
+
21
+ commonName_default = mysql2gem.example.com
22
+
@@ -0,0 +1,17 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIICqzCCAZMCAQEwDQYJKoZIhvcNAQELBQAwFzEVMBMGA1UEAwwMY2FfbXlzcWwy
3
+ Z2VtMB4XDTE1MDkwOTA0NTcyMVoXDTI1MDcxODA0NTcyMVowIDEeMBwGA1UEAwwV
4
+ bXlzcWwyZ2VtLmV4YW1wbGUuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
5
+ CgKCAQEA1ZuBf1FVJqil7/LvnXqPd43ujo0xqbFy7QrqmM5U/UM3ggMCf2Gr2/Wo
6
+ ZJGPTk1NFaiUyM5mhSlgi0/SGPEp9JMUuH+Uiv9UwmOFl9Em3FXQQ8SG7fV7651u
7
+ AUskNgfEqoy+f+uvi1P155rHNDx7Yw6i+wwfpLGTU0boMnLL6cO/KcIbZlx4/2Lq
8
+ r5sYbpIqhz46bbG+fIhvepruH9h7WVWqAibTqymYrA3T03O/HWTOqfq03gM7Oe3t
9
+ JvJbqX2LecQvi2SbQoX8c2MrQ6X7xDe2Ajh7Yx9DQ1gqClTglbPFHNiWPcGACg+W
10
+ 2ptCY/Q2SdP5h1dtj5Sw5VwL3dvCjQIDA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
3
+ set -eux
4
+
5
+ echo "
6
+ [ ca ]
7
+ # January 1, 2015
8
+ default_startdate = 2015010360000Z
9
+
10
+ [ req ]
11
+ distinguished_name = req_distinguished_name
12
+
13
+ [ req_distinguished_name ]
14
+ # If this isn't set, the error is "error, no objects specified in config file"
15
+ commonName = Common Name (hostname, IP, or your name)
16
+
17
+ countryName_default = US
18
+ stateOrProvinceName_default = CA
19
+ localityName_default = San Francisco
20
+ 0.organizationName_default = mysql2_gem
21
+ organizationalUnitName_default = Mysql2Gem
22
+ emailAddress_default = mysql2gem@example.com
23
+ " | tee ca.cnf cert.cnf
24
+
25
+ # The client and server certs must have a diferent common name than the CA
26
+ # to avoid "SSL connection error: error:00000001:lib(0):func(0):reason(1)"
27
+
28
+ echo "
29
+ commonName_default = ca_mysql2gem
30
+ " >> ca.cnf
31
+
32
+ echo "
33
+ commonName_default = mysql2gem.example.com
34
+ " >> cert.cnf
35
+
36
+ # Generate a set of certificates
37
+ openssl genrsa -out ca-key.pem 2048
38
+ openssl req -new -x509 -nodes -days 3600 -key ca-key.pem -out ca-cert.pem -batch -config ca.cnf
39
+ openssl req -newkey rsa:2048 -days 3600 -nodes -keyout pkcs8-server-key.pem -out server-req.pem -batch -config cert.cnf
40
+ openssl x509 -req -in server-req.pem -days 3600 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out server-cert.pem
41
+ openssl req -newkey rsa:2048 -days 3600 -nodes -keyout pkcs8-client-key.pem -out client-req.pem -batch -config cert.cnf
42
+ openssl x509 -req -in client-req.pem -days 3600 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out client-cert.pem
43
+
44
+ # Convert format from PKCS#8 to PKCS#1
45
+ openssl rsa -in pkcs8-server-key.pem -out server-key.pem
46
+ openssl rsa -in pkcs8-client-key.pem -out client-key.pem
47
+
48
+ echo "done"
@@ -0,0 +1,28 @@
1
+ -----BEGIN PRIVATE KEY-----
2
+ MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSj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