mysql2 0.3.11-x86-mswin32-60 → 0.3.18-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +15 -0
  2. data/README.md +280 -75
  3. data/ext/mysql2/client.c +721 -206
  4. data/ext/mysql2/client.h +26 -12
  5. data/ext/mysql2/extconf.rb +120 -16
  6. data/ext/mysql2/infile.c +122 -0
  7. data/ext/mysql2/infile.h +1 -0
  8. data/ext/mysql2/mysql2_ext.h +7 -4
  9. data/ext/mysql2/mysql_enc_name_to_ruby.h +168 -0
  10. data/ext/mysql2/mysql_enc_to_ruby.h +246 -0
  11. data/ext/mysql2/result.c +230 -112
  12. data/ext/mysql2/result.h +4 -1
  13. data/lib/mysql2.rb +46 -3
  14. data/lib/mysql2/1.8/mysql2.so +0 -0
  15. data/lib/mysql2/1.9/mysql2.so +0 -0
  16. data/lib/mysql2/2.0/mysql2.so +0 -0
  17. data/lib/mysql2/2.1/mysql2.so +0 -0
  18. data/lib/mysql2/client.rb +48 -200
  19. data/lib/mysql2/console.rb +5 -0
  20. data/lib/mysql2/em.rb +22 -3
  21. data/lib/mysql2/error.rb +71 -6
  22. data/lib/mysql2/mysql2.rb +2 -0
  23. data/lib/mysql2/version.rb +1 -1
  24. data/spec/configuration.yml.example +17 -0
  25. data/spec/em/em_spec.rb +90 -5
  26. data/spec/my.cnf.example +9 -0
  27. data/spec/mysql2/client_spec.rb +501 -69
  28. data/spec/mysql2/error_spec.rb +58 -44
  29. data/spec/mysql2/result_spec.rb +191 -74
  30. data/spec/spec_helper.rb +23 -3
  31. data/spec/test_data +1 -0
  32. data/support/libmysql.def +219 -0
  33. data/support/mysql_enc_to_ruby.rb +82 -0
  34. data/support/ruby_enc_to_mysql.rb +61 -0
  35. data/vendor/README +654 -0
  36. data/vendor/libmysql.dll +0 -0
  37. metadata +86 -221
  38. data/.gitignore +0 -12
  39. data/.rspec +0 -3
  40. data/.rvmrc +0 -1
  41. data/.travis.yml +0 -7
  42. data/CHANGELOG.md +0 -244
  43. data/Gemfile +0 -3
  44. data/MIT-LICENSE +0 -20
  45. data/Rakefile +0 -5
  46. data/benchmark/active_record.rb +0 -51
  47. data/benchmark/active_record_threaded.rb +0 -42
  48. data/benchmark/allocations.rb +0 -33
  49. data/benchmark/escape.rb +0 -36
  50. data/benchmark/query_with_mysql_casting.rb +0 -80
  51. data/benchmark/query_without_mysql_casting.rb +0 -56
  52. data/benchmark/sequel.rb +0 -37
  53. data/benchmark/setup_db.rb +0 -119
  54. data/benchmark/threaded.rb +0 -44
  55. data/mysql2.gemspec +0 -29
  56. data/tasks/benchmarks.rake +0 -20
  57. data/tasks/compile.rake +0 -71
  58. data/tasks/rspec.rake +0 -16
  59. data/tasks/vendor_mysql.rake +0 -40
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTI2ZTgyZDhkOWJmYTcxMGY0NDFiZWZmMDkxOTAxZTM0NWM4NDE4MQ==
5
+ data.tar.gz: !binary |-
6
+ NmFjMTgxN2QzYzA3ZDBjY2E3MDk1NTk1NzQxMmJmODI5M2ViN2E4Mw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MDdhMjc0MzUxYWRmOWU4NzEyMDQyYWVjMjNlMDlkMDk5MjQxYTFjMGI0NzU3
10
+ YzI1ZWQyOWNlMGY1MzZjNDBjMGM5OTY0YTIxNzQwODBlMGRjZTI1NDZhYWU4
11
+ ZWZkNDAxYmM5NTc3NzE1NjE2NWUwMGNkNzBkNjQxN2MwNWE2NWE=
12
+ data.tar.gz: !binary |-
13
+ ZTMxZTkwODhlMTBiYmYzNmM5OTdlNWZkODRiNzdjYTk0MzMyZDQ0MjhkZDU2
14
+ NDE3MDI4M2RiYzFjNGNmODJhNjQ5OTZiNjMzNGNkZDlhMDQzM2RhZmI2Yjg0
15
+ MzZmMjJjNmVhOWNkNjlmZTFhYTE0MjUwNzEyMjMwNmM3YzAzNzI=
data/README.md CHANGED
@@ -1,24 +1,90 @@
1
- # Mysql2 - A modern, simple and very fast Mysql library for Ruby - binding to libmysql
1
+ # Mysql2 - A modern, simple and very fast MySQL library for Ruby - binding to libmysql
2
+
3
+ Travis CI [![Travis CI Status](https://travis-ci.org/brianmario/mysql2.png)](https://travis-ci.org/brianmario/mysql2)
4
+ Appveyor CI [![Appveyor CI Status](https://ci.appveyor.com/api/projects/status/github/sodabrew/mysql2)](https://ci.appveyor.com/project/sodabrew/mysql2)
2
5
 
3
6
  The Mysql2 gem is meant to serve the extremely common use-case of connecting, querying and iterating on results.
4
- Some database libraries out there serve as direct 1:1 mappings of the already complex C API's available.
7
+ Some database libraries out there serve as direct 1:1 mappings of the already complex C APIs available.
5
8
  This one is not.
6
9
 
7
10
  It also forces the use of UTF-8 [or binary] for the connection [and all strings in 1.9, unless Encoding.default_internal is set then it'll convert from UTF-8 to that encoding] and uses encoding-aware MySQL API calls where it can.
8
11
 
9
12
  The API consists of two classes:
10
13
 
11
- Mysql2::Client - your connection to the database
14
+ `Mysql2::Client` - your connection to the database.
12
15
 
13
- Mysql2::Result - returned from issuing a #query on the connection. It includes Enumerable.
16
+ `Mysql2::Result` - returned from issuing a #query on the connection. It includes Enumerable.
14
17
 
15
18
  ## Installing
16
-
19
+ ### General Instructions
17
20
  ``` sh
18
21
  gem install mysql2
19
22
  ```
20
23
 
21
- You may have to specify --with-mysql-config=/some/random/path/bin/mysql_config
24
+ This gem links against MySQL's `libmysqlclient` library or `Connector/C`
25
+ library, and compatible alternatives such as MariaDB.
26
+ You may need to install a package such as `libmysqlclient-dev`, `mysql-devel`,
27
+ or other appropriate package for your system. See below for system-specific
28
+ instructions.
29
+
30
+ By default, the mysql2 gem will try to find a copy of MySQL in this order:
31
+
32
+ * Option `--with-mysql-dir`, if provided (see below).
33
+ * Option `--with-mysql-config`, if provided (see below).
34
+ * Several typical paths for `mysql_config` (default for the majority of users).
35
+ * The directory `/usr/local`.
36
+
37
+ ### Configuration options
38
+
39
+ Use these options by `gem install mysql2 -- [--optionA] [--optionB=argument]`.
40
+
41
+ * `--with-mysql-dir[=/path/to/mysqldir]` -
42
+ Specify the directory where MySQL is installed. The mysql2 gem will not use
43
+ `mysql_config`, but will instead look at `mysqldir/lib` and `mysqldir/include`
44
+ for the library and header files.
45
+ This option is mutually exclusive with `--with-mysql-config`.
46
+
47
+ * `--with-mysql-config[=/path/to/mysql_config]` -
48
+ Specify a path to the `mysql_config` binary provided by your copy of MySQL. The
49
+ mysql2 gem will ask this `mysql_config` binary about the compiler and linker
50
+ arguments needed.
51
+ This option is mutually exclusive with `--with-mysql-dir`.
52
+
53
+ * `--with-mysql-rpath=/path/to/mysql/lib` / `--without-mysql-rpath` -
54
+ Override the runtime path used to find the MySQL libraries.
55
+ This may be needed if you deploy to a system where these libraries
56
+ are located somewhere different than on your build system.
57
+ This overrides any rpath calculated by default or by the options above.
58
+
59
+ ### Linux and other Unixes
60
+
61
+ You may need to install a package such as `libmysqlclient-dev` or `mysql-devel`;
62
+ refer to your distribution's package guide to find the particular package.
63
+ The most common issue we see is a user who has the library file `libmysqlclient.so` but is
64
+ missing the header file `mysql.h` -- double check that you have the _-dev_ packages installed.
65
+
66
+ ### Mac OS X
67
+
68
+ You may use MacPorts, Homebrew, or a native MySQL installer package. The most
69
+ common paths will be automatically searched. If you want to select a specific
70
+ MySQL directory, use the `--with-mysql-dir` or `--with-mysql-config` options above.
71
+
72
+ ### Windows
73
+ Make sure that you have Ruby and the DevKit compilers installed. We recommend
74
+ the [Ruby Installer](http://rubyinstaller.org) distribution.
75
+
76
+ By default, the mysql2 gem will download and use MySQL Connector/C from
77
+ mysql.com. If you prefer to use a local installation of Connector/C, add the
78
+ flag `--with-mysql-dir=c:/mysql-connector-c-x-y-z` (_this path may use forward slashes_).
79
+
80
+ By default, the `libmysql.dll` library will be copied into the mysql2 gem
81
+ directory. To prevent this, add the flag `--no-vendor-libmysql`. The mysql2 gem
82
+ will search for `libmysql.dll` in the following paths, in order:
83
+
84
+ * Environment variable `RUBY_MYSQL2_LIBMYSQL_DLL=C:\path\to\libmysql.dll`
85
+ (_note the Windows-style backslashes_).
86
+ * In the mysql2 gem's own directory `vendor/libmysql.dll`
87
+ * In the system's default library search paths.
22
88
 
23
89
  ## Usage
24
90
 
@@ -53,7 +119,10 @@ results.each do |row|
53
119
  # conveniently, row is a hash
54
120
  # the keys are the fields, as you'd expect
55
121
  # the values are pre-built ruby primitives mapped from their corresponding field types in MySQL
56
- # Here's an otter: http://farm1.static.flickr.com/130/398077070_b8795d0ef3_b.jpg
122
+ puts row["id"] # row["id"].class == Fixnum
123
+ if row["dne"] # non-existant hash entry is nil
124
+ puts row["dne"]
125
+ end
57
126
  end
58
127
  ```
59
128
 
@@ -68,8 +137,7 @@ end
68
137
  How about with symbolized keys?
69
138
 
70
139
  ``` ruby
71
- # NOTE: the :symbolize_keys and future options will likely move to the #query method soon
72
- client.query("SELECT * FROM users WHERE group='githubbers'").each(:symbolize_keys => true) do |row|
140
+ client.query("SELECT * FROM users WHERE group='githubbers'", :symbolize_keys => true) do |row|
73
141
  # do something with row, it's ready to rock
74
142
  end
75
143
  ```
@@ -85,6 +153,134 @@ results.each(:as => :array) do |row|
85
153
  end
86
154
  ```
87
155
 
156
+ ## Connection options
157
+
158
+ You may set the following connection options in Mysql2::Client.new(...):
159
+
160
+ ``` ruby
161
+ Mysql2::Client.new(
162
+ :host,
163
+ :username,
164
+ :password,
165
+ :port,
166
+ :database,
167
+ :socket = '/path/to/mysql.sock',
168
+ :flags = REMEMBER_OPTIONS | LONG_PASSWORD | LONG_FLAG | TRANSACTIONS | PROTOCOL_41 | SECURE_CONNECTION | MULTI_STATEMENTS,
169
+ :encoding = 'utf8',
170
+ :read_timeout = seconds,
171
+ :write_timeout = seconds,
172
+ :connect_timeout = seconds,
173
+ :reconnect = true/false,
174
+ :local_infile = true/false,
175
+ :secure_auth = true/false,
176
+ :default_file = '/path/to/my.cfg',
177
+ :default_group = 'my.cfg section',
178
+ :init_command => sql
179
+ )
180
+ ```
181
+
182
+
183
+ ### SSL options
184
+
185
+ Setting any of the following options will enable an SSL connection, but only if
186
+ your MySQL client library and server have been compiled with SSL support.
187
+ MySQL client library defaults will be used for any parameters that are left out
188
+ or set to nil. Relative paths are allowed, and may be required by managed
189
+ hosting providers such as Heroku.
190
+
191
+ ``` ruby
192
+ Mysql2::Client.new(
193
+ # ...options as above...,
194
+ :sslkey => '/path/to/client-key.pem',
195
+ :sslcert => '/path/to/client-cert.pem',
196
+ :sslca => '/path/to/ca-cert.pem',
197
+ :sslcapath => '/path/to/cacerts',
198
+ :sslcipher => 'DHE-RSA-AES256-SHA'
199
+ )
200
+ ```
201
+
202
+ ### Multiple result sets
203
+
204
+ You can also retrieve multiple result sets. For this to work you need to
205
+ connect with flags `Mysql2::Client::MULTI_STATEMENTS`. Multiple result sets can
206
+ be used with stored procedures that return more than one result set, and for
207
+ bundling several SQL statements into a single call to `client.query`.
208
+
209
+ ``` ruby
210
+ client = Mysql2::Client.new(:host => "localhost", :username => "root", :flags => Mysql2::Client::MULTI_STATEMENTS)
211
+ result = client.query('CALL sp_customer_list( 25, 10 )')
212
+ # result now contains the first result set
213
+ while client.next_result
214
+ result = client.store_result
215
+ # result now contains the next result set
216
+ end
217
+ ```
218
+
219
+ Repeated calls to `client.next_result` will return true, false, or raise an
220
+ exception if the respective query erred. When `client.next_result` returns true,
221
+ call `client.store_result` to retrieve a result object. Exceptions are not
222
+ raised until `client.next_result` is called to find the status of the respective
223
+ query. Subsequent queries are not executed if an earlier query raised an
224
+ exception. Subsequent calls to `client.next_result` will return false.
225
+
226
+ ``` ruby
227
+ result = client.query('SELECT 1; SELECT 2; SELECT A; SELECT 3')
228
+ p result.first
229
+
230
+ while client.next_result
231
+ result = client.store_result
232
+ p result.first
233
+ end
234
+ ```
235
+
236
+ Yields:
237
+ ```
238
+ {"1"=>1}
239
+ {"2"=>2}
240
+ next_result: Unknown column 'A' in 'field list' (Mysql2::Error)
241
+ ```
242
+
243
+ See https://gist.github.com/1367987 for using MULTI_STATEMENTS with Active Record.
244
+
245
+ ### Secure auth
246
+
247
+ Starting wih MySQL 5.6.5, secure_auth is enabled by default on servers (it was disabled by default prior to this).
248
+ When secure_auth is enabled, the server will refuse a connection if the account password is stored in old pre-MySQL 4.1 format.
249
+ The MySQL 5.6.5 client library may also refuse to attempt a connection if provided an older format password.
250
+ To bypass this restriction in the client, pass the option :secure_auth => false to Mysql2::Client.new().
251
+ If using ActiveRecord, your database.yml might look something like this:
252
+
253
+ ``` yaml
254
+ development:
255
+ adapter: mysql2
256
+ encoding: utf8
257
+ database: my_db_name
258
+ username: root
259
+ password: my_password
260
+ host: 127.0.0.1
261
+ port: 3306
262
+ secure_auth: false
263
+ ```
264
+
265
+ ### Reading a MySQL config file
266
+
267
+ You may read configuration options from a MySQL configuration file by passing
268
+ the `:default_file` and `:default_group` paramters. For example:
269
+
270
+ ``` ruby
271
+ Mysql2::Client.new(:default_file => '/user/.my.cnf', :default_group => 'client')
272
+ ```
273
+
274
+ ### Initial command on connect and reconnect
275
+
276
+ If you specify the init_command option, the SQL string you provide will be executed after the connection is established.
277
+ If `:reconnect` is set to `true`, init_command will also be executed after a successful reconnect.
278
+ It is useful if you want to provide session options which survive reconnection.
279
+
280
+ ``` ruby
281
+ Mysql2::Client.new(:init_command => "SET @@SESSION.sql_mode = 'STRICT_ALL_TABLES'")
282
+ ```
283
+
88
284
  ## Cascading config
89
285
 
90
286
  The default config hash is at:
@@ -132,11 +328,6 @@ Pass the `:as => :array` option to any of the above methods of configuration
132
328
 
133
329
  The default result type is set to :hash, but you can override a previous setting to something else with :as => :hash
134
330
 
135
- ### Others...
136
-
137
- I may add support for `:as => :csv` or even `:as => :json` to allow for *much* more efficient generation of those data types from result sets.
138
- If you'd like to see either of these (or others), open an issue and start bugging me about it ;)
139
-
140
331
  ### Timezones
141
332
 
142
333
  Mysql2 now supports two timezone options:
@@ -162,7 +353,7 @@ result = client.query("SELECT * FROM table_with_boolean_field", :cast_booleans =
162
353
 
163
354
  ### Skipping casting
164
355
 
165
- Mysql2 casting is fast, but not as fast as not casting data. In rare cases where typecasting is not needed, it will be faster to disable it by providing :cast => false.
356
+ Mysql2 casting is fast, but not as fast as not casting data. In rare cases where typecasting is not needed, it will be faster to disable it by providing :cast => false. (Note that :cast => false overrides :cast_booleans => true.)
166
357
 
167
358
  ``` ruby
168
359
  client = Mysql2::Client.new
@@ -212,23 +403,65 @@ This is especially helpful since it saves the cost of creating the row in Ruby i
212
403
  If you only plan on using each row once, then it's much more efficient to disable this behavior by setting the `:cache_rows` option to false.
213
404
  This would be helpful if you wanted to iterate over the results in a streaming manner. Meaning the GC would cleanup rows you don't need anymore as you're iterating over the result set.
214
405
 
215
- ## ActiveRecord
406
+ ### Streaming
407
+
408
+ `Mysql2::Client` can optionally only fetch rows from the server on demand by setting `:stream => true`. This is handy when handling very large result sets which might not fit in memory on the client.
409
+
410
+ ``` ruby
411
+ result = client.query("SELECT * FROM really_big_Table", :stream => true)
412
+ ```
413
+
414
+ There are a few things that need to be kept in mind while using streaming:
415
+
416
+ * `:cache_rows` is ignored currently. (if you want to use `:cache_rows` you probably don't want to be using `:stream`)
417
+ * You must fetch all rows in the result set of your query before you can make new queries. (i.e. with `Mysql2::Result#each`)
418
+
419
+ Read more about the consequences of using `mysql_use_result` (what streaming is implemented with) here: http://dev.mysql.com/doc/refman/5.0/en/mysql-use-result.html.
420
+
421
+ ### Lazy Everything
422
+
423
+ Well... almost ;)
424
+
425
+ Field name strings/symbols are shared across all the rows so only one object is ever created to represent the field name for an entire dataset.
426
+
427
+ Rows themselves are lazily created in ruby-land when an attempt to yield it is made via #each.
428
+ For example, if you were to yield 4 rows from a 100 row dataset, only 4 hashes will be created. The rest will sit and wait in C-land until you want them (or when the GC goes to cleanup your `Mysql2::Result` instance).
429
+ Now say you were to iterate over that same collection again, this time yielding 15 rows - the 4 previous rows that had already been turned into ruby hashes would be pulled from an internal cache, then 11 more would be created and stored in that cache.
430
+ Once the entire dataset has been converted into ruby objects, Mysql2::Result will free the Mysql C result object as it's no longer needed.
431
+
432
+ This caching behavior can be disabled by setting the `:cache_rows` option to false.
433
+
434
+ As for field values themselves, I'm workin on it - but expect that soon.
435
+
436
+ ## Compatibility
437
+
438
+ This gem is tested with the following Ruby versions on Linux and Mac OS X:
439
+
440
+ * Ruby MRI 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1.x, 2.2.x (ongoing patch releases)
441
+ * Ruby Enterprise Edition (based on MRI 1.8.7)
442
+ * Rubinius 2.x
216
443
 
217
- To use the ActiveRecord driver (with or without rails), all you should need to do is have this gem installed and set the adapter in your database.yml to "mysql2".
218
- That was easy right? :)
444
+ This gem is tested with the following MySQL and MariaDB versions:
219
445
 
220
- NOTE: as of 0.3.0, and ActiveRecord 3.1 - the ActiveRecord adapter has been pulled out of this gem and into ActiveRecord itself. If you need to use mysql2 with
221
- Rails versions < 3.1 make sure and specify `gem "mysql2", "~> 0.2.7"` in your Gemfile
446
+ * MySQL 5.0, 5.1, 5.5, 5.6, 5.7
447
+ * MySQL Connector/C 6.0 and 6.1 (primarily on Windows)
448
+ * MariaDB 5.5, 10.0
222
449
 
223
- ## Asynchronous ActiveRecord
450
+ ### Active Record
451
+
452
+ * mysql2 0.2.x includes an Active Record driver compatible with AR 2.3 and 3.0
453
+ * mysql2 0.3.x does not include an AR driver because it is included in AR 3.1 and above
454
+
455
+ ### Asynchronous Active Record
224
456
 
225
457
  Please see the [em-synchrony](https://github.com/igrigorik/em-synchrony) project for details about using EventMachine with mysql2 and Rails.
226
458
 
227
- ## Sequel
459
+ ### Sequel
228
460
 
229
- The Sequel adapter was pulled out into Sequel core (will be part of the next release) and can be used by specifying the "mysql2://" prefix to your connection specification.
461
+ Sequel includes a mysql2 adapter in all releases since 3.15 (2010-09-01).
462
+ Use the prefix "mysql2://" in your connection specification.
230
463
 
231
- ## EventMachine
464
+ ### EventMachine
232
465
 
233
466
  The mysql2 EventMachine deferrable api allows you to make async queries using EventMachine,
234
467
  while specifying callbacks for success for failure. Here's a simple example:
@@ -251,65 +484,30 @@ EM.run do
251
484
  end
252
485
  ```
253
486
 
254
- ## Lazy Everything
255
-
256
- Well... almost ;)
257
-
258
- Field name strings/symbols are shared across all the rows so only one object is ever created to represent the field name for an entire dataset.
259
-
260
- Rows themselves are lazily created in ruby-land when an attempt to yield it is made via #each.
261
- For example, if you were to yield 4 rows from a 100 row dataset, only 4 hashes will be created. The rest will sit and wait in C-land until you want them (or when the GC goes to cleanup your `Mysql2::Result` instance).
262
- Now say you were to iterate over that same collection again, this time yielding 15 rows - the 4 previous rows that had already been turned into ruby hashes would be pulled from an internal cache, then 11 more would be created and stored in that cache.
263
- Once the entire dataset has been converted into ruby objects, Mysql2::Result will free the Mysql C result object as it's no longer needed.
487
+ ## Benchmarks and Comparison
264
488
 
265
- This caching behavior can be disabled by setting the :cache_rows option to false.
489
+ The mysql2 gem converts MySQL field types to Ruby data types in C code, providing a serious speed benefit.
266
490
 
267
- As for field values themselves, I'm workin on it - but expect that soon.
268
-
269
- ## Compatibility
491
+ The do_mysql gem also converts MySQL fields types, but has a considerably more complex API and is still ~2x slower than mysql2.
270
492
 
271
- The specs pass on my system (SL 10.6.3, x86_64) in these rubies:
493
+ The mysql gem returns only nil or string data types, leaving you to convert field values to Ruby types in Ruby-land, which is much slower than mysql2's C code.
272
494
 
273
- * 1.8.7-p249
274
- * ree-1.8.7-2010.01
275
- * 1.9.1-p378
276
- * ruby-trunk
277
- * rbx-head - broken at the moment, working with the rbx team for a solution
278
-
279
- The ActiveRecord driver should work on 2.3.5 and 3.0
280
-
281
- ## Yeah... but why?
282
-
283
- Someone: Dude, the Mysql gem works fiiiiiine.
284
-
285
- Me: It sure does, but it only hands you nil and strings for field values. Leaving you to convert
286
- them into proper Ruby types in Ruby-land - which is slow as balls.
287
-
288
-
289
- Someone: OK fine, but do_mysql can already give me back values with Ruby objects mapped to MySQL types.
290
-
291
- Me: Yep, but it's API is considerably more complex *and* can be ~2x slower.
292
-
293
- ## Benchmarks
294
-
295
- Performing a basic "SELECT * FROM" query on a table with 30k rows and fields of nearly every Ruby-representable data type,
296
- then iterating over every row using an #each like method yielding a block:
297
-
298
- These results are from the `query_with_mysql_casting.rb` script in the benchmarks folder
495
+ For a comparative benchmark, the script below performs a basic "SELECT * FROM"
496
+ query on a table with 30k rows and fields of nearly every Ruby-representable
497
+ data type, then iterating over every row using an #each like method yielding a
498
+ block:
299
499
 
300
500
  ``` sh
301
- user system total real
302
- Mysql2
303
- 0.750000 0.180000 0.930000 ( 1.821655)
304
- do_mysql
305
- 1.650000 0.200000 1.850000 ( 2.811357)
306
- Mysql
307
- 7.500000 0.210000 7.710000 ( 8.065871)
501
+ user system total real
502
+ Mysql2 0.750000 0.180000 0.930000 (1.821655)
503
+ do_mysql 1.650000 0.200000 1.850000 (2.811357)
504
+ Mysql 7.500000 0.210000 7.710000 (8.065871)
308
505
  ```
309
506
 
507
+ These results are from the `query_with_mysql_casting.rb` script in the benchmarks folder.
508
+
310
509
  ## Development
311
510
 
312
- To run the tests, you can use RVM and Bundler to create a pristine environment for mysql2 development/hacking.
313
511
  Use 'bundle install' to install the necessary development and testing gems:
314
512
 
315
513
  ``` sh
@@ -326,9 +524,16 @@ CREATE USER '<user>'@'localhost' IDENTIFIED BY '';
326
524
  GRANT ALL PRIVILEGES ON test.* TO '<user>'@'localhost';
327
525
  ```
328
526
 
527
+ You can change these defaults in the spec/configuration.yml which is generated
528
+ automatically when you run rake (or explicitly `rake spec/configuration.yml`).
529
+
530
+ For a normal installation on a Mac, you most likely do not need to do anything,
531
+ though.
532
+
329
533
  ## Special Thanks
330
534
 
331
535
  * Eric Wong - for the contribution (and the informative explanations) of some thread-safety, non-blocking I/O and cleanup patches. You rock dude
332
- * Yury Korolev (http://github.com/yury) - for TONS of help testing the ActiveRecord adapter
536
+ * Yury Korolev (http://github.com/yury) - for TONS of help testing the Active Record adapter
333
537
  * Aaron Patterson (http://github.com/tenderlove) - tons of contributions, suggestions and general badassness
334
- * Mike Perham (http://github.com/mperham) - Async ActiveRecord adapter (uses Fibers and EventMachine)
538
+ * Mike Perham (http://github.com/mperham) - Async Active Record adapter (uses Fibers and EventMachine)
539
+ * Aaron Stone (http://github.com/sodabrew) - additional client settings, local files, microsecond time, maintenance support.