0001-Use-net_buffer_length-macro-if-available.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From 9189ef77679c22de3bbd2142031858373236520b Mon Sep 17 00:00:00 2001
  2. From: Michiel Beijen <michiel.beijen@gmail.com>
  3. Date: Fri, 23 Feb 2018 07:52:33 +0000
  4. Subject: [PATCH] Use net_buffer_length macro if available
  5. Upstream: https://github.com/perl5-dbi/DBD-mysql/commit/0f0cebe87fab335873fd3701bc304922da826940
  6. (cherry picked from commit 0f0cebe87fab335873fd3701bc304922da826940)
  7. Signed-off-by: Romain Naour <romain.naour@smile.fr>
  8. ---
  9. mysql.xs | 11 +++++------
  10. 1 file changed, 5 insertions(+), 6 deletions(-)
  11. diff --git a/mysql.xs b/mysql.xs
  12. index 8edee55..9b4d60f 100644
  13. --- a/mysql.xs
  14. +++ b/mysql.xs
  15. @@ -819,15 +819,14 @@ dbd_mysql_get_info(dbh, sql_info_type)
  16. retsv = newSVpvn("`", 1);
  17. break;
  18. case SQL_MAXIMUM_STATEMENT_LENGTH:
  19. -#if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50709
  20. - /* MariaDB 10 is not MySQL source level compatible so this
  21. - only applies to MySQL*/
  22. - /* mysql_get_option() was added in mysql 5.7.3 */
  23. - /* MYSQL_OPT_NET_BUFFER_LENGTH was added in mysql 5.7.9 */
  24. + /* net_buffer_length macro is not defined in MySQL 5.7 and some MariaDB
  25. + versions - if it is not available, use newer mysql_get_option */
  26. +#if !defined(net_buffer_length)
  27. + ;
  28. + unsigned long buffer_len;
  29. mysql_get_option(NULL, MYSQL_OPT_NET_BUFFER_LENGTH, &buffer_len);
  30. retsv = newSViv(buffer_len);
  31. #else
  32. - /* before mysql 5.7.9 use net_buffer_length macro */
  33. retsv = newSViv(net_buffer_length);
  34. #endif
  35. break;
  36. --
  37. 2.44.0