@@ -160,6 +160,26 @@ Mysql2::Client.new(
160
160
:default_group = ' my.cfg section'
161
161
)
162
162
```
163
+
164
+ ### SSL options
165
+
166
+ Setting any of the following options will enable an SSL connection, but only if
167
+ your MySQL client library and server have been compiled with SSL support.
168
+ MySQL client library defaults will be used for any parameters that are left out
169
+ or set to nil. Relative paths are allowed, and may be required by managed
170
+ hosting providers such as Heroku.
171
+
172
+ ``` ruby
173
+ Mysql2 ::Client .new (
174
+ # ...options as above...,
175
+ :sslkey => ' /path/to/client-key.pem' ,
176
+ :sslcert => ' /path/to/client-cert.pem' ,
177
+ :sslca => ' /path/to/ca-cert.pem' ,
178
+ :sslcapath => ' /path/to/cacerts' ,
179
+ :sslcipher => ' DHE-RSA-AES256-SHA'
180
+ )
181
+ ```
182
+
163
183
### Multiple result sets
164
184
165
185
You can also retrieve multiple result sets. For this to work you need to connect with
@@ -186,7 +206,7 @@ The MySQL 5.6.5 client library may also refuse to attempt a connection if provid
186
206
To bypass this restriction in the client, pass the option : secure_auth => false to Mysql2::Client.new().
187
207
If using ActiveRecord, your database.yml might look something like this:
188
208
189
- ```
209
+ ``` yaml
190
210
development :
191
211
adapter : mysql2
192
212
encoding : utf8
@@ -199,11 +219,12 @@ development:
199
219
` ` `
200
220
201
221
### Reading a MySQL config file
222
+
202
223
You may read configuration options from a MySQL configuration file by passing
203
224
the ` :default_file` and `:default_group` paramters. For example:
204
225
205
- ```
206
- client = Mysql2::Client.new(:default_file => '/user/.my.cnf', :default_group => 'client')
226
+ ` ` ` ruby
227
+ Mysql2::Client.new(:default_file => '/user/.my.cnf', :default_group => 'client')
207
228
` ` `
208
229
209
230
@@ -405,15 +426,15 @@ As for field values themselves, I'm workin on it - but expect that soon.
405
426
406
427
# # Compatibility
407
428
408
- The specs pass on my system (SL 10.6.3, x86_64) in these rubies :
429
+ This gem is regularly tested against the following Ruby versions on Linux and Mac OS X :
409
430
410
- * 1.8.7-p249
411
- * ree-1.8.7-2010.01
412
- * 1.9.1-p378
413
- * ruby-trunk
414
- * rbx-head - broken at the moment, working with the rbx team for a solution
431
+ * Ruby MRI 1.8.7, 1.9.2, 1.9.3, 2.0.0 (ongoing patch releases).
432
+ * Ruby Enterprise Edition (based on MRI 1.8.7).
433
+ * Rubinius 2.0 in compatibility modes 1.8, 1.9, 2.0.
415
434
416
- The Active Record driver should work on 2.3.5 and 3.0
435
+ The mysql2 gem 0.2.x series includes an Active Record driver that works with AR
436
+ 2.3.x and 3.0.x. Starting in Active Record 3.1, a mysql2 driver is included in
437
+ the Active Record codebase and no longer provided in mysql2 gem 0.3 and above.
417
438
418
439
# # Yeah... but why?
419
440
@@ -422,7 +443,6 @@ Someone: Dude, the Mysql gem works fiiiiiine.
422
443
Me : It sure does, but it only hands you nil and strings for field values. Leaving you to convert
423
444
them into proper Ruby types in Ruby-land - which is slow as balls.
424
445
425
-
426
446
Someone : OK fine, but do_mysql can already give me back values with Ruby objects mapped to MySQL types.
427
447
428
448
Me : Yep, but it's API is considerably more complex *and* can be ~2x slower.
0 commit comments