aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-devtools/perl/libdbd-mysql-perl/0001-Use-API-function-for-reconnect.patch
blob: 60d88c3d1ab2cb5f759fe239357c03dfcf7c73ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From edb6b202b7e233864aa5dd84532646c50097b0b8 Mon Sep 17 00:00:00 2001
From: Mingli Yu <mingli.yu@windriver.com>
Date: Mon, 4 Mar 2019 00:49:17 -0800
Subject: [PATCH] Use API function for reconnect

For configuring reconnect functionality use standard API function
MYSQL_OPT_RECONNECT instead of direct modification of internal structures
which does not work for MariaDB. Fixes compilation with MariaDB 10.2.6+.

Upstream-Status: Backport [https://github.com/perl5-dbi/DBD-mysql/commit/0b1884f4153d3de0a91bae4d3b3cc1771ffdf4f3]

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 dbdimp.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/dbdimp.c b/dbdimp.c
index 9b8b313..3bed213 100644
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -1979,6 +1979,16 @@ MYSQL *mysql_dr_connect(
 
     if (result)
     {
+      /*
+        we turn off Mysql's auto reconnect and handle re-connecting ourselves
+        so that we can keep track of when this happens.
+      */
+#if MYSQL_VERSION_ID >= 50013
+      my_bool reconnect = FALSE;
+      mysql_options(result, MYSQL_OPT_RECONNECT, &reconnect);
+#else
+      result->reconnect = 0;
+#endif
 #if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION
       /* connection succeeded. */
       /* imp_dbh == NULL when mysql_dr_connect() is called from mysql.xs
@@ -1992,12 +2002,6 @@ MYSQL *mysql_dr_connect(
           imp_dbh->async_query_in_flight = NULL;
       }
 #endif
-
-      /*
-        we turn off Mysql's auto reconnect and handle re-connecting ourselves
-        so that we can keep track of when this happens.
-      */
-      result->reconnect=0;
     }
     else {
       /* 
-- 
2.17.1