mysql2 0.3.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.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +1 -230
  3. data/LICENSE +21 -0
  4. data/README.md +405 -80
  5. data/ext/mysql2/client.c +1110 -335
  6. data/ext/mysql2/client.h +18 -32
  7. data/ext/mysql2/extconf.rb +228 -37
  8. data/ext/mysql2/infile.c +122 -0
  9. data/ext/mysql2/infile.h +1 -0
  10. data/ext/mysql2/mysql2_ext.c +3 -1
  11. data/ext/mysql2/mysql2_ext.h +18 -16
  12. data/ext/mysql2/mysql_enc_name_to_ruby.h +172 -0
  13. data/ext/mysql2/mysql_enc_to_ruby.h +310 -0
  14. data/ext/mysql2/result.c +671 -226
  15. data/ext/mysql2/result.h +15 -6
  16. data/ext/mysql2/statement.c +604 -0
  17. data/ext/mysql2/statement.h +17 -0
  18. data/ext/mysql2/wait_for_single_fd.h +2 -1
  19. data/lib/mysql2/client.rb +125 -212
  20. data/lib/mysql2/console.rb +5 -0
  21. data/lib/mysql2/em.rb +24 -8
  22. data/lib/mysql2/error.rb +93 -8
  23. data/lib/mysql2/field.rb +3 -0
  24. data/lib/mysql2/result.rb +2 -0
  25. data/lib/mysql2/statement.rb +11 -0
  26. data/lib/mysql2/version.rb +1 -1
  27. data/lib/mysql2.rb +70 -5
  28. data/support/5072E1F5.asc +432 -0
  29. data/support/libmysql.def +219 -0
  30. data/support/mysql_enc_to_ruby.rb +86 -0
  31. data/support/ruby_enc_to_mysql.rb +63 -0
  32. metadata +45 -214
  33. data/.gitignore +0 -12
  34. data/.rspec +0 -3
  35. data/.rvmrc +0 -1
  36. data/.travis.yml +0 -7
  37. data/Gemfile +0 -3
  38. data/MIT-LICENSE +0 -20
  39. data/Rakefile +0 -5
  40. data/benchmark/active_record.rb +0 -51
  41. data/benchmark/active_record_threaded.rb +0 -42
  42. data/benchmark/allocations.rb +0 -33
  43. data/benchmark/escape.rb +0 -36
  44. data/benchmark/query_with_mysql_casting.rb +0 -80
  45. data/benchmark/query_without_mysql_casting.rb +0 -56
  46. data/benchmark/sequel.rb +0 -37
  47. data/benchmark/setup_db.rb +0 -119
  48. data/benchmark/threaded.rb +0 -44
  49. data/examples/eventmachine.rb +0 -21
  50. data/examples/threaded.rb +0 -20
  51. data/mysql2.gemspec +0 -29
  52. data/spec/em/em_spec.rb +0 -50
  53. data/spec/mysql2/client_spec.rb +0 -465
  54. data/spec/mysql2/error_spec.rb +0 -69
  55. data/spec/mysql2/result_spec.rb +0 -388
  56. data/spec/rcov.opts +0 -3
  57. data/spec/spec_helper.rb +0 -67
  58. data/tasks/benchmarks.rake +0 -20
  59. data/tasks/compile.rake +0 -71
  60. data/tasks/rspec.rake +0 -16
  61. data/tasks/vendor_mysql.rake +0 -40
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8be4e0f4afbea38c5460544e39c9e0d987dd040c9de5ebdbc4c1e200102ca8e4
4
+ data.tar.gz: 996e05358297b03bf8f06abffd37d83a590912246ec607d2c3ee53b325c43022
5
+ SHA512:
6
+ metadata.gz: daf37441bcb29366453963529b5a144df0d599b79b7a0b9d90b2ae5ed3dee97c1945a58111d6fe6bc2f1c20f75c9960c3cc1cd988a0e5d1be5ce44b7dcdf3633
7
+ data.tar.gz: 421df08c45f4257c2f04f3dc0a0e1c1557c695598c4e1a80236d618d1a79510459b8919b753ad9af2d46d21fa19ba060d5b53da2f54a00ff90ca45a4534c9108
data/CHANGELOG.md CHANGED
@@ -1,230 +1 @@
1
- # Changelog
2
-
3
- ## 0.3.10 (November 9th, 2011)
4
-
5
- ## 0.3.9 (November 9th, 2011)
6
-
7
- ## 0.3.8 (November 9th, 2011)
8
- * remove fiber support from mysql2, the code has moved to the
9
- em-synchrony gem.
10
- * use rb_wait_for_single_fd() if available
11
- * fixed a bug with inheriting query options
12
- * remove ext/ from the default loadpath
13
- * fix build issues on OSX with Xcode 4.2 (gcc-llvm compiler)
14
-
15
- ## 0.3.7 (August 16th, 2011)
16
- * ensure symbolized column names support encodings in 1.9
17
-
18
- ## 0.3.6 (June 17th, 2011)
19
- * fix bug in Time/DateTime range detection
20
- * (win32) fix bug where the Mysql2::Client object wasn't cleaned up properly if interrupted during a query
21
- * add Mysql2::Result#count (aliased as size) to get the row count for the dataset
22
- this can be especially helpful if you want to get the number of rows without having to inflate
23
- the entire dataset into ruby (since this happens lazily)
24
-
25
- ## 0.3.5 (June 15th, 2011)
26
- * bug fix for Time/DateTime usage depending on 32/64bit Ruby
27
-
28
- ## 0.3.4 (June 15th, 2011)
29
- * fix a long standing bug where a signal would interrupt rb_thread_select and put the connection in a permanently broken state
30
- * turn on casting in the ActiveRecord again, users can disable it if they need to for performance reasons
31
-
32
- ## 0.3.3 (June 14th, 2011)
33
- * disable async support, and access to the underlying file descriptor under Windows. It's never worked reliably and ruby-core has a lot of work to do in order to make it possible.
34
- * added support for turning eager-casting off. This is especially useful in ORMs that will lazily cast values upon access.
35
- * added a warning if a 0.2.x release is being used with ActiveRecord 3.1 since both the 0.2.x releases and AR 3.1 have mysql2 adapters, we want you to use the one in AR 3.1
36
- * added Mysql2::Client.escape (class-level method)
37
- * disabled eager-casting in the bundled ActiveRecord adapter (for Rails 3.0 or less)
38
-
39
- ## 0.3.2 (April 26th, 2011)
40
- * Fix typo in initialization for older ActiveRecord versions
41
-
42
- ## 0.3.1 (April 26th, 2011)
43
- * Fix typo in initialization for older ActiveRecord versions
44
-
45
- ## 0.3.0 (April 26th, 2011)
46
- * switch to MySQL Connector/C for win32 builds
47
- * win32 bugfixes
48
- * BREAKING CHANGE: the ActiveRecord adapter has been pulled into Rails 3.1 and is no longer part of the gem
49
- * added Mysql2::Client.escape (class-level) for raw one-off non-encoding-aware escaping
50
-
51
- ## 0.2.17 (November 9th, 2011)
52
-
53
- ## 0.2.16 (November 9th, 2011)
54
-
55
- ## 0.2.15 (November 9th, 2011)
56
-
57
- ## 0.2.14 (November 9th, 2011)
58
- * use rb_wait_for_single_fd() if available
59
- * fixed a bug with inheriting query options
60
- * remove ext/ from the default loadpath
61
- * fix build issues on OSX with Xcode 4.2 (gcc-llvm compiler)
62
-
63
- ## 0.2.13 (August 16th, 2011)
64
- * fix stupid bug around symbol encoding support (thanks coderrr!)
65
-
66
- ## 0.2.12 (August 16th, 2011)
67
- * ensure symbolized column names support encodings in 1.9
68
- * plugging sql vulnerability in mysql2 adapter
69
-
70
- ## 0.2.11 (June 17th, 2011)
71
- * fix bug in Time/DateTime range detection
72
- * (win32) fix bug where the Mysql2::Client object wasn't cleaned up properly if interrupted during a query
73
- * add Mysql2::Result#count (aliased as size) to get the row count for the dataset
74
- this can be especially helpful if you want to get the number of rows without having to inflate
75
- the entire dataset into ruby (since this happens lazily)
76
-
77
- ## 0.2.10 (June 15th, 2011)
78
- * bug fix for Time/DateTime usage depending on 32/64bit Ruby
79
-
80
- ## 0.2.9 (June 15th, 2011)
81
- * fix a long standing bug where a signal would interrupt rb_thread_select and put the connection in a permanently broken state
82
- * turn on casting in the ActiveRecord again, users can disable it if they need to for performance reasons
83
-
84
- ## 0.2.8 (June 14th, 2011)
85
- * disable async support, and access to the underlying file descriptor under Windows. It's never worked reliably and ruby-core has a lot of work to do in order to make it possible.
86
- * added support for turning eager-casting off. This is especially useful in ORMs that will lazily cast values upon access.
87
- * added a warning if a 0.2.x release is being used with ActiveRecord 3.1 since both the 0.2.x releases and AR 3.1 have mysql2 adapters, we want you to use the one in AR 3.1
88
- * added Mysql2::Client.escape (class-level method)
89
- * disabled eager-casting in the bundled ActiveRecord adapter (for Rails 3.0 or less)
90
-
91
- ## 0.2.7 (March 28th, 2011)
92
- * various fixes for em_mysql2 and fiber usage
93
- * use our own Mysql2IndexDefinition class for better compatibility across ActiveRecord versions
94
- * ensure the query is a string earlier in the Mysql2::Client#query codepath for 1.9
95
- * only set binary ruby encoding on fields that have a binary flag *and* encoding set
96
- * a few various optimizations
97
- * add support for :read_timeout to be set on a connection
98
- * Fix to install with MariDB on Windows
99
- * add fibered em connection without activerecord
100
- * fix some 1.9.3 compilation warnings
101
- * add LD_RUN_PATH when using hard coded mysql paths - this should help users with MySQL installed in non-standard locations
102
- * for windows support, duplicate the socket from libmysql and create a temporary CRT fd
103
- * fix for handling years before 1970 on Windows
104
- * fixes to the Fiber adapter
105
- * set wait_timeout maximum on Windows to 2147483
106
- * update supported range for Time objects
107
- * upon being required, make sure the libmysql we're using is the one we were built against
108
- * add Mysql2::Client#thread_id
109
- * add Mysql2::Client#ping
110
- * switch connection check in AR adapter to use Mysql2::Client#ping for efficiency
111
- * prefer linking against thread-safe version of libmysqlclient
112
- * define RSTRING_NOT_MODIFIED for an awesome rbx speed boost
113
- * expose Mysql2::Client#encoding in 1.9, make sure we set the error message and sqlstate encodings accordingly
114
- * do not segfault when raising for invalid charset (found in 1.9.3dev)
115
-
116
- ## 0.2.6 (October 19th, 2010)
117
- * version bump since the 0.2.5 win32 binary gems were broken
118
-
119
- ## 0.2.5 (October 19th, 2010)
120
- * fixes for easier Win32 binary gem deployment for targeting 1.8 and 1.9 in the same gem
121
- * refactor of connection checks and management to avoid race conditions with the GC/threading to prevent the unexpected loss of connections
122
- * update the default flags during connection
123
- * add support for setting wait_timeout on AR adapter
124
- * upgrade to rspec2
125
- * bugfix for an edge case where the GC would clean up a Mysql2::Client object before the underlying MYSQL pointer had been initialized
126
- * fix to CFLAGS to allow compilation on SPARC with sunstudio compiler - Anko painting <anko.com+github@gmail.com>
127
-
128
- ## 0.2.4 (September 17th, 2010)
129
- * a few patches for win32 support from Luis Lavena - thanks man!
130
- * bugfix from Eric Wong to avoid a potential stack overflow during Mysql2::Client#escape
131
- * added the ability to turn internal row caching on/off via the :cache_rows => true/false option
132
- * a couple of small patches for rbx compatibility
133
- * set IndexDefinition#length in AR adapter - Kouhei Yanagita <yanagi@shakenbu.org>
134
- * fix a long-standing data corruption bug - thank you thank you thank you to @joedamato (http://github.com/ice799)
135
- * bugfix from calling mysql_close on a closed/freed connection surfaced by the above fix
136
-
137
- ## 0.2.3 (August 20th, 2010)
138
- * connection flags can now be passed to the constructor via the :flags key
139
- * switch AR adapter connection over to use FOUND_ROWS option
140
- * patch to ensure we use DateTime objects in place of Time for timestamps that are out of the supported range on 32bit platforms < 1.9.2
141
-
142
- ## 0.2.2 (August 19th, 2010)
143
- * Change how AR adapter would send initial commands upon connecting
144
- ** we can make multiple session variable assignments in a single query
145
- * fix signal handling when waiting on queries
146
- * retry connect if interrupted by signals
147
-
148
- ## 0.2.1 (August 16th, 2010)
149
- * bring mysql2 ActiveRecord adapter back into gem
150
-
151
- ## 0.2.0 (August 16th, 2010)
152
- * switch back to letting libmysql manage all allocation/thread-state/freeing for the connection
153
- * cache various numeric type conversions in hot-spots of the code for a little speed boost
154
- * ActiveRecord adapter moved into Rails 3 core
155
- ** Don't worry 2.3.x users! We'll either release the adapter as a separate gem, or try to get it into 2.3.9
156
- * Fix for the "closed MySQL connection" error (GH #31)
157
- * Fix for the "can't modify frozen object" error in 1.9.2 (GH #37)
158
- * Introduce cascading query and result options (more info in README)
159
- * Sequel adapter pulled into core (will be in the next release - 3.15.0 at the time of writing)
160
- * add a safety check when attempting to send a query before a result has been fetched
161
-
162
- ## 0.1.9 (July 17th, 2010)
163
- * Support async ActiveRecord access with fibers and EventMachine (mperham)
164
- * string encoding support for 1.9, respecting Encoding.default_internal
165
- * added support for rake-compiler (tenderlove)
166
- * bugfixes for ActiveRecord driver
167
- ** one minor bugfix for TimeZone support
168
- ** fix the select_rows method to return what it should according to the docs (r-stu31)
169
- * Mysql2::Client#fields method added - returns the array of field names from a resultset, as strings
170
- * Sequel adapter
171
- ** bugfix regarding sybolized field names (Eric Wong)
172
- ** fix query logging in Sequel adapter
173
- * Lots of nice code cleanup (tenderlove)
174
- ** Mysql2::Error definition moved to pure-Ruby
175
- ** Mysql2::client#initialize definition moved to pure-Ruby
176
- ** Mysql2::Result partially moved to pure-Ruby
177
-
178
- ## 0.1.8 (June 2nd, 2010)
179
- * fixes for AR adapter for timezone juggling
180
- * fixes to be able to run benchmarks and specs under 1.9.2
181
-
182
- ## 0.1.7 (May 22nd, 2010)
183
- * fix a bug when using the disconnect! method on a closed connection in the AR driver
184
-
185
- ## 0.1.6 (May 14th, 2010)
186
- * more fixes to the AR adapter related to casting
187
- * add missing index creation override method to AR adapter
188
- * added sql_state and error_number methods to the Mysql2::Error exception class
189
-
190
- ## 0.1.5 (May 12th, 2010)
191
- * quite a few patches from Eric Wong related to thread-safety, non-blocking I/O and general cleanup
192
- ** wrap mysql_real_connect with rb_thread_blocking_region
193
- ** release GVL for possibly blocking mysql_* library calls
194
- ** [cleanup] quiet down warnings
195
- ** [cleanup] make all C symbols static
196
- ** add Mysql2::Client#close method
197
- ** correctly free the wrapped result in case of EOF
198
- ** Fix memory leak from the result wrapper struct itself
199
- ** make Mysql2::Client destructor safely non-blocking
200
- * bug fixes for ActiveRecord adapter
201
- ** added casting for default values since they all come back from Mysql as strings (!?!)
202
- ** missing constant was added
203
- ** fixed a typo in the show_variable method
204
- * switched over sscanf for date/time parsing in C
205
- * made some specs a little finer-grained
206
- * initial Sequel adapter added
207
- * updated query benchmarks to reflect the difference between casting in C and in Ruby
208
-
209
- ## 0.1.4 (April 23rd, 2010)
210
- * optimization: implemented a local cache for rows that are lazily created in ruby during iteration. The MySQL C result is freed as soon as all the results have been cached
211
- * optimization: implemented a local cache for field names so every row reuses the same objects as field names/keys
212
- * refactor the Mysql2 connection adapter for ActiveRecord to not extend the Mysql adapter - now being a free-standing connection adapter
213
-
214
- ## 0.1.3 (April 15th, 2010)
215
- * added an EventMachine Deferrable API
216
- * added an ActiveRecord connection adapter
217
- ** should be compatible with 2.3.5 and 3.0 (including Arel)
218
-
219
- ## 0.1.2 (April 9th, 2010)
220
- * fix a bug (copy/paste fail) around checking for empty TIME values and returning nil (thanks @marius)
221
-
222
- ## 0.1.1 (April 6th, 2010)
223
- * added affected_rows method (mysql_affected_rows)
224
- * added last_id method (last_insert_id)
225
- * enable reconnect option by default
226
- * added initial async query support
227
- * updated extconf (thanks to the mysqlplus project) for easier gem building
228
-
229
- ## 0.1.0 (April 6th, 2010)
230
- * initial release
1
+ Changes are maintained under [Releases](https://github.com/brianmario/mysql2/releases)
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Brian Lopez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.