mysql2 0.4.10 → 0.5.3
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.
- checksums.yaml +5 -5
- data/README.md +66 -32
- data/ext/mysql2/client.c +125 -59
- data/ext/mysql2/client.h +1 -39
- data/ext/mysql2/extconf.rb +24 -21
- data/ext/mysql2/mysql2_ext.c +2 -1
- data/ext/mysql2/mysql2_ext.h +8 -4
- data/ext/mysql2/mysql_enc_name_to_ruby.h +60 -56
- data/ext/mysql2/mysql_enc_to_ruby.h +64 -3
- data/ext/mysql2/result.c +32 -85
- data/ext/mysql2/result.h +2 -3
- data/ext/mysql2/statement.c +81 -72
- data/ext/mysql2/statement.h +0 -2
- data/ext/mysql2/wait_for_single_fd.h +2 -1
- data/lib/mysql2.rb +17 -15
- data/lib/mysql2/client.rb +33 -27
- data/lib/mysql2/em.rb +2 -4
- data/lib/mysql2/error.rb +51 -22
- data/lib/mysql2/result.rb +2 -0
- data/lib/mysql2/statement.rb +3 -9
- data/lib/mysql2/version.rb +1 -1
- data/support/5072E1F5.asc +5 -5
- data/support/mysql_enc_to_ruby.rb +8 -3
- data/support/ruby_enc_to_mysql.rb +7 -5
- metadata +8 -58
- data/examples/eventmachine.rb +0 -21
- data/examples/threaded.rb +0 -18
- data/spec/configuration.yml.example +0 -11
- data/spec/em/em_spec.rb +0 -136
- data/spec/my.cnf.example +0 -9
- data/spec/mysql2/client_spec.rb +0 -1039
- data/spec/mysql2/error_spec.rb +0 -82
- data/spec/mysql2/result_spec.rb +0 -545
- data/spec/mysql2/statement_spec.rb +0 -776
- data/spec/rcov.opts +0 -3
- data/spec/spec_helper.rb +0 -108
- data/spec/ssl/ca-cert.pem +0 -17
- data/spec/ssl/ca-key.pem +0 -27
- data/spec/ssl/ca.cnf +0 -22
- data/spec/ssl/cert.cnf +0 -22
- data/spec/ssl/client-cert.pem +0 -17
- data/spec/ssl/client-key.pem +0 -27
- data/spec/ssl/client-req.pem +0 -15
- data/spec/ssl/gen_certs.sh +0 -48
- data/spec/ssl/pkcs8-client-key.pem +0 -28
- data/spec/ssl/pkcs8-server-key.pem +0 -28
- data/spec/ssl/server-cert.pem +0 -17
- data/spec/ssl/server-key.pem +0 -27
- data/spec/ssl/server-req.pem +0 -15
- data/spec/test_data +0 -1
data/ext/mysql2/statement.h
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
/*
|
2
|
-
* backwards compatibility for
|
2
|
+
* backwards compatibility for Rubinius. See
|
3
|
+
* https://github.com/rubinius/rubinius/issues/3771.
|
3
4
|
*
|
4
5
|
* Ruby 1.9.3 provides this API which allows the use of ppoll() on Linux
|
5
6
|
* to minimize select() and malloc() overhead on high-numbered FDs.
|
data/lib/mysql2.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
require 'date'
|
3
2
|
require 'bigdecimal'
|
4
|
-
require 'rational' unless RUBY_VERSION >= '1.9.2'
|
5
3
|
|
6
4
|
# Load libmysql.dll before requiring mysql2/mysql2.so
|
7
5
|
# This gives a chance to be flexible about the load path
|
@@ -13,16 +11,23 @@ if RUBY_PLATFORM =~ /mswin|mingw/
|
|
13
11
|
ENV['RUBY_MYSQL2_LIBMYSQL_DLL']
|
14
12
|
elsif File.exist?(File.expand_path('../vendor/libmysql.dll', File.dirname(__FILE__)))
|
15
13
|
# Use vendor/libmysql.dll if it exists, convert slashes for Win32 LoadLibrary
|
16
|
-
File.expand_path('../vendor/libmysql.dll', File.dirname(__FILE__))
|
14
|
+
File.expand_path('../vendor/libmysql.dll', File.dirname(__FILE__))
|
15
|
+
elsif defined?(RubyInstaller)
|
16
|
+
# RubyInstaller-2.4+ native build doesn't need DLL preloading
|
17
17
|
else
|
18
18
|
# This will use default / system library paths
|
19
19
|
'libmysql.dll'
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
if dll_path
|
23
|
+
require 'fiddle'
|
24
|
+
kernel32 = Fiddle.dlopen 'kernel32'
|
25
|
+
load_library = Fiddle::Function.new(
|
26
|
+
kernel32['LoadLibraryW'], [Fiddle::TYPE_VOIDP], Fiddle::TYPE_INT,
|
27
|
+
)
|
28
|
+
if load_library.call(dll_path.encode('utf-16le')).zero?
|
29
|
+
abort "Failed to load libmysql.dll from #{dll_path}"
|
30
|
+
end
|
26
31
|
end
|
27
32
|
end
|
28
33
|
|
@@ -71,14 +76,11 @@ module Mysql2
|
|
71
76
|
# Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8,
|
72
77
|
# but is present in earlier 2.1.x and 2.2.x, so we provide a shim.
|
73
78
|
#
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
else
|
80
|
-
::Timeout::Error
|
81
|
-
end
|
79
|
+
require 'timeout'
|
80
|
+
TIMEOUT_ERROR_CLASS = if defined?(::Timeout::ExitException)
|
81
|
+
::Timeout::ExitException
|
82
|
+
else
|
83
|
+
::Timeout::Error
|
82
84
|
end
|
83
85
|
end
|
84
86
|
end
|
data/lib/mysql2/client.rb
CHANGED
@@ -4,22 +4,22 @@ module Mysql2
|
|
4
4
|
|
5
5
|
def self.default_query_options
|
6
6
|
@default_query_options ||= {
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
7
|
+
as: :hash, # the type of object you want each row back as; also supports :array (an array of values)
|
8
|
+
async: false, # don't wait for a result after sending the query, you'll have to monitor the socket yourself then eventually call Mysql2::Client#async_result
|
9
|
+
cast_booleans: false, # cast tinyint(1) fields as true/false in ruby
|
10
|
+
symbolize_keys: false, # return field names as symbols instead of strings
|
11
|
+
database_timezone: :local, # timezone Mysql2 will assume datetime objects are stored in
|
12
|
+
application_timezone: nil, # timezone Mysql2 will convert to before handing the object back to the caller
|
13
|
+
cache_rows: true, # tells Mysql2 to use its internal row cache for results
|
14
|
+
connect_flags: REMEMBER_OPTIONS | LONG_PASSWORD | LONG_FLAG | TRANSACTIONS | PROTOCOL_41 | SECURE_CONNECTION | CONNECT_ATTRS,
|
15
|
+
cast: true,
|
16
|
+
default_file: nil,
|
17
|
+
default_group: nil,
|
18
18
|
}
|
19
19
|
end
|
20
20
|
|
21
21
|
def initialize(opts = {})
|
22
|
-
|
22
|
+
raise Mysql2::Error, "Options parameter must be a Hash" unless opts.is_a? Hash
|
23
23
|
opts = Mysql2::Util.key_hash_as_symbols(opts)
|
24
24
|
@read_timeout = nil
|
25
25
|
@query_options = self.class.default_query_options.dup
|
@@ -31,7 +31,7 @@ module Mysql2
|
|
31
31
|
opts[:connect_timeout] = 120 unless opts.key?(:connect_timeout)
|
32
32
|
|
33
33
|
# TODO: stricter validation rather than silent massaging
|
34
|
-
[
|
34
|
+
%i[reconnect connect_timeout local_infile read_timeout write_timeout default_file default_group secure_auth init_command automatic_close enable_cleartext_plugin default_auth].each do |key|
|
35
35
|
next unless opts.key?(key)
|
36
36
|
case key
|
37
37
|
when :reconnect, :local_infile, :secure_auth, :automatic_close, :enable_cleartext_plugin
|
@@ -50,21 +50,21 @@ module Mysql2
|
|
50
50
|
ssl_set(*ssl_options) if ssl_options.any? || opts.key?(:sslverify)
|
51
51
|
self.ssl_mode = parse_ssl_mode(opts[:ssl_mode]) if opts[:ssl_mode]
|
52
52
|
|
53
|
-
case opts[:flags]
|
53
|
+
flags = case opts[:flags]
|
54
54
|
when Array
|
55
|
-
|
55
|
+
parse_flags_array(opts[:flags], @query_options[:connect_flags])
|
56
56
|
when String
|
57
|
-
|
57
|
+
parse_flags_array(opts[:flags].split(' '), @query_options[:connect_flags])
|
58
58
|
when Integer
|
59
|
-
|
59
|
+
@query_options[:connect_flags] | opts[:flags]
|
60
60
|
else
|
61
|
-
|
61
|
+
@query_options[:connect_flags]
|
62
62
|
end
|
63
63
|
|
64
64
|
# SSL verify is a connection flag rather than a mysql_ssl_set option
|
65
65
|
flags |= SSL_VERIFY_SERVER_CERT if opts[:sslverify]
|
66
66
|
|
67
|
-
if [
|
67
|
+
if %i[user pass hostname dbname db sock].any? { |k| @query_options.key?(k) }
|
68
68
|
warn "============= WARNING FROM mysql2 ============="
|
69
69
|
warn "The options :user, :pass, :hostname, :dbname, :db, and :sock are deprecated and will be removed at some point in the future."
|
70
70
|
warn "Instead, please use :username, :password, :host, :port, :database, :socket, :flags for the options."
|
@@ -85,8 +85,9 @@ module Mysql2
|
|
85
85
|
port = port.to_i unless port.nil?
|
86
86
|
database = database.to_s unless database.nil?
|
87
87
|
socket = socket.to_s unless socket.nil?
|
88
|
+
conn_attrs = parse_connect_attrs(opts[:connect_attrs])
|
88
89
|
|
89
|
-
connect user, pass, host, port, database, socket, flags
|
90
|
+
connect user, pass, host, port, database, socket, flags, conn_attrs
|
90
91
|
end
|
91
92
|
|
92
93
|
def parse_ssl_mode(mode)
|
@@ -114,14 +115,19 @@ module Mysql2
|
|
114
115
|
end
|
115
116
|
end
|
116
117
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
# Set default program_name in performance_schema.session_connect_attrs
|
119
|
+
# and performance_schema.session_account_connect_attrs
|
120
|
+
def parse_connect_attrs(conn_attrs)
|
121
|
+
return {} if Mysql2::Client::CONNECT_ATTRS.zero?
|
122
|
+
conn_attrs ||= {}
|
123
|
+
conn_attrs[:program_name] ||= $PROGRAM_NAME
|
124
|
+
conn_attrs.each_with_object({}) do |(key, value), hash|
|
125
|
+
hash[key.to_s] = value.to_s
|
122
126
|
end
|
123
|
-
|
124
|
-
|
127
|
+
end
|
128
|
+
|
129
|
+
def query(sql, options = {})
|
130
|
+
Thread.handle_interrupt(::Mysql2::Util::TIMEOUT_ERROR_CLASS => :never) do
|
125
131
|
_query(sql, @query_options.merge(options))
|
126
132
|
end
|
127
133
|
end
|
data/lib/mysql2/em.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'eventmachine'
|
4
2
|
require 'mysql2'
|
5
3
|
|
@@ -17,7 +15,7 @@ module Mysql2
|
|
17
15
|
detach
|
18
16
|
begin
|
19
17
|
result = @client.async_result
|
20
|
-
rescue => e
|
18
|
+
rescue StandardError => e
|
21
19
|
@deferable.fail(e)
|
22
20
|
else
|
23
21
|
@deferable.succeed(result)
|
@@ -41,7 +39,7 @@ module Mysql2
|
|
41
39
|
|
42
40
|
def query(sql, opts = {})
|
43
41
|
if ::EM.reactor_running?
|
44
|
-
super(sql, opts.merge(:
|
42
|
+
super(sql, opts.merge(async: true))
|
45
43
|
deferable = ::EM::DefaultDeferrable.new
|
46
44
|
@watch = ::EM.watch(socket, Watcher, self, deferable)
|
47
45
|
@watch.notify_readable = true
|
data/lib/mysql2/error.rb
CHANGED
@@ -1,32 +1,65 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
1
|
module Mysql2
|
4
2
|
class Error < StandardError
|
5
3
|
ENCODE_OPTS = {
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
4
|
+
undef: :replace,
|
5
|
+
invalid: :replace,
|
6
|
+
replace: '?'.freeze,
|
7
|
+
}.freeze
|
8
|
+
|
9
|
+
ConnectionError = Class.new(Error)
|
10
|
+
TimeoutError = Class.new(Error)
|
11
|
+
|
12
|
+
CODES = {
|
13
|
+
1205 => TimeoutError, # ER_LOCK_WAIT_TIMEOUT
|
14
|
+
|
15
|
+
1044 => ConnectionError, # ER_DBACCESS_DENIED_ERROR
|
16
|
+
1045 => ConnectionError, # ER_ACCESS_DENIED_ERROR
|
17
|
+
1152 => ConnectionError, # ER_ABORTING_CONNECTION
|
18
|
+
1153 => ConnectionError, # ER_NET_PACKET_TOO_LARGE
|
19
|
+
1154 => ConnectionError, # ER_NET_READ_ERROR_FROM_PIPE
|
20
|
+
1155 => ConnectionError, # ER_NET_FCNTL_ERROR
|
21
|
+
1156 => ConnectionError, # ER_NET_PACKETS_OUT_OF_ORDER
|
22
|
+
1157 => ConnectionError, # ER_NET_UNCOMPRESS_ERROR
|
23
|
+
1158 => ConnectionError, # ER_NET_READ_ERROR
|
24
|
+
1159 => ConnectionError, # ER_NET_READ_INTERRUPTED
|
25
|
+
1160 => ConnectionError, # ER_NET_ERROR_ON_WRITE
|
26
|
+
1161 => ConnectionError, # ER_NET_WRITE_INTERRUPTED
|
27
|
+
|
28
|
+
2001 => ConnectionError, # CR_SOCKET_CREATE_ERROR
|
29
|
+
2002 => ConnectionError, # CR_CONNECTION_ERROR
|
30
|
+
2003 => ConnectionError, # CR_CONN_HOST_ERROR
|
31
|
+
2004 => ConnectionError, # CR_IPSOCK_ERROR
|
32
|
+
2005 => ConnectionError, # CR_UNKNOWN_HOST
|
33
|
+
2006 => ConnectionError, # CR_SERVER_GONE_ERROR
|
34
|
+
2007 => ConnectionError, # CR_VERSION_ERROR
|
35
|
+
2009 => ConnectionError, # CR_WRONG_HOST_INFO
|
36
|
+
2012 => ConnectionError, # CR_SERVER_HANDSHAKE_ERR
|
37
|
+
2013 => ConnectionError, # CR_SERVER_LOST
|
38
|
+
2020 => ConnectionError, # CR_NET_PACKET_TOO_LARGE
|
39
|
+
2026 => ConnectionError, # CR_SSL_CONNECTION_ERROR
|
40
|
+
2027 => ConnectionError, # CR_MALFORMED_PACKET
|
41
|
+
2047 => ConnectionError, # CR_CONN_UNKNOW_PROTOCOL
|
42
|
+
2048 => ConnectionError, # CR_INVALID_CONN_HANDLE
|
43
|
+
2049 => ConnectionError, # CR_UNUSED_1
|
9
44
|
}.freeze
|
10
45
|
|
11
46
|
attr_reader :error_number, :sql_state
|
12
47
|
|
13
48
|
# Mysql gem compatibility
|
14
|
-
|
15
|
-
|
49
|
+
alias errno error_number
|
50
|
+
alias error message
|
16
51
|
|
17
|
-
def initialize(msg)
|
18
|
-
@server_version
|
52
|
+
def initialize(msg, server_version = nil, error_number = nil, sql_state = nil)
|
53
|
+
@server_version = server_version
|
54
|
+
@error_number = error_number
|
55
|
+
@sql_state = sql_state ? sql_state.encode(**ENCODE_OPTS) : nil
|
19
56
|
|
20
57
|
super(clean_message(msg))
|
21
58
|
end
|
22
59
|
|
23
60
|
def self.new_with_args(msg, server_version, error_number, sql_state)
|
24
|
-
|
25
|
-
|
26
|
-
err.instance_variable_set('@error_number', error_number)
|
27
|
-
err.instance_variable_set('@sql_state', sql_state.respond_to?(:encode) ? sql_state.encode(ENCODE_OPTS) : sql_state)
|
28
|
-
err.send(:initialize, msg)
|
29
|
-
err
|
61
|
+
error_class = CODES.fetch(error_number, self)
|
62
|
+
error_class.new(msg, server_version, error_number, sql_state)
|
30
63
|
end
|
31
64
|
|
32
65
|
private
|
@@ -55,16 +88,12 @@ module Mysql2
|
|
55
88
|
# encoding, we'll assume UTF-8 and clean the string of anything that's not a
|
56
89
|
# valid UTF-8 character.
|
57
90
|
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
# Returns a valid UTF-8 string in Ruby 1.9+, the original string on Ruby 1.8
|
91
|
+
# Returns a valid UTF-8 string.
|
61
92
|
def clean_message(message)
|
62
|
-
return message unless message.respond_to?(:encode)
|
63
|
-
|
64
93
|
if @server_version && @server_version > 50500
|
65
|
-
message.encode(ENCODE_OPTS)
|
94
|
+
message.encode(**ENCODE_OPTS)
|
66
95
|
else
|
67
|
-
message.encode(Encoding::UTF_8, ENCODE_OPTS)
|
96
|
+
message.encode(Encoding::UTF_8, **ENCODE_OPTS)
|
68
97
|
end
|
69
98
|
end
|
70
99
|
end
|
data/lib/mysql2/result.rb
CHANGED
data/lib/mysql2/statement.rb
CHANGED
@@ -2,15 +2,9 @@ module Mysql2
|
|
2
2
|
class Statement
|
3
3
|
include Enumerable
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
_execute(*args)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
else
|
12
|
-
def execute(*args)
|
13
|
-
_execute(*args)
|
5
|
+
def execute(*args, **kwargs)
|
6
|
+
Thread.handle_interrupt(::Mysql2::Util::TIMEOUT_ERROR_CLASS => :never) do
|
7
|
+
_execute(*args, **kwargs)
|
14
8
|
end
|
15
9
|
end
|
16
10
|
end
|
data/lib/mysql2/version.rb
CHANGED
data/support/5072E1F5.asc
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
2
|
-
Version: GnuPG v1
|
2
|
+
Version: GnuPG v1
|
3
3
|
|
4
4
|
mQGiBD4+owwRBAC14GIfUfCyEDSIePvEW3SAFUdJBtoQHH/nJKZyQT7h9bPlUWC3
|
5
5
|
RODjQReyCITRrdwyrKUGku2FmeVGwn2u2WmDMNABLnpprWPkBdCk96+OmSLN9brZ
|
@@ -11,9 +11,9 @@ kYpXBACmWpP8NJTkamEnPCia2ZoOHODANwpUkP43I7jsDmgtobZX9qnrAXw+uNDI
|
|
11
11
|
QJEXM6FSbi0LLtZciNlYsafwAPEOMDKpMqAK6IyisNtPvaLd8lH0bPAnWqcyefep
|
12
12
|
rv0sxxqUEMcM3o7wwgfN83POkDasDbs3pjwPhxvhz6//62zQJ7Q2TXlTUUwgUmVs
|
13
13
|
ZWFzZSBFbmdpbmVlcmluZyA8bXlzcWwtYnVpbGRAb3NzLm9yYWNsZS5jb20+iGwE
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
ExECACwCGyMCHgECF4ACGQEGCwkIBwMCBhUKCQgCAwUWAgMBAAUCXEBY+wUJI87e
|
15
|
+
5AAKCRCMcY07UHLh9RZPAJ9uvm0zlzfCN+DHxHVaoFLFjdVYTQCfborsC9tmEZYa
|
16
|
+
whhogjeBkZkorbyIaQQTEQIAKQIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAhkB
|
17
17
|
BQJTAdRmBQkaZsvLAAoJEIxxjTtQcuH1X4MAoKNLWAbCBUj96637kv6Xa/fJuX5m
|
18
18
|
AJwPtmgDfjUe2iuhXdTrFEPT19SB6ohmBBMRAgAmAhsjBgsJCAcDAgQVAggDBBYC
|
19
19
|
AwECHgECF4AFAk53PioFCRP7AhUACgkQjHGNO1By4fUmzACeJdfqgc9gWTUhgmcM
|
@@ -428,5 +428,5 @@ GoaU9u41oyZTIiXPiFidJoIZCh7fdurP8pn3X+R5HUNXMr7M+ba8lSNxce/F3kmH
|
|
428
428
|
0L7rsKqdh9d/aVxhJINJ+inVDnrXWVoXu9GBjT8Nco1iU9SIVAQYEQIADAUCTnc9
|
429
429
|
7QUJE/sBuAASB2VHUEcAAQEJEIxxjTtQcuH1FJsAmwWK9vmwRJ/y9gTnJ8PWf0BV
|
430
430
|
roUTAKClYAhZuX2nUNwH4vlEJQHDqYa5yQ==
|
431
|
-
=
|
431
|
+
=ghXk
|
432
432
|
-----END PGP PUBLIC KEY BLOCK-----
|
@@ -43,16 +43,21 @@ mysql_to_rb = {
|
|
43
43
|
"geostd8" => "NULL",
|
44
44
|
"cp932" => "Windows-31J",
|
45
45
|
"eucjpms" => "eucJP-ms",
|
46
|
+
"utf16le" => "UTF-16LE",
|
47
|
+
"gb18030" => "GB18030",
|
46
48
|
}
|
47
49
|
|
48
|
-
client = Mysql2::Client.new(:
|
49
|
-
collations = client.query "SHOW COLLATION", :
|
50
|
+
client = Mysql2::Client.new(username: user, password: pass, host: host, port: port.to_i)
|
51
|
+
collations = client.query "SHOW COLLATION", as: :array
|
50
52
|
encodings = Array.new(collations.to_a.last[2].to_i)
|
51
53
|
encodings_with_nil = Array.new(encodings.size)
|
52
54
|
|
53
55
|
collations.each do |collation|
|
54
56
|
mysql_col_idx = collation[2].to_i
|
55
|
-
rb_enc = mysql_to_rb
|
57
|
+
rb_enc = mysql_to_rb.fetch(collation[1]) do |mysql_enc|
|
58
|
+
$stderr.puts "WARNING: Missing mapping for collation \"#{collation[0]}\" with encoding \"#{mysql_enc}\" and id #{mysql_col_idx}, assuming NULL"
|
59
|
+
"NULL"
|
60
|
+
end
|
56
61
|
encodings[mysql_col_idx - 1] = [mysql_col_idx, rb_enc]
|
57
62
|
end
|
58
63
|
|
@@ -38,9 +38,11 @@ mysql_to_rb = {
|
|
38
38
|
"geostd8" => nil,
|
39
39
|
"cp932" => "Windows-31J",
|
40
40
|
"eucjpms" => "eucJP-ms",
|
41
|
+
"utf16le" => "UTF-16LE",
|
42
|
+
"gb18030" => "GB18030",
|
41
43
|
}
|
42
44
|
|
43
|
-
puts <<-
|
45
|
+
puts <<-HEADER
|
44
46
|
%readonly-tables
|
45
47
|
%enum
|
46
48
|
%define lookup-function-name mysql2_mysql_enc_name_to_rb
|
@@ -48,13 +50,13 @@ puts <<-header
|
|
48
50
|
%struct-type
|
49
51
|
struct mysql2_mysql_enc_name_to_rb_map { const char *name; const char *rb_name; }
|
50
52
|
%%
|
51
|
-
|
53
|
+
HEADER
|
52
54
|
|
53
55
|
mysql_to_rb.each do |mysql, ruby|
|
54
|
-
if ruby.nil?
|
55
|
-
|
56
|
+
name = if ruby.nil?
|
57
|
+
"NULL"
|
56
58
|
else
|
57
|
-
|
59
|
+
"\"#{ruby}\""
|
58
60
|
end
|
59
61
|
|
60
62
|
puts "#{mysql}, #{name}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mysql2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Lopez
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-11-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|
@@ -23,8 +23,6 @@ files:
|
|
23
23
|
- CHANGELOG.md
|
24
24
|
- LICENSE
|
25
25
|
- README.md
|
26
|
-
- examples/eventmachine.rb
|
27
|
-
- examples/threaded.rb
|
28
26
|
- ext/mysql2/client.c
|
29
27
|
- ext/mysql2/client.h
|
30
28
|
- ext/mysql2/extconf.rb
|
@@ -48,37 +46,15 @@ files:
|
|
48
46
|
- lib/mysql2/result.rb
|
49
47
|
- lib/mysql2/statement.rb
|
50
48
|
- lib/mysql2/version.rb
|
51
|
-
- spec/configuration.yml.example
|
52
|
-
- spec/em/em_spec.rb
|
53
|
-
- spec/my.cnf.example
|
54
|
-
- spec/mysql2/client_spec.rb
|
55
|
-
- spec/mysql2/error_spec.rb
|
56
|
-
- spec/mysql2/result_spec.rb
|
57
|
-
- spec/mysql2/statement_spec.rb
|
58
|
-
- spec/rcov.opts
|
59
|
-
- spec/spec_helper.rb
|
60
|
-
- spec/ssl/ca-cert.pem
|
61
|
-
- spec/ssl/ca-key.pem
|
62
|
-
- spec/ssl/ca.cnf
|
63
|
-
- spec/ssl/cert.cnf
|
64
|
-
- spec/ssl/client-cert.pem
|
65
|
-
- spec/ssl/client-key.pem
|
66
|
-
- spec/ssl/client-req.pem
|
67
|
-
- spec/ssl/gen_certs.sh
|
68
|
-
- spec/ssl/pkcs8-client-key.pem
|
69
|
-
- spec/ssl/pkcs8-server-key.pem
|
70
|
-
- spec/ssl/server-cert.pem
|
71
|
-
- spec/ssl/server-key.pem
|
72
|
-
- spec/ssl/server-req.pem
|
73
|
-
- spec/test_data
|
74
49
|
- support/5072E1F5.asc
|
75
50
|
- support/libmysql.def
|
76
51
|
- support/mysql_enc_to_ruby.rb
|
77
52
|
- support/ruby_enc_to_mysql.rb
|
78
|
-
homepage:
|
53
|
+
homepage: https://github.com/brianmario/mysql2
|
79
54
|
licenses:
|
80
55
|
- MIT
|
81
|
-
metadata:
|
56
|
+
metadata:
|
57
|
+
msys2_mingw_dependencies: libmariadbclient
|
82
58
|
post_install_message:
|
83
59
|
rdoc_options:
|
84
60
|
- "--charset=UTF-8"
|
@@ -88,41 +64,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
64
|
requirements:
|
89
65
|
- - ">="
|
90
66
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
67
|
+
version: 2.0.0
|
92
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
69
|
requirements:
|
94
70
|
- - ">="
|
95
71
|
- !ruby/object:Gem::Version
|
96
72
|
version: '0'
|
97
73
|
requirements: []
|
98
|
-
|
99
|
-
rubygems_version: 2.5.2
|
74
|
+
rubygems_version: 3.0.3
|
100
75
|
signing_key:
|
101
76
|
specification_version: 4
|
102
77
|
summary: A simple, fast Mysql library for Ruby, binding to libmysql
|
103
|
-
test_files:
|
104
|
-
- examples/eventmachine.rb
|
105
|
-
- examples/threaded.rb
|
106
|
-
- spec/configuration.yml.example
|
107
|
-
- spec/em/em_spec.rb
|
108
|
-
- spec/my.cnf.example
|
109
|
-
- spec/mysql2/client_spec.rb
|
110
|
-
- spec/mysql2/error_spec.rb
|
111
|
-
- spec/mysql2/result_spec.rb
|
112
|
-
- spec/mysql2/statement_spec.rb
|
113
|
-
- spec/rcov.opts
|
114
|
-
- spec/spec_helper.rb
|
115
|
-
- spec/ssl/ca-cert.pem
|
116
|
-
- spec/ssl/ca-key.pem
|
117
|
-
- spec/ssl/ca.cnf
|
118
|
-
- spec/ssl/cert.cnf
|
119
|
-
- spec/ssl/client-cert.pem
|
120
|
-
- spec/ssl/client-key.pem
|
121
|
-
- spec/ssl/client-req.pem
|
122
|
-
- spec/ssl/gen_certs.sh
|
123
|
-
- spec/ssl/pkcs8-client-key.pem
|
124
|
-
- spec/ssl/pkcs8-server-key.pem
|
125
|
-
- spec/ssl/server-cert.pem
|
126
|
-
- spec/ssl/server-key.pem
|
127
|
-
- spec/ssl/server-req.pem
|
128
|
-
- spec/test_data
|
78
|
+
test_files: []
|