@@ -114,7 +114,7 @@ static VALUE rb_set_ssl_mode_option(VALUE self, VALUE setting) {
114
114
int val = NUM2INT ( setting );
115
115
if (version >= 50703 && version < 50711 ) {
116
116
if (val == SSL_MODE_DISABLED || val == SSL_MODE_REQUIRED ) {
117
- bool b = ( val == SSL_MODE_REQUIRED );
117
+ my_bool b = ( val == SSL_MODE_REQUIRED );
118
118
int result = mysql_options ( wrapper -> client , MYSQL_OPT_SSL_ENFORCE , & b );
119
119
return INT2NUM (result );
120
120
} else {
@@ -526,7 +526,7 @@ static VALUE do_send_query(void *args) {
526
526
*/
527
527
static void * nogvl_read_query_result (void * ptr ) {
528
528
MYSQL * client = ptr ;
529
- bool res = mysql_read_query_result (client );
529
+ my_bool res = mysql_read_query_result (client );
530
530
531
531
return (void * )(res == 0 ? Qtrue : Qfalse );
532
532
}
@@ -846,7 +846,7 @@ static VALUE _mysql_client_options(VALUE self, int opt, VALUE value) {
846
846
const void * retval = NULL ;
847
847
unsigned int intval = 0 ;
848
848
const char * charval = NULL ;
849
- bool boolval ;
849
+ my_bool boolval ;
850
850
851
851
GET_CLIENT (self );
852
852
@@ -1098,6 +1098,23 @@ static VALUE rb_mysql_client_ping(VALUE self) {
1098
1098
}
1099
1099
}
1100
1100
1101
+ /* call-seq:
1102
+ * client.set_server_option(value)
1103
+ *
1104
+ * Enables or disables an option for the connection.
1105
+ * Read https://dev.mysql.com/doc/refman/5.7/en/mysql-set-server-option.html
1106
+ * for more information.
1107
+ */
1108
+ static VALUE rb_mysql_client_set_server_option (VALUE self , VALUE value ) {
1109
+ GET_CLIENT (self );
1110
+
1111
+ if (mysql_set_server_option (wrapper -> client , NUM2INT (value )) == 0 ) {
1112
+ return Qtrue ;
1113
+ } else {
1114
+ return Qfalse ;
1115
+ }
1116
+ }
1117
+
1101
1118
/* call-seq:
1102
1119
* client.more_results?
1103
1120
*
@@ -1399,6 +1416,7 @@ void init_mysql2_client() {
1399
1416
rb_define_method (cMysql2Client , "thread_id" , rb_mysql_client_thread_id , 0 );
1400
1417
rb_define_method (cMysql2Client , "ping" , rb_mysql_client_ping , 0 );
1401
1418
rb_define_method (cMysql2Client , "select_db" , rb_mysql_client_select_db , 1 );
1419
+ rb_define_method (cMysql2Client , "set_server_option" , rb_mysql_client_set_server_option , 1 );
1402
1420
rb_define_method (cMysql2Client , "more_results?" , rb_mysql_client_more_results , 0 );
1403
1421
rb_define_method (cMysql2Client , "next_result" , rb_mysql_client_next_result , 0 );
1404
1422
rb_define_method (cMysql2Client , "store_result" , rb_mysql_client_store_result , 0 );
@@ -1528,6 +1546,16 @@ void init_mysql2_client() {
1528
1546
rb_const_set (cMysql2Client , rb_intern ("SECURE_CONNECTION" ), LONG2NUM (0 ));
1529
1547
#endif
1530
1548
1549
+ #ifdef HAVE_CONST_MYSQL_OPTION_MULTI_STATEMENTS_ON
1550
+ rb_const_set (cMysql2Client , rb_intern ("OPTION_MULTI_STATEMENTS_ON" ),
1551
+ LONG2NUM (MYSQL_OPTION_MULTI_STATEMENTS_ON ));
1552
+ #endif
1553
+
1554
+ #ifdef HAVE_CONST_MYSQL_OPTION_MULTI_STATEMENTS_OFF
1555
+ rb_const_set (cMysql2Client , rb_intern ("OPTION_MULTI_STATEMENTS_OFF" ),
1556
+ LONG2NUM (MYSQL_OPTION_MULTI_STATEMENTS_OFF ));
1557
+ #endif
1558
+
1531
1559
#ifdef CLIENT_MULTI_STATEMENTS
1532
1560
rb_const_set (cMysql2Client , rb_intern ("MULTI_STATEMENTS" ),
1533
1561
LONG2NUM (CLIENT_MULTI_STATEMENTS ));
0 commit comments