summaryrefslogtreecommitdiff
path: root/dev-db/mysql-connector-c++/files/mysql-connector-c++-8.0.25-fix-mysqlclient-static-binding.patch
blob: f211f113f04a0148be7a1765ab110eb6d8c3a9ac (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
From 774d7bd983a2e12e78a0231c7936a9481bb3df1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lu=C3=ADs=20Silva?= <luis.m.silva@oracle.com>
Date: Thu, 13 May 2021 23:14:57 +0100
Subject: [PATCH] Bug #32882344: FIX MYSQLCLIENT_STATIC_BINDING=0 BUILD

---
 driver/nativeapi/libmysql_dynamic_proxy.cpp |  13 ++
 driver/nativeapi/libmysql_dynamic_proxy.h   | 132 ++++++++++----------
 driver/nativeapi/mysql_client_api.h         |   2 +
 3 files changed, 83 insertions(+), 64 deletions(-)

diff --git a/driver/nativeapi/libmysql_dynamic_proxy.cpp b/driver/nativeapi/libmysql_dynamic_proxy.cpp
index 4c70074e..9bd4bd99 100644
--- a/jdbc/driver/nativeapi/libmysql_dynamic_proxy.cpp
+++ b/jdbc/driver/nativeapi/libmysql_dynamic_proxy.cpp
@@ -512,6 +512,19 @@ LibmysqlDynamicProxy::real_connect_dns_srv(MYSQL * mysql,
 /* }}} */
 
 
+/* {{{ LibmysqlDynamicProxy::bind_param() */
+bool
+LibmysqlDynamicProxy::bind_param(MYSQL *mysql, unsigned n_params,
+                                 MYSQL_BIND *binds, const char **names)
+{
+  ptr2mysql_bind_param ptr2_bind_param=
+    symbol_safe_cast<ptr2mysql_bind_param>(GetProcAddr("mysql_bind_param"));
+
+  return (*ptr2_bind_param)(mysql, n_params, binds, names);
+}
+/* }}} */
+
+
 /* {{{ LibmysqlDynamicProxy::real_escape_string() */
 unsigned long
 LibmysqlDynamicProxy::real_escape_string(MYSQL * mysql, char * to, const char * from, unsigned long length)
diff --git a/driver/nativeapi/libmysql_dynamic_proxy.h b/driver/nativeapi/libmysql_dynamic_proxy.h
index 93dc9700..e0f00c95 100644
--- a/jdbc/driver/nativeapi/libmysql_dynamic_proxy.h
+++ b/jdbc/driver/nativeapi/libmysql_dynamic_proxy.h
@@ -65,67 +65,67 @@ public:
 
   // MySQL C-API calls wrappers
 
-  my_ulonglong affected_rows(MYSQL *);
+  my_ulonglong affected_rows(MYSQL *) override;
 
-  my_bool autocommit(MYSQL * , my_bool);
+  my_bool autocommit(MYSQL * , my_bool) override;
 
-  void close (MYSQL *mysql);
+  void close (MYSQL *mysql) override;
 
-  my_bool commit(MYSQL *mysql);
+  my_bool commit(MYSQL *mysql) override;
 
-  void data_seek(MYSQL_RES *, my_ulonglong);
+  void data_seek(MYSQL_RES *, my_ulonglong) override;
 
-  void debug(const char *);
+  void debug(const char *) override;
 
-  unsigned int mysql_errno(MYSQL *);
+  unsigned int mysql_errno(MYSQL *) override;
 
-  const char *  error(MYSQL *);
+  const char *  error(MYSQL *) override;
 
-  MYSQL_FIELD * fetch_field(MYSQL_RES *);
+  MYSQL_FIELD * fetch_field(MYSQL_RES *) override;
 
-  MYSQL_FIELD * fetch_field_direct(MYSQL_RES *, unsigned int);
+  MYSQL_FIELD * fetch_field_direct(MYSQL_RES *, unsigned int) override;
 
-  unsigned long * fetch_lengths(MYSQL_RES *);
+  unsigned long * fetch_lengths(MYSQL_RES *) override;
 
-  MYSQL_ROW fetch_row(MYSQL_RES *);
+  MYSQL_ROW fetch_row(MYSQL_RES *) override;
 
-  unsigned int field_count(MYSQL *);
+  unsigned int field_count(MYSQL *) override;
 
-  void free_result(MYSQL_RES *);
+  void free_result(MYSQL_RES *) override;
 
-  unsigned long get_client_version();
+  unsigned long get_client_version() override;
 
-  const char *  get_server_info(MYSQL *);
+  const char *  get_server_info(MYSQL *) override;
 
-  unsigned long get_server_version(MYSQL *);
+  unsigned long get_server_version(MYSQL *) override;
 
-  void get_character_set_info(MYSQL *, void *);
+  void get_character_set_info(MYSQL *, void *) override;
 
-  const char * info(MYSQL *);
+  const char * info(MYSQL *) override;
 
-  MYSQL * init(MYSQL *mysql);
+  MYSQL * init(MYSQL *mysql) override;
 
-  int library_init(int, char **, char **);
+  int library_init(int, char **, char **) override;
 
-  void library_end();
+  void library_end() override;
 
-  my_bool more_results(MYSQL *);
+  my_bool more_results(MYSQL *) override;
 
-  int next_result(MYSQL *);
+  int next_result(MYSQL *) override;
 
-  unsigned int num_fields(MYSQL_RES *);
+  unsigned int num_fields(MYSQL_RES *) override;
 
-  my_ulonglong num_rows(MYSQL_RES *);
+  my_ulonglong num_rows(MYSQL_RES *) override;
 
-  int options (MYSQL *, enum mysql_option, const void *);
+  int options (MYSQL *, enum mysql_option, const void *) override;
 
-  int options (MYSQL *, enum mysql_option, const void *, const void *);
+  int options (MYSQL *, enum mysql_option, const void *, const void *) override;
 
-  int get_option (MYSQL *, enum mysql_option, const void *);
+  int get_option (MYSQL *, enum mysql_option, const void *) override;
 
-  int ping(MYSQL *);
+  int ping(MYSQL *) override;
 
-  int query(MYSQL *, const char *);
+  int query(MYSQL *, const char *) override;
 
   MYSQL * real_connect(MYSQL * mysql, const char *  host,
               const char *  user,
@@ -133,82 +133,86 @@ public:
               const char *  db,
               unsigned int  port,
               const char *  unix_socket,
-              unsigned long client_flag);
+              unsigned long client_flag) override;
 
   MYSQL * real_connect_dns_srv(MYSQL * mysql,
               const char *  host,
               const char *  user,
               const char *  passwd,
               const char *  db,
-              unsigned long client_flag);
+              unsigned long client_flag) override;
 
-  unsigned long real_escape_string(MYSQL * mysql, char * to, const char * from, unsigned long length);
+  bool bind_param(MYSQL *mysql, unsigned n_params,
+                  MYSQL_BIND *binds, const char **names) override;
 
-  int real_query(MYSQL *, const char *, unsigned long);
 
-  my_bool rollback(MYSQL *);
+  unsigned long real_escape_string(MYSQL * mysql, char * to, const char * from, unsigned long length) override;
 
-  const char * sqlstate(MYSQL *);
+  int real_query(MYSQL *, const char *, unsigned long) override;
+
+  my_bool rollback(MYSQL *) override;
+
+  const char * sqlstate(MYSQL *) override;
 
   my_bool ssl_set(MYSQL * mysql,
           const char * key,
           const char * cert,
           const char * ca,
           const char * capath,
-          const char * cipher);
+          const char * cipher) override;
 
-  MYSQL_RES * store_result(MYSQL *);
+  MYSQL_RES * store_result(MYSQL *) override;
 
-  MYSQL_RES * use_result(MYSQL *);
+  MYSQL_RES * use_result(MYSQL *) override;
 
-  unsigned int warning_count(MYSQL *);
+  unsigned int warning_count(MYSQL *) override;
 
   /* Prepared Statement stmt_* functions */
-  my_ulonglong  stmt_affected_rows  (MYSQL_STMT *);
+  my_ulonglong  stmt_affected_rows  (MYSQL_STMT *) override;
 
-  my_bool stmt_attr_set(MYSQL_STMT *, enum enum_stmt_attr_type, const void *);
+  my_bool stmt_attr_set(MYSQL_STMT *, enum enum_stmt_attr_type, const void *) override;
 
-  my_bool stmt_bind_param(MYSQL_STMT *, MYSQL_BIND *);
+  my_bool stmt_bind_param(MYSQL_STMT *, MYSQL_BIND *) override;
 
-  my_bool stmt_bind_result(MYSQL_STMT *, MYSQL_BIND *);
+  my_bool stmt_bind_result(MYSQL_STMT *, MYSQL_BIND *) override;
 
-  my_bool stmt_close(MYSQL_STMT *);
+  my_bool stmt_close(MYSQL_STMT *) override;
 
-  void stmt_data_seek(MYSQL_STMT *, my_ulonglong);
+  void stmt_data_seek(MYSQL_STMT *, my_ulonglong) override;
 
-  unsigned int stmt_errno(MYSQL_STMT *);
+  unsigned int stmt_errno(MYSQL_STMT *) override;
 
-  const char * stmt_error(MYSQL_STMT *);
+  const char * stmt_error(MYSQL_STMT *) override;
 
-  int stmt_execute(MYSQL_STMT *);
+  int stmt_execute(MYSQL_STMT *) override;
 
-  int stmt_fetch(MYSQL_STMT *);
+  int stmt_fetch(MYSQL_STMT *) override;
 
-  unsigned int stmt_field_count(MYSQL_STMT *);
+  unsigned int stmt_field_count(MYSQL_STMT *) override;
 
-  MYSQL_STMT * stmt_init(MYSQL *);
+  MYSQL_STMT * stmt_init(MYSQL *) override;
 
-  my_ulonglong stmt_num_rows(MYSQL_STMT *);
+  my_ulonglong stmt_num_rows(MYSQL_STMT *) override;
 
-  unsigned long stmt_param_count(MYSQL_STMT *);
+  unsigned long stmt_param_count(MYSQL_STMT *) override;
 
-  int stmt_prepare(MYSQL_STMT *, const char *, unsigned long);
+  int stmt_prepare(MYSQL_STMT *, const char *, unsigned long) override;
 
-  MYSQL_RES * stmt_result_metadata(MYSQL_STMT *);
+  MYSQL_RES * stmt_result_metadata(MYSQL_STMT *) override;
 
-  my_bool stmt_send_long_data (MYSQL_STMT * , unsigned int, const char *, unsigned long);
+  my_bool stmt_send_long_data (MYSQL_STMT * , unsigned int, const char *, unsigned long) override;
 
-  const char * stmt_sqlstate(MYSQL_STMT *);
+  const char * stmt_sqlstate(MYSQL_STMT *) override;
 
-  int stmt_store_result(MYSQL_STMT *);
+  int stmt_store_result(MYSQL_STMT *) override;
 
-  int stmt_next_result(MYSQL_STMT *);
+  int stmt_next_result(MYSQL_STMT *) override;
 
-  bool stmt_free_result(MYSQL_STMT *);
+  bool stmt_free_result(MYSQL_STMT *) override;
 
-  void thread_init();
+  void thread_init() override;
 
-  void thread_end();
+  void thread_end() override;
 };
 
 } /* namespace NativeAPI */
diff --git a/driver/nativeapi/mysql_client_api.h b/driver/nativeapi/mysql_client_api.h
index b738cf9a..fa044c93 100644
--- a/jdbc/driver/nativeapi/mysql_client_api.h
+++ b/jdbc/driver/nativeapi/mysql_client_api.h
@@ -111,6 +111,8 @@ typedef MYSQL * (STDCALL *ptr2mysql_real_connect)(MYSQL *, const char *, const c
 
 typedef MYSQL * (STDCALL *ptr2mysql_real_connect_dns_srv)(MYSQL *, const char *, const char *, const char * , const char *, unsigned long);
 
+typedef bool (STDCALL *ptr2mysql_bind_param)(MYSQL *mysql, unsigned n_params, MYSQL_BIND *binds, const char **names);
+
 typedef unsigned long (STDCALL *ptr2mysql_real_escape_string)(MYSQL * mysql, char *, const char *, unsigned long);
 
 typedef int (STDCALL *ptr2mysql_real_query)(MYSQL *, const char *, unsigned long);
-- 
2.30.2