Skip to content

Commit b724de1

Browse files
author
Lucca Kaiser
committed
Fix mysql2 0.5.5 compatibility issue:
- mysql2 introduces new data type, which led to 'wrong argument type Mysql2::Client (expected Data)' - mysql_client_wrapper struct updated too
1 parent f1f190b commit b724de1

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

ext/mysql_blob_streaming/mysql_blob_streaming.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,24 @@
1515

1616
typedef struct {
1717
VALUE encoding;
18-
VALUE active_thread;
18+
VALUE active_fiber; /* rb_fiber_current() or Qnil */
1919
long server_version;
2020
int reconnect_enabled;
21-
int connect_timeout;
21+
unsigned int connect_timeout;
2222
int active;
23-
int connected;
23+
int automatic_close;
2424
int initialized;
2525
int refcount;
26-
int freed;
26+
int closed;
2727
MYSQL *client;
2828
} mysql_client_wrapper;
2929

30+
extern const rb_data_type_t rb_mysql_client_type;
3031

3132
static MYSQL * mysql_connection(VALUE rb_mysql2_client)
3233
{
3334
mysql_client_wrapper *wrapper;
34-
Data_Get_Struct(rb_mysql2_client, mysql_client_wrapper, wrapper);
35+
TypedData_Get_Struct(rb_mysql2_client, mysql_client_wrapper, &rb_mysql_client_type, wrapper);
3536
return wrapper->client;
3637
}
3738

mysql_blob_streaming.gemspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Gem::Specification.new do |spec|
1313
EOF
1414
spec.license = 'MIT'
1515

16-
spec.add_dependency 'mysql2', ">= 0.4.4", "< 0.6.0"
17-
spec.required_ruby_version = '>=2.0.0'
16+
spec.add_dependency "mysql2", ">= 0.5.5"
17+
spec.required_ruby_version = "">= 2.0.0"
1818
1919
spec.files = Dir["lib/**/*.rb", "ext/**/*.{c,h,rb}", "README.markdown"]
2020
spec.extensions = ['ext/mysql_blob_streaming/extconf.rb']

0 commit comments

Comments
 (0)