mysql2 0.5.0-x86-mingw32 → 0.5.1-x86-mingw32
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.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/ext/mysql2/extconf.rb +1 -0
- data/ext/mysql2/statement.c +33 -11
- data/lib/mysql2/2.0/mysql2.so +0 -0
- data/lib/mysql2/2.1/mysql2.so +0 -0
- 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/mysql2.rb +2 -0
- data/lib/mysql2/version.rb +1 -1
- data/spec/mysql2/statement_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b22531a4167fc8f203ecf0bc350964e919f297359b82d26024f562534184a66a
|
4
|
+
data.tar.gz: 5dd9267a3c8b147b48d686a7db578cc9b465481d6c16b68614c1419f0ea425b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 964e6efd16b1cb22c9ff916d428a0734c4c5efcd1d499e5a3dad708cb9641a188738fa3df1e720b5325154bf2cef15586a9410a08a650b064ef48f1fcc3923cd
|
7
|
+
data.tar.gz: cefb886890d8942deffd4a7cdb79d9aff8eb58e8dd3edfb6f80fd2883af6e7175b02d776019774f9cf0bc644174148790121a60433092e897933a42255a79209
|
data/README.md
CHANGED
@@ -178,6 +178,9 @@ Pass your arguments to the execute method in the same number and order as the
|
|
178
178
|
question marks in the statement. Query options can be passed as keyword arguments
|
179
179
|
to the execute method.
|
180
180
|
|
181
|
+
Be sure to read about the known limitations of prepared statements at
|
182
|
+
https://dev.mysql.com/doc/refman/5.6/en/c-api-prepared-statement-problems.html
|
183
|
+
|
181
184
|
``` ruby
|
182
185
|
statement = @client.prepare("SELECT * FROM users WHERE login_count = ?")
|
183
186
|
result1 = statement.execute(1)
|
@@ -534,6 +537,7 @@ This gem is tested with the following MySQL and MariaDB versions:
|
|
534
537
|
|
535
538
|
### Ruby on Rails / Active Record
|
536
539
|
|
540
|
+
* mysql2 0.5.x works with Rails / Active Record 5.0.7, 5.1.6, and higher.
|
537
541
|
* mysql2 0.4.x works with Rails / Active Record 4.2.5 - 5.0 and higher.
|
538
542
|
* mysql2 0.3.x works with Rails / Active Record 3.1, 3.2, 4.x, 5.0.
|
539
543
|
* mysql2 0.2.x works with Rails / Active Record 2.3 - 3.0.
|
data/ext/mysql2/extconf.rb
CHANGED
@@ -63,6 +63,7 @@ if inc && lib
|
|
63
63
|
abort "-----\nCannot find library dir(s) #{lib}\n-----" unless lib && lib.split(File::PATH_SEPARATOR).any? { |dir| File.directory?(dir) }
|
64
64
|
warn "-----\nUsing --with-mysql-dir=#{File.dirname inc}\n-----"
|
65
65
|
rpath_dir = lib
|
66
|
+
have_library('mysqlclient')
|
66
67
|
elsif (mc = (with_config('mysql-config') || Dir[GLOB].first))
|
67
68
|
# If the user has provided a --with-mysql-config argument, we must respect it or fail.
|
68
69
|
# If the user gave --with-mysql-config with no argument means we should try to find it.
|
data/ext/mysql2/statement.c
CHANGED
@@ -403,6 +403,39 @@ static VALUE rb_mysql_stmt_execute(int argc, VALUE *argv, VALUE self) {
|
|
403
403
|
}
|
404
404
|
}
|
405
405
|
|
406
|
+
// Duplicate the options hash, merge! extra opts, put the copy into the Result object
|
407
|
+
current = rb_hash_dup(rb_iv_get(stmt_wrapper->client, "@query_options"));
|
408
|
+
(void)RB_GC_GUARD(current);
|
409
|
+
Check_Type(current, T_HASH);
|
410
|
+
|
411
|
+
// Merge in hash opts/keyword arguments
|
412
|
+
if (!NIL_P(opts)) {
|
413
|
+
rb_funcall(current, intern_merge_bang, 1, opts);
|
414
|
+
}
|
415
|
+
|
416
|
+
is_streaming = (Qtrue == rb_hash_aref(current, sym_stream));
|
417
|
+
|
418
|
+
// From stmt_execute to mysql_stmt_result_metadata to stmt_store_result, no
|
419
|
+
// Ruby API calls are allowed so that GC is not invoked. If the connection is
|
420
|
+
// in results-streaming-mode for Statement A, and in the middle Statement B
|
421
|
+
// gets garbage collected, a message will be sent to the server notifying it
|
422
|
+
// to release Statement B, resulting in the following error:
|
423
|
+
// Commands out of sync; you can't run this command now
|
424
|
+
//
|
425
|
+
// In streaming mode, statement execute must return a cursor because we
|
426
|
+
// cannot prevent other Statement objects from being garbage collected
|
427
|
+
// between fetches of each row of the result set. The following error
|
428
|
+
// occurs if cursor mode is not set:
|
429
|
+
// Row retrieval was canceled by mysql_stmt_close
|
430
|
+
|
431
|
+
if (is_streaming) {
|
432
|
+
unsigned long type = CURSOR_TYPE_READ_ONLY;
|
433
|
+
if (mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, &type)) {
|
434
|
+
FREE_BINDS;
|
435
|
+
rb_raise(cMysql2Error, "Unable to stream prepared statement, could not set CURSOR_TYPE_READ_ONLY");
|
436
|
+
}
|
437
|
+
}
|
438
|
+
|
406
439
|
if ((VALUE)rb_thread_call_without_gvl(nogvl_stmt_execute, stmt, RUBY_UBF_IO, 0) == Qfalse) {
|
407
440
|
FREE_BINDS;
|
408
441
|
rb_raise_mysql2_stmt_error(stmt_wrapper);
|
@@ -421,17 +454,6 @@ static VALUE rb_mysql_stmt_execute(int argc, VALUE *argv, VALUE self) {
|
|
421
454
|
return Qnil;
|
422
455
|
}
|
423
456
|
|
424
|
-
// Duplicate the options hash, merge! extra opts, put the copy into the Result object
|
425
|
-
current = rb_hash_dup(rb_iv_get(stmt_wrapper->client, "@query_options"));
|
426
|
-
(void)RB_GC_GUARD(current);
|
427
|
-
Check_Type(current, T_HASH);
|
428
|
-
|
429
|
-
// Merge in hash opts/keyword arguments
|
430
|
-
if (!NIL_P(opts)) {
|
431
|
-
rb_funcall(current, intern_merge_bang, 1, opts);
|
432
|
-
}
|
433
|
-
|
434
|
-
is_streaming = (Qtrue == rb_hash_aref(current, sym_stream));
|
435
457
|
if (!is_streaming) {
|
436
458
|
// recieve the whole result set from the server
|
437
459
|
if (mysql_stmt_store_result(stmt)) {
|
data/lib/mysql2/2.0/mysql2.so
CHANGED
Binary file
|
data/lib/mysql2/2.1/mysql2.so
CHANGED
Binary file
|
data/lib/mysql2/2.2/mysql2.so
CHANGED
Binary file
|
data/lib/mysql2/2.3/mysql2.so
CHANGED
Binary file
|
data/lib/mysql2/2.4/mysql2.so
CHANGED
Binary file
|
data/lib/mysql2/2.5/mysql2.so
CHANGED
Binary file
|
data/lib/mysql2/mysql2.rb
CHANGED
data/lib/mysql2/version.rb
CHANGED
@@ -6,6 +6,10 @@ RSpec.describe Mysql2::Statement do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def stmt_count
|
9
|
+
# Use the performance schema in MySQL 5.7 and above
|
10
|
+
@client.query("SELECT COUNT(1) AS count FROM performance_schema.prepared_statements_instances").first['count'].to_i
|
11
|
+
rescue Mysql2::Error
|
12
|
+
# Fall back to the global prepapred statement counter
|
9
13
|
@client.query("SHOW STATUS LIKE 'Prepared_stmt_count'").first['Value'].to_i
|
10
14
|
end
|
11
15
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mysql2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Brian Lopez
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-04-11 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|