sequel 3.12.0 → 3.12.1

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/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 3.12.1 (2010-06-09)
2
+
3
+ * Make :encoding option work on MySQL even if config file specifies different encoding (jeremyevans) (#300)
4
+
1
5
  === 3.12.0 (2010-06-01)
2
6
 
3
7
  * Add a :deferrable option to foreign_key for creating deferrable foreign keys (hydrow)
@@ -99,6 +99,11 @@ module Sequel
99
99
  conn = Mysql.init
100
100
  conn.options(Mysql::READ_DEFAULT_GROUP, opts[:config_default_group] || "client")
101
101
  conn.options(Mysql::OPT_LOCAL_INFILE, opts[:config_local_infile]) if opts.has_key?(:config_local_infile)
102
+ if encoding = opts[:encoding] || opts[:charset]
103
+ # Set encoding before connecting so that the mysql driver knows what
104
+ # encoding we want to use, but this can be overridden by READ_DEFAULT_GROUP.
105
+ conn.options(Mysql::SET_CHARSET_NAME, encoding)
106
+ end
102
107
  conn.real_connect(
103
108
  opts[:host] || 'localhost',
104
109
  opts[:user],
@@ -110,11 +115,11 @@ module Sequel
110
115
  Mysql::CLIENT_MULTI_STATEMENTS +
111
116
  (opts[:compress] == false ? 0 : Mysql::CLIENT_COMPRESS)
112
117
  )
113
- if encoding = opts[:encoding] || opts[:charset]
114
- # Setting encoding before the connect appears not to work
115
- # with READ_DEFAULT_GROUP, so set it afterwards.
116
- conn.options(Mysql::SET_CHARSET_NAME, encoding)
117
- end
118
+ # Set encoding a slightly different way after connecting,
119
+ # in case the READ_DEFAULT_GROUP overrode the provided encoding.
120
+ # Doesn't work across implicit reconnects, but Sequel doesn't turn on
121
+ # that feature.
122
+ conn.query("set names #{literal(encoding.to_s)}") if encoding
118
123
 
119
124
  # increase timeout so mysql server doesn't disconnect us
120
125
  conn.query("set @@wait_timeout = #{opts[:timeout] || 2592000}")
@@ -1,7 +1,7 @@
1
1
  module Sequel
2
2
  MAJOR = 3
3
3
  MINOR = 12
4
- TINY = 0
4
+ TINY = 1
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join('.')
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.0
4
+ version: 3.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-06-01 00:00:00 -07:00
12
+ date: 2010-06-09 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15