Skip to content

Commit ae94474

Browse files
author
Oleg Belinskyi
committed
make c script compatible for MySql versions befor and after 8v
1 parent 04f53a7 commit ae94474

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,9 @@ This gem lives here https://github.com/infopark/mysql_blob_streaming.
1010

1111
### Compatible changes
1212

13-
- replace deprecated for MySql 8.0 my_bool to bool type in /ext/mysql_blob_streaming/mysql_blob_streaming.c
13+
- add condition to check MySQL version in /ext/mysql_blob_streaming/mysql_blob_streaming.c
14+
#if MYSQL_VERSION_ID >=80000
15+
typedef bool my_bool;
16+
#endif
17+
1418
- remove deprecated 'spec.has_rdoc' from mysql_blob_streaming.gemspec

ext/mysql_blob_streaming/mysql_blob_streaming.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#include <mysql.h>
55
#include <errmsg.h>
66

7+
#if MYSQL_VERSION_ID >=80000
8+
typedef bool my_bool;
9+
#endif
710

811
typedef struct {
912
VALUE encoding;
@@ -112,7 +115,7 @@ static MYSQL_BIND * build_result_bind(MYSQL_STMT *stmt, int buffer_length)
112115
{
113116
MYSQL_BIND *bind = (MYSQL_BIND *)calloc(1, sizeof(MYSQL_BIND));
114117
bind->length = (unsigned long *)calloc(1, sizeof(unsigned long));
115-
bind->is_null = (bool *)calloc(1, sizeof(bool));
118+
bind->is_null = (my_bool *)calloc(1, sizeof(my_bool));
116119
bind->buffer_length = buffer_length;
117120
bind->buffer = malloc(buffer_length);
118121

0 commit comments

Comments
 (0)