Skip to content

Commit 4a2b6cb

Browse files
authored
Merge pull request #28 from basecamp/mariadbclient-support
MariaDB client support
2 parents 84f1db2 + e23d40e commit 4a2b6cb

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

ext/mysql2/client.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,7 @@ static VALUE initialize_ext(VALUE self) {
12211221
}
12221222

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

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

13121318
#ifdef CLIENT_FOUND_ROWS

ext/mysql2/extconf.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def asplode lib
2929
/usr/local/lib/mysql5
3030
].map{|dir| "#{dir}/bin" }
3131

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

3434
# If the user has provided a --with-mysql-dir argument, we must respect it or fail.
3535
inc, lib = dir_config('mysql')

ext/mysql2/result.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static VALUE rb_mysql_result_fetch_row(VALUE self, ID db_timezone, ID app_timezo
297297
break;
298298
}
299299
msec = msec_char_to_uint(msec_char, sizeof(msec_char));
300-
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));
300+
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));
301301
if (!NIL_P(app_timezone)) {
302302
if (app_timezone == intern_local) {
303303
val = rb_funcall(val, intern_localtime, 0);

0 commit comments

Comments
 (0)