Skip to content

Commit 62b57ea

Browse files
committed
Revert "Use bool instead of my_bool which has been removed since MySQL 8.0.1 (#840)"
This reverts commit 5889d04.
1 parent a2440a7 commit 62b57ea

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

ext/mysql2/client.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static VALUE rb_set_ssl_mode_option(VALUE self, VALUE setting) {
114114
int val = NUM2INT( setting );
115115
if (version >= 50703 && version < 50711) {
116116
if (val == SSL_MODE_DISABLED || val == SSL_MODE_REQUIRED) {
117-
bool b = ( val == SSL_MODE_REQUIRED );
117+
my_bool b = ( val == SSL_MODE_REQUIRED );
118118
int result = mysql_options( wrapper->client, MYSQL_OPT_SSL_ENFORCE, &b );
119119
return INT2NUM(result);
120120
} else {
@@ -526,7 +526,7 @@ static VALUE do_send_query(void *args) {
526526
*/
527527
static void *nogvl_read_query_result(void *ptr) {
528528
MYSQL * client = ptr;
529-
bool res = mysql_read_query_result(client);
529+
my_bool res = mysql_read_query_result(client);
530530

531531
return (void *)(res == 0 ? Qtrue : Qfalse);
532532
}
@@ -846,7 +846,7 @@ static VALUE _mysql_client_options(VALUE self, int opt, VALUE value) {
846846
const void *retval = NULL;
847847
unsigned int intval = 0;
848848
const char * charval = NULL;
849-
bool boolval;
849+
my_bool boolval;
850850

851851
GET_CLIENT(self);
852852

ext/mysql2/result.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ static void rb_mysql_result_alloc_result_buffers(VALUE self, MYSQL_FIELD *fields
218218
if (wrapper->result_buffers != NULL) return;
219219

220220
wrapper->result_buffers = xcalloc(wrapper->numberOfFields, sizeof(MYSQL_BIND));
221-
wrapper->is_null = xcalloc(wrapper->numberOfFields, sizeof(bool));
222-
wrapper->error = xcalloc(wrapper->numberOfFields, sizeof(bool));
221+
wrapper->is_null = xcalloc(wrapper->numberOfFields, sizeof(my_bool));
222+
wrapper->error = xcalloc(wrapper->numberOfFields, sizeof(my_bool));
223223
wrapper->length = xcalloc(wrapper->numberOfFields, sizeof(unsigned long));
224224

225225
for (i = 0; i < wrapper->numberOfFields; i++) {

ext/mysql2/result.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#ifndef MYSQL2_RESULT_H
22
#define MYSQL2_RESULT_H
3-
#include <stdbool.h>
43

54
void init_mysql2_result(void);
65
VALUE rb_mysql_result_to_obj(VALUE client, VALUE encoding, VALUE options, MYSQL_RES *r, VALUE statement);
@@ -22,8 +21,8 @@ typedef struct {
2221
mysql_client_wrapper *client_wrapper;
2322
/* statement result bind buffers */
2423
MYSQL_BIND *result_buffers;
25-
bool *is_null;
26-
bool *error;
24+
my_bool *is_null;
25+
my_bool *error;
2726
unsigned long *length;
2827
} mysql2_result_wrapper;
2928

ext/mysql2/statement.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ VALUE rb_mysql_stmt_new(VALUE rb_client, VALUE sql) {
115115

116116
// set STMT_ATTR_UPDATE_MAX_LENGTH attr
117117
{
118-
bool truth = 1;
118+
my_bool truth = 1;
119119
if (mysql_stmt_attr_set(stmt_wrapper->stmt, STMT_ATTR_UPDATE_MAX_LENGTH, &truth)) {
120120
rb_raise(cMysql2Error, "Unable to initialize prepared statement: set STMT_ATTR_UPDATE_MAX_LENGTH");
121121
}

0 commit comments

Comments
 (0)