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