mysql2 0.5.2-x86-mswin32-60 → 0.5.3-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +44 -28
- data/ext/mysql2/client.c +25 -8
- data/ext/mysql2/extconf.rb +1 -1
- data/ext/mysql2/mysql_enc_name_to_ruby.h +60 -56
- data/ext/mysql2/mysql_enc_to_ruby.h +56 -5
- data/ext/mysql2/result.c +17 -11
- data/ext/mysql2/statement.c +4 -2
- data/lib/mysql2.rb +6 -3
- data/lib/mysql2/2.2/mysql2.so +0 -0
- data/lib/mysql2/2.3/mysql2.so +0 -0
- data/lib/mysql2/2.4/mysql2.so +0 -0
- data/lib/mysql2/2.5/mysql2.so +0 -0
- data/lib/mysql2/2.6/mysql2.so +0 -0
- data/lib/mysql2/client.rb +1 -1
- data/lib/mysql2/error.rb +3 -3
- data/lib/mysql2/version.rb +1 -1
- data/support/5072E1F5.asc +5 -5
- data/support/mysql_enc_to_ruby.rb +6 -1
- data/support/ruby_enc_to_mysql.rb +2 -0
- metadata +7 -58
- data/examples/eventmachine.rb +0 -19
- data/examples/threaded.rb +0 -16
- data/lib/mysql2/2.0/mysql2.so +0 -0
- data/lib/mysql2/2.1/mysql2.so +0 -0
- data/spec/configuration.yml.example +0 -11
- data/spec/em/em_spec.rb +0 -135
- data/spec/my.cnf.example +0 -9
- data/spec/mysql2/client_spec.rb +0 -1072
- data/spec/mysql2/error_spec.rb +0 -78
- data/spec/mysql2/result_spec.rb +0 -485
- data/spec/mysql2/statement_spec.rb +0 -712
- data/spec/rcov.opts +0 -3
- data/spec/spec_helper.rb +0 -112
- data/spec/ssl/ca-cert.pem +0 -17
- data/spec/ssl/ca-key.pem +0 -27
- data/spec/ssl/ca.cnf +0 -22
- data/spec/ssl/cert.cnf +0 -22
- data/spec/ssl/client-cert.pem +0 -17
- data/spec/ssl/client-key.pem +0 -27
- data/spec/ssl/client-req.pem +0 -15
- data/spec/ssl/gen_certs.sh +0 -48
- data/spec/ssl/pkcs8-client-key.pem +0 -28
- data/spec/ssl/pkcs8-server-key.pem +0 -28
- data/spec/ssl/server-cert.pem +0 -17
- data/spec/ssl/server-key.pem +0 -27
- data/spec/ssl/server-req.pem +0 -15
- data/spec/test_data +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccde13503c0209dd88473f6bba48ca76c50e75f6f5752be34e98daeb393a6914
|
4
|
+
data.tar.gz: aa17593984b4598ad3d652662daa638a9a5359eec52b3cb9178409290f87f90e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ddef58bf48cd4008dc448df56a3df3ef9cc2805f2658bbe6f737fcee85309c6aae8a51b249ec2b04a4a7a700b148549346bd7d789d86c4196149fe85ea2f627
|
7
|
+
data.tar.gz: b370497c10517fe4d6b8f00649eec90b824017649252fe1a676332c857b45958f9618e127930e520a8f4687ab36e4408cd2f861745494bd01e0cf1c1c86531fd
|
data/README.md
CHANGED
@@ -18,16 +18,18 @@ The API consists of three classes:
|
|
18
18
|
`Mysql2::Statement` - returned from issuing a #prepare on the connection. Execute the statement to get a Result.
|
19
19
|
|
20
20
|
## Installing
|
21
|
+
|
21
22
|
### General Instructions
|
23
|
+
|
22
24
|
``` sh
|
23
25
|
gem install mysql2
|
24
26
|
```
|
25
27
|
|
26
28
|
This gem links against MySQL's `libmysqlclient` library or `Connector/C`
|
27
29
|
library, and compatible alternatives such as MariaDB.
|
28
|
-
You may need to install a package such as `
|
29
|
-
or other appropriate package for your system. See below for
|
30
|
-
instructions.
|
30
|
+
You may need to install a package such as `libmariadb-dev`, `libmysqlclient-dev`,
|
31
|
+
`mysql-devel`, or other appropriate package for your system. See below for
|
32
|
+
system-specific instructions.
|
31
33
|
|
32
34
|
By default, the mysql2 gem will try to find a copy of MySQL in this order:
|
33
35
|
|
@@ -74,8 +76,8 @@ To see line numbers in backtraces, declare these environment variables
|
|
74
76
|
|
75
77
|
### Linux and other Unixes
|
76
78
|
|
77
|
-
You may need to install a package such as `
|
78
|
-
or `default-libmysqlclient-dev`; refer to your distribution's package guide to
|
79
|
+
You may need to install a package such as `libmariadb-dev`, `libmysqlclient-dev`,
|
80
|
+
`mysql-devel`, or `default-libmysqlclient-dev`; refer to your distribution's package guide to
|
79
81
|
find the particular package. The most common issue we see is a user who has
|
80
82
|
the library file `libmysqlclient.so` but is missing the header file `mysql.h`
|
81
83
|
-- double check that you have the _-dev_ packages installed.
|
@@ -90,6 +92,7 @@ If you have not done so already, you will need to install the XCode select tools
|
|
90
92
|
`xcode-select --install`.
|
91
93
|
|
92
94
|
### Windows
|
95
|
+
|
93
96
|
Make sure that you have Ruby and the DevKit compilers installed. We recommend
|
94
97
|
the [Ruby Installer](http://rubyinstaller.org) distribution.
|
95
98
|
|
@@ -157,7 +160,7 @@ end
|
|
157
160
|
How about with symbolized keys?
|
158
161
|
|
159
162
|
``` ruby
|
160
|
-
client.query("SELECT * FROM users WHERE group='githubbers'", :symbolize_keys => true) do |row|
|
163
|
+
client.query("SELECT * FROM users WHERE group='githubbers'", :symbolize_keys => true).each do |row|
|
161
164
|
# do something with row, it's ready to rock
|
162
165
|
end
|
163
166
|
```
|
@@ -180,7 +183,7 @@ question marks in the statement. Query options can be passed as keyword argument
|
|
180
183
|
to the execute method.
|
181
184
|
|
182
185
|
Be sure to read about the known limitations of prepared statements at
|
183
|
-
https://dev.mysql.com/doc/refman/5.6/en/c-api-prepared-statement-problems.html
|
186
|
+
[https://dev.mysql.com/doc/refman/5.6/en/c-api-prepared-statement-problems.html](https://dev.mysql.com/doc/refman/5.6/en/c-api-prepared-statement-problems.html)
|
184
187
|
|
185
188
|
``` ruby
|
186
189
|
statement = @client.prepare("SELECT * FROM users WHERE login_count = ?")
|
@@ -218,6 +221,7 @@ Mysql2::Client.new(
|
|
218
221
|
:ssl_mode = :disabled / :preferred / :required / :verify_ca / :verify_identity,
|
219
222
|
:default_file = '/path/to/my.cfg',
|
220
223
|
:default_group = 'my.cfg section',
|
224
|
+
:default_auth = 'authentication_windows_client'
|
221
225
|
:init_command => sql
|
222
226
|
)
|
223
227
|
```
|
@@ -274,8 +278,10 @@ The string form will be split on whitespace and parsed as with the array form:
|
|
274
278
|
Plain flags are added to the default flags, while flags prefixed with `-`
|
275
279
|
(minus) are removed from the default flags.
|
276
280
|
|
277
|
-
|
278
|
-
|
281
|
+
### Using Active Record's database.yml
|
282
|
+
|
283
|
+
Active Record typically reads its configuration from a file named `database.yml` or an environment variable `DATABASE_URL`.
|
284
|
+
Use the value `mysql2` as the adapter name. For example:
|
279
285
|
|
280
286
|
``` yaml
|
281
287
|
development:
|
@@ -293,6 +299,15 @@ development:
|
|
293
299
|
secure_auth: false
|
294
300
|
```
|
295
301
|
|
302
|
+
### Using Active Record's DATABASE_URL
|
303
|
+
|
304
|
+
Active Record typically reads its configuration from a file named `database.yml` or an environment variable `DATABASE_URL`.
|
305
|
+
Use the value `mysql2` as the protocol name. For example:
|
306
|
+
|
307
|
+
``` shell
|
308
|
+
DATABASE_URL=mysql2://sql_user:sql_pass@sql_host_name:port/sql_db_name?option1=value1&option2=value2
|
309
|
+
```
|
310
|
+
|
296
311
|
### Reading a MySQL config file
|
297
312
|
|
298
313
|
You may read configuration options from a MySQL configuration file by passing
|
@@ -347,7 +362,8 @@ end
|
|
347
362
|
```
|
348
363
|
|
349
364
|
Yields:
|
350
|
-
|
365
|
+
|
366
|
+
```ruby
|
351
367
|
{"1"=>1}
|
352
368
|
{"2"=>2}
|
353
369
|
next_result: Unknown column 'A' in 'field list' (Mysql2::Error)
|
@@ -506,7 +522,7 @@ There are a few things that need to be kept in mind while using streaming:
|
|
506
522
|
* `:cache_rows` is ignored currently. (if you want to use `:cache_rows` you probably don't want to be using `:stream`)
|
507
523
|
* You must fetch all rows in the result set of your query before you can make new queries. (i.e. with `Mysql2::Result#each`)
|
508
524
|
|
509
|
-
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.
|
525
|
+
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](http://dev.mysql.com/doc/refman/5.0/en/mysql-use-result.html).
|
510
526
|
|
511
527
|
### Lazy Everything
|
512
528
|
|
@@ -527,21 +543,21 @@ As for field values themselves, I'm workin on it - but expect that soon.
|
|
527
543
|
|
528
544
|
This gem is tested with the following Ruby versions on Linux and Mac OS X:
|
529
545
|
|
530
|
-
|
531
|
-
|
546
|
+
* Ruby MRI 2.0.0, 2.1.x, 2.2.x, 2.3.x, 2.4.x, 2.5.x, 2.6.x
|
547
|
+
* Rubinius 2.x and 3.x do work but may fail under some workloads
|
532
548
|
|
533
549
|
This gem is tested with the following MySQL and MariaDB versions:
|
534
550
|
|
535
|
-
|
536
|
-
|
537
|
-
|
551
|
+
* MySQL 5.5, 5.6, 5.7, 8.0
|
552
|
+
* MySQL Connector/C 6.0 and 6.1 (primarily on Windows)
|
553
|
+
* MariaDB 5.5, 10.0, 10.1, 10.2, 10.3
|
538
554
|
|
539
555
|
### Ruby on Rails / Active Record
|
540
556
|
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
557
|
+
* mysql2 0.5.x works with Rails / Active Record 5.0.7, 5.1.6, and higher.
|
558
|
+
* mysql2 0.4.x works with Rails / Active Record 4.2.5 - 5.0 and higher.
|
559
|
+
* mysql2 0.3.x works with Rails / Active Record 3.1, 3.2, 4.x, 5.0.
|
560
|
+
* mysql2 0.2.x works with Rails / Active Record 2.3 - 3.0.
|
545
561
|
|
546
562
|
### Asynchronous Active Record
|
547
563
|
|
@@ -624,11 +640,11 @@ though.
|
|
624
640
|
## Special Thanks
|
625
641
|
|
626
642
|
* Eric Wong - for the contribution (and the informative explanations) of some thread-safety, non-blocking I/O and cleanup patches. You rock dude
|
627
|
-
* Yury Korolev
|
628
|
-
* Aaron Patterson
|
629
|
-
* Mike Perham
|
630
|
-
* Aaron Stone
|
631
|
-
* Kouhei Ueno
|
632
|
-
* John Cant
|
633
|
-
* Justin Case
|
634
|
-
* Tamir Duberstein
|
643
|
+
* [Yury Korolev](http://github.com/yury) - for TONS of help testing the Active Record adapter
|
644
|
+
* [Aaron Patterson](http://github.com/tenderlove) - tons of contributions, suggestions and general badassness
|
645
|
+
* [Mike Perham](http://github.com/mperham) - Async Active Record adapter (uses Fibers and EventMachine)
|
646
|
+
* [Aaron Stone](http://github.com/sodabrew) - additional client settings, local files, microsecond time, maintenance support
|
647
|
+
* [Kouhei Ueno](https://github.com/nyaxt) - for the original work on Prepared Statements way back in 2012
|
648
|
+
* [John Cant](http://github.com/johncant) - polishing and updating Prepared Statements support
|
649
|
+
* [Justin Case](http://github.com/justincase) - polishing and updating Prepared Statements support and getting it merged
|
650
|
+
* [Tamir Duberstein](http://github.com/tamird) - for help with timeouts and all around updates and cleanups
|
data/ext/mysql2/client.c
CHANGED
@@ -18,7 +18,8 @@ VALUE cMysql2Client;
|
|
18
18
|
extern VALUE mMysql2, cMysql2Error, cMysql2TimeoutError;
|
19
19
|
static VALUE sym_id, sym_version, sym_header_version, sym_async, sym_symbolize_keys, sym_as, sym_array, sym_stream;
|
20
20
|
static VALUE sym_no_good_index_used, sym_no_index_used, sym_query_was_slow;
|
21
|
-
static ID intern_brackets, intern_merge, intern_merge_bang, intern_new_with_args
|
21
|
+
static ID intern_brackets, intern_merge, intern_merge_bang, intern_new_with_args,
|
22
|
+
intern_current_query_options, intern_read_timeout;
|
22
23
|
|
23
24
|
#define REQUIRE_INITIALIZED(wrapper) \
|
24
25
|
if (!wrapper->initialized) { \
|
@@ -112,7 +113,8 @@ static VALUE rb_set_ssl_mode_option(VALUE self, VALUE setting) {
|
|
112
113
|
#ifdef HAVE_CONST_MYSQL_OPT_SSL_ENFORCE
|
113
114
|
GET_CLIENT(self);
|
114
115
|
int val = NUM2INT( setting );
|
115
|
-
|
116
|
+
// Either MySQL 5.7.3 - 5.7.10, or Connector/C 6.1.3 - 6.1.x
|
117
|
+
if ((version >= 50703 && version < 50711) || (version >= 60103 && version < 60200)) {
|
116
118
|
if (val == SSL_MODE_DISABLED || val == SSL_MODE_REQUIRED) {
|
117
119
|
my_bool b = ( val == SSL_MODE_REQUIRED );
|
118
120
|
int result = mysql_options( wrapper->client, MYSQL_OPT_SSL_ENFORCE, &b );
|
@@ -121,6 +123,9 @@ static VALUE rb_set_ssl_mode_option(VALUE self, VALUE setting) {
|
|
121
123
|
rb_warn( "MySQL client libraries between 5.7.3 and 5.7.10 only support SSL_MODE_DISABLED and SSL_MODE_REQUIRED" );
|
122
124
|
return Qnil;
|
123
125
|
}
|
126
|
+
} else {
|
127
|
+
rb_warn( "Your mysql client library does not support ssl_mode as expected." );
|
128
|
+
return Qnil;
|
124
129
|
}
|
125
130
|
#endif
|
126
131
|
#ifdef FULL_SSL_MODE_SUPPORT
|
@@ -579,7 +584,7 @@ static VALUE rb_mysql_client_async_result(VALUE self) {
|
|
579
584
|
rb_raise_mysql2_error(wrapper);
|
580
585
|
}
|
581
586
|
|
582
|
-
is_streaming = rb_hash_aref(
|
587
|
+
is_streaming = rb_hash_aref(rb_ivar_get(self, intern_current_query_options), sym_stream);
|
583
588
|
if (is_streaming == Qtrue) {
|
584
589
|
result = (MYSQL_RES *)rb_thread_call_without_gvl(nogvl_use_result, wrapper, RUBY_UBF_IO, 0);
|
585
590
|
} else {
|
@@ -596,7 +601,7 @@ static VALUE rb_mysql_client_async_result(VALUE self) {
|
|
596
601
|
}
|
597
602
|
|
598
603
|
// Duplicate the options hash and put the copy in the Result object
|
599
|
-
current = rb_hash_dup(
|
604
|
+
current = rb_hash_dup(rb_ivar_get(self, intern_current_query_options));
|
600
605
|
(void)RB_GC_GUARD(current);
|
601
606
|
Check_Type(current, T_HASH);
|
602
607
|
resultObj = rb_mysql_result_to_obj(self, wrapper->encoding, current, result, Qnil);
|
@@ -639,7 +644,7 @@ static VALUE do_query(void *args) {
|
|
639
644
|
int retval;
|
640
645
|
VALUE read_timeout;
|
641
646
|
|
642
|
-
read_timeout =
|
647
|
+
read_timeout = rb_ivar_get(async_args->self, intern_read_timeout);
|
643
648
|
|
644
649
|
tvp = NULL;
|
645
650
|
if (!NIL_P(read_timeout)) {
|
@@ -767,7 +772,7 @@ static VALUE rb_mysql_query(VALUE self, VALUE sql, VALUE current) {
|
|
767
772
|
|
768
773
|
(void)RB_GC_GUARD(current);
|
769
774
|
Check_Type(current, T_HASH);
|
770
|
-
|
775
|
+
rb_ivar_set(self, intern_current_query_options, current);
|
771
776
|
|
772
777
|
Check_Type(sql, T_STRING);
|
773
778
|
/* ensure the string is in the encoding the connection is expecting */
|
@@ -903,6 +908,11 @@ static VALUE _mysql_client_options(VALUE self, int opt, VALUE value) {
|
|
903
908
|
retval = charval;
|
904
909
|
break;
|
905
910
|
|
911
|
+
case MYSQL_DEFAULT_AUTH:
|
912
|
+
charval = (const char *)StringValueCStr(value);
|
913
|
+
retval = charval;
|
914
|
+
break;
|
915
|
+
|
906
916
|
#ifdef HAVE_CONST_MYSQL_ENABLE_CLEARTEXT_PLUGIN
|
907
917
|
case MYSQL_ENABLE_CLEARTEXT_PLUGIN:
|
908
918
|
boolval = (value == Qfalse ? 0 : 1);
|
@@ -1174,7 +1184,7 @@ static VALUE rb_mysql_client_store_result(VALUE self)
|
|
1174
1184
|
}
|
1175
1185
|
|
1176
1186
|
// Duplicate the options hash and put the copy in the Result object
|
1177
|
-
current = rb_hash_dup(
|
1187
|
+
current = rb_hash_dup(rb_ivar_get(self, intern_current_query_options));
|
1178
1188
|
(void)RB_GC_GUARD(current);
|
1179
1189
|
Check_Type(current, T_HASH);
|
1180
1190
|
resultObj = rb_mysql_result_to_obj(self, wrapper->encoding, current, result, Qnil);
|
@@ -1260,7 +1270,7 @@ static VALUE set_read_timeout(VALUE self, VALUE value) {
|
|
1260
1270
|
/* Set the instance variable here even though _mysql_client_options
|
1261
1271
|
might not succeed, because the timeout is used in other ways
|
1262
1272
|
elsewhere */
|
1263
|
-
|
1273
|
+
rb_ivar_set(self, intern_read_timeout, value);
|
1264
1274
|
return _mysql_client_options(self, MYSQL_OPT_READ_TIMEOUT, value);
|
1265
1275
|
}
|
1266
1276
|
|
@@ -1336,6 +1346,10 @@ static VALUE set_init_command(VALUE self, VALUE value) {
|
|
1336
1346
|
return _mysql_client_options(self, MYSQL_INIT_COMMAND, value);
|
1337
1347
|
}
|
1338
1348
|
|
1349
|
+
static VALUE set_default_auth(VALUE self, VALUE value) {
|
1350
|
+
return _mysql_client_options(self, MYSQL_DEFAULT_AUTH, value);
|
1351
|
+
}
|
1352
|
+
|
1339
1353
|
static VALUE set_enable_cleartext_plugin(VALUE self, VALUE value) {
|
1340
1354
|
#ifdef HAVE_CONST_MYSQL_ENABLE_CLEARTEXT_PLUGIN
|
1341
1355
|
return _mysql_client_options(self, MYSQL_ENABLE_CLEARTEXT_PLUGIN, value);
|
@@ -1437,6 +1451,7 @@ void init_mysql2_client() {
|
|
1437
1451
|
rb_define_private_method(cMysql2Client, "default_file=", set_read_default_file, 1);
|
1438
1452
|
rb_define_private_method(cMysql2Client, "default_group=", set_read_default_group, 1);
|
1439
1453
|
rb_define_private_method(cMysql2Client, "init_command=", set_init_command, 1);
|
1454
|
+
rb_define_private_method(cMysql2Client, "default_auth=", set_default_auth, 1);
|
1440
1455
|
rb_define_private_method(cMysql2Client, "ssl_set", set_ssl_options, 5);
|
1441
1456
|
rb_define_private_method(cMysql2Client, "ssl_mode=", rb_set_ssl_mode_option, 1);
|
1442
1457
|
rb_define_private_method(cMysql2Client, "enable_cleartext_plugin=", set_enable_cleartext_plugin, 1);
|
@@ -1461,6 +1476,8 @@ void init_mysql2_client() {
|
|
1461
1476
|
intern_merge = rb_intern("merge");
|
1462
1477
|
intern_merge_bang = rb_intern("merge!");
|
1463
1478
|
intern_new_with_args = rb_intern("new_with_args");
|
1479
|
+
intern_current_query_options = rb_intern("@current_query_options");
|
1480
|
+
intern_read_timeout = rb_intern("@read_timeout");
|
1464
1481
|
|
1465
1482
|
#ifdef CLIENT_LONG_PASSWORD
|
1466
1483
|
rb_const_set(cMysql2Client, rb_intern("LONG_PASSWORD"),
|
data/ext/mysql2/extconf.rb
CHANGED
@@ -7,7 +7,7 @@ def asplode(lib)
|
|
7
7
|
elsif RUBY_PLATFORM =~ /darwin/
|
8
8
|
abort "-----\n#{lib} is missing. You may need to 'brew install mysql' or 'port install mysql', and try again.\n-----"
|
9
9
|
else
|
10
|
-
abort "-----\n#{lib} is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again.\n-----"
|
10
|
+
abort "-----\n#{lib} is missing. You may need to 'sudo apt-get install libmariadb-dev', 'sudo apt-get install libmysqlclient-dev' or 'sudo yum install mysql-devel', and try again.\n-----"
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -30,7 +30,7 @@ error "gperf generated tables don't work with this execution character set. Plea
|
|
30
30
|
#endif
|
31
31
|
|
32
32
|
struct mysql2_mysql_enc_name_to_rb_map { const char *name; const char *rb_name; };
|
33
|
-
/* maximum key range =
|
33
|
+
/* maximum key range = 71, duplicates = 0 */
|
34
34
|
|
35
35
|
#ifdef __GNUC__
|
36
36
|
__inline
|
@@ -46,32 +46,32 @@ mysql2_mysql_enc_name_to_rb_hash (str, len)
|
|
46
46
|
{
|
47
47
|
static const unsigned char asso_values[] =
|
48
48
|
{
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
0,
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
10, 0,
|
60
|
-
0,
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
49
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
50
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
51
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
52
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
53
|
+
74, 74, 74, 74, 74, 74, 74, 74, 15, 5,
|
54
|
+
0, 74, 5, 25, 40, 10, 20, 50, 74, 74,
|
55
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
56
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
57
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
58
|
+
74, 74, 74, 74, 74, 74, 74, 40, 5, 0,
|
59
|
+
15, 10, 0, 0, 0, 5, 74, 0, 25, 5,
|
60
|
+
0, 5, 74, 74, 20, 5, 5, 0, 74, 45,
|
61
|
+
74, 0, 74, 74, 74, 74, 74, 74, 74, 74,
|
62
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
63
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
64
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
65
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
66
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
67
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
68
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
69
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
70
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
71
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
72
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
73
|
+
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
74
|
+
74, 74, 74, 74, 74, 74
|
75
75
|
};
|
76
76
|
return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]];
|
77
77
|
}
|
@@ -89,11 +89,11 @@ mysql2_mysql_enc_name_to_rb (str, len)
|
|
89
89
|
{
|
90
90
|
enum
|
91
91
|
{
|
92
|
-
TOTAL_KEYWORDS =
|
92
|
+
TOTAL_KEYWORDS = 41,
|
93
93
|
MIN_WORD_LENGTH = 3,
|
94
94
|
MAX_WORD_LENGTH = 8,
|
95
95
|
MIN_HASH_VALUE = 3,
|
96
|
-
MAX_HASH_VALUE =
|
96
|
+
MAX_HASH_VALUE = 73
|
97
97
|
};
|
98
98
|
|
99
99
|
static const struct mysql2_mysql_enc_name_to_rb_map wordlist[] =
|
@@ -101,54 +101,58 @@ mysql2_mysql_enc_name_to_rb (str, len)
|
|
101
101
|
{""}, {""}, {""},
|
102
102
|
{"gbk", "GBK"},
|
103
103
|
{""},
|
104
|
-
{"
|
104
|
+
{"utf32", "UTF-32"},
|
105
105
|
{"gb2312", "GB2312"},
|
106
106
|
{"keybcs2", NULL},
|
107
107
|
{""},
|
108
108
|
{"ucs2", "UTF-16BE"},
|
109
109
|
{"koi8u", "KOI8-R"},
|
110
110
|
{"binary", "ASCII-8BIT"},
|
111
|
-
{"
|
112
|
-
{""},
|
111
|
+
{"utf8mb4", "UTF-8"},
|
112
|
+
{"macroman", "macRoman"},
|
113
113
|
{"ujis", "eucJP-ms"},
|
114
|
-
{"
|
114
|
+
{"greek", "ISO-8859-7"},
|
115
115
|
{"cp1251", "Windows-1251"},
|
116
|
-
{"
|
116
|
+
{"utf16le", "UTF-16LE"},
|
117
117
|
{""},
|
118
118
|
{"sjis", "Shift_JIS"},
|
119
119
|
{"macce", "macCentEuro"},
|
120
|
-
{"
|
120
|
+
{"cp1257", "Windows-1257"},
|
121
|
+
{"eucjpms", "eucJP-ms"},
|
122
|
+
{""},
|
123
|
+
{"utf8", "UTF-8"},
|
124
|
+
{"cp852", "CP852"},
|
125
|
+
{"cp1250", "Windows-1250"},
|
126
|
+
{"gb18030", "GB18030"},
|
121
127
|
{""},
|
122
|
-
{"macroman", "macRoman"},
|
123
|
-
{"dec8", NULL},
|
124
|
-
{"utf32", "UTF-32"},
|
125
|
-
{"latin1", "ISO-8859-1"},
|
126
|
-
{"utf8mb4", "UTF-8"},
|
127
|
-
{"hp8", NULL},
|
128
128
|
{"swe7", NULL},
|
129
|
+
{"koi8r", "KOI8-R"},
|
130
|
+
{"tis620", "TIS-620"},
|
131
|
+
{"geostd8", NULL},
|
132
|
+
{""},
|
133
|
+
{"big5", "Big5"},
|
129
134
|
{"euckr", "EUC-KR"},
|
130
|
-
{"
|
135
|
+
{"latin2", "ISO-8859-2"},
|
131
136
|
{""}, {""},
|
132
|
-
{"
|
133
|
-
{"
|
134
|
-
{"
|
135
|
-
{""},
|
136
|
-
{"
|
137
|
+
{"dec8", NULL},
|
138
|
+
{"cp850", "CP850"},
|
139
|
+
{"latin1", "ISO-8859-1"},
|
140
|
+
{""},
|
141
|
+
{"hp8", NULL},
|
142
|
+
{""},
|
143
|
+
{"utf16", "UTF-16"},
|
137
144
|
{"latin7", "ISO-8859-13"},
|
138
145
|
{""}, {""}, {""},
|
139
146
|
{"ascii", "US-ASCII"},
|
140
|
-
{"
|
141
|
-
{""}, {""},
|
142
|
-
{"big5", "Big5"},
|
143
|
-
{"utf16", "UTF-16"},
|
144
|
-
{"cp1250", "Windows-1250"},
|
145
|
-
{""}, {""}, {""},
|
146
|
-
{"cp850", "CP850"},
|
147
|
-
{"tis620", "TIS-620"},
|
147
|
+
{"cp1256", "Windows-1256"},
|
148
148
|
{""}, {""}, {""},
|
149
149
|
{"cp932", "Windows-31J"},
|
150
|
+
{"hebrew", "ISO-8859-8"},
|
151
|
+
{""}, {""}, {""}, {""},
|
150
152
|
{"latin5", "ISO-8859-9"},
|
151
|
-
{""}, {""}, {""},
|
153
|
+
{""}, {""}, {""},
|
154
|
+
{"cp866", "IBM866"},
|
155
|
+
{""}, {""}, {""}, {""}, {""}, {""}, {""},
|
152
156
|
{"armscii8", NULL}
|
153
157
|
};
|
154
158
|
|