patch-ext_mysql_api_mysql_c 1016 B

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