Skip to content

MariaDB client support #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ext/mysql2/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,7 @@ static VALUE initialize_ext(VALUE self) {
}

void init_mysql2_client() {
#ifdef _WIN32
/* verify the libmysql we're about to use was the version we were built against
https://github.com/luislavena/mysql-gem/commit/a600a9c459597da0712f70f43736e24b484f8a99 */
int i;
Expand All @@ -1238,6 +1239,7 @@ void init_mysql2_client() {
return;
}
}
#endif

/* Initializing mysql library, so different threads could call Client.new */
/* without race condition in the library */
Expand Down Expand Up @@ -1307,6 +1309,10 @@ void init_mysql2_client() {
#ifdef CLIENT_LONG_PASSWORD
rb_const_set(cMysql2Client, rb_intern("LONG_PASSWORD"),
LONG2NUM(CLIENT_LONG_PASSWORD));
#else
/* HACK because MariaDB 10.2 no longer defines this constant,
* but we're using it in our default connection flags. */
rb_const_set(cMysql2Client, rb_intern("LONG_PASSWORD"), INT2NUM(0));
#endif

#ifdef CLIENT_FOUND_ROWS
Expand Down
2 changes: 1 addition & 1 deletion ext/mysql2/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def asplode lib
/usr/local/lib/mysql5
].map{|dir| "#{dir}/bin" }

GLOB = "{#{dirs.join(',')}}/{mysql_config,mysql_config5}"
GLOB = "{#{dirs.join(',')}}/{mysql_config,mysql_config5,mariadb_config}"

# If the user has provided a --with-mysql-dir argument, we must respect it or fail.
inc, lib = dir_config('mysql')
Expand Down
2 changes: 1 addition & 1 deletion ext/mysql2/result.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ static VALUE rb_mysql_result_fetch_row(VALUE self, ID db_timezone, ID app_timezo
break;
}
msec = msec_char_to_uint(msec_char, sizeof(msec_char));
val = rb_funcall(rb_cTime, db_timezone, 6, opt_time_year, opt_time_month, opt_time_month, UINT2NUM(hour), UINT2NUM(min), UINT2NUM(sec), UINT2NUM(msec));
val = rb_funcall(rb_cTime, db_timezone, 7, opt_time_year, opt_time_month, opt_time_month, UINT2NUM(hour), UINT2NUM(min), UINT2NUM(sec), UINT2NUM(msec));
if (!NIL_P(app_timezone)) {
if (app_timezone == intern_local) {
val = rb_funcall(val, intern_localtime, 0);
Expand Down