1234567891011121314151617181920212223242526272829303132 |
- $OpenBSD: patch-ext_mysql_api_mysql_c,v 1.2 2017/01/07 18:09:28 jeremy Exp $
- Allow building with ruby 2.4+.
- --- ext/mysql_api/mysql.c.orig Wed Dec 31 16:00:00 1969
- +++ ext/mysql_api/mysql.c Sat Jan 7 10:06:36 2017
- @@ -3,6 +3,11 @@
- */
-
- #include <ruby.h>
- +#ifdef HAVE_RUBY_ENCODING_H
- +#include <ruby/version.h>
- +#else
- +#define RUBY_API_VERSION_CODE 10807
- +#endif
- #ifndef RSTRING_PTR
- #define RSTRING_PTR(str) RSTRING(str)->ptr
- #endif
- @@ -1317,7 +1322,11 @@ static VALUE stmt_bind_result(int argc, VALUE *argv, V
- }
- else if (argv[i] == rb_cString)
- s->result.bind[i].buffer_type = MYSQL_TYPE_STRING;
- - else if (argv[i] == rb_cNumeric || argv[i] == rb_cInteger || argv[i] == rb_cFixnum)
- + else if (argv[i] == rb_cNumeric || argv[i] == rb_cInteger
- +#if (RUBY_API_VERSION_CODE < 20400)
- + || argv[i] == rb_cFixnum
- +#endif
- + )
- s->result.bind[i].buffer_type = MYSQL_TYPE_LONGLONG;
- else if (argv[i] == rb_cFloat)
- s->result.bind[i].buffer_type = MYSQL_TYPE_DOUBLE;
|