| @@ -1,19 +1,34 @@ | | | @@ -1,19 +1,34 @@ |
1 | $NetBSD: patch-mysql.c,v 1.1 2017/10/13 16:07:51 taca Exp $ | | 1 | $NetBSD: patch-mysql.c,v 1.2 2021/02/14 14:55:42 taca Exp $ |
2 | | | 2 | |
3 | * Fix build with ruby24. | | 3 | * Fix build with ruby24 and ruby30. |
4 | | | 4 | |
5 | --- mysql.c.orig 2010-02-11 10:42:54.000000000 +0000 | | 5 | --- mysql.c.orig 2010-02-11 10:42:54.000000000 +0000 |
6 | +++ mysql.c | | 6 | +++ mysql.c |
| | | 7 | @@ -875,12 +875,12 @@ static VALUE stmt_init(VALUE obj) |
| | | 8 | MYSQL *m = GetHandler(obj); |
| | | 9 | MYSQL_STMT *s; |
| | | 10 | struct mysql_stmt* stmt; |
| | | 11 | - my_bool true = 1; |
| | | 12 | + my_bool my_true = 1; |
| | | 13 | VALUE st_obj; |
| | | 14 | |
| | | 15 | if ((s = mysql_stmt_init(m)) == NULL) |
| | | 16 | mysql_raise(m); |
| | | 17 | - if (mysql_stmt_attr_set(s, STMT_ATTR_UPDATE_MAX_LENGTH, &true)) |
| | | 18 | + if (mysql_stmt_attr_set(s, STMT_ATTR_UPDATE_MAX_LENGTH, &my_true)) |
| | | 19 | rb_raise(rb_eArgError, "mysql_stmt_attr_set() failed"); |
| | | 20 | st_obj = Data_Make_Struct(cMysqlStmt, struct mysql_stmt, 0, free_mysqlstmt, stmt); |
| | | 21 | memset(stmt, 0, sizeof(*stmt)); |
7 | @@ -1317,7 +1317,11 @@ static VALUE stmt_bind_result(int argc, | | 22 | @@ -1317,7 +1317,11 @@ static VALUE stmt_bind_result(int argc, |
8 | } | | 23 | } |
9 | else if (argv[i] == rb_cString) | | 24 | else if (argv[i] == rb_cString) |
10 | s->result.bind[i].buffer_type = MYSQL_TYPE_STRING; | | 25 | s->result.bind[i].buffer_type = MYSQL_TYPE_STRING; |
11 | - else if (argv[i] == rb_cNumeric || argv[i] == rb_cInteger || argv[i] == rb_cFixnum) | | 26 | - else if (argv[i] == rb_cNumeric || argv[i] == rb_cInteger || argv[i] == rb_cFixnum) |
12 | + else if (argv[i] == rb_cNumeric || argv[i] == rb_cInteger | | 27 | + else if (argv[i] == rb_cNumeric || argv[i] == rb_cInteger |
13 | +#if RUBY_API_VERSION_MAJOR >=2 && RUBY_API_VERSION_MINOR < 4 | | 28 | +#if RUBY_API_VERSION_MAJOR >=2 && RUBY_API_VERSION_MINOR < 4 |
14 | + || argv[i] == rb_cFixnum | | 29 | + || argv[i] == rb_cFixnum |
15 | +#endif | | 30 | +#endif |
16 | + ) | | 31 | + ) |
17 | s->result.bind[i].buffer_type = MYSQL_TYPE_LONGLONG; | | 32 | s->result.bind[i].buffer_type = MYSQL_TYPE_LONGLONG; |
18 | else if (argv[i] == rb_cFloat) | | 33 | else if (argv[i] == rb_cFloat) |
19 | s->result.bind[i].buffer_type = MYSQL_TYPE_DOUBLE; | | 34 | s->result.bind[i].buffer_type = MYSQL_TYPE_DOUBLE; |