Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

Commit 98cf9be

Browse files
jkedgarHerman Lee
authored andcommitted
Access internals
Summary: The FB MySQL client needs access to some internals that are not otherwise available when using the nonblocking API. This diff makes the following changes for this purpose: - Make the mysql_async.h header file available publicly (needed for access to the NET_ASYNC_DATA() macro) - Modify the typedef for the NET_EXTENSION structure. The existing method works fine in C but fails in C++, so fix this so we can include the file in C++. - Make the mysql_get_socket_descriptor() function public. This is done by moving it to the mysql.h file. This function was named mysql_get_file_descriptor in 8.0.4. Differential Revision: D20429899
1 parent 0f97b43 commit 98cf9be

6 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎include/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ SET(HEADERS
3434
my_compress.h
3535
my_list.h
3636
mysql.h
37+
mysql_async.h
3738
mysql_com.h
3839
mysql_time.h
3940
${CMAKE_CURRENT_BINARY_DIR}/mysql_version.h

‎include/mysql.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ enum net_async_status STDCALL mysql_next_result_nonblocking(MYSQL *mysql);
516516
enum net_async_status STDCALL mysql_select_db_nonblocking(MYSQL *mysql,
517517
const char *db,
518518
bool *error);
519+
int STDCALL mysql_get_socket_descriptor(MYSQL *mysql);
519520
void STDCALL mysql_get_character_set_info(MYSQL *mysql,
520521
MY_CHARSET_INFO *charset);
521522

‎include/mysql.h.pp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@
670670
enum net_async_status mysql_select_db_nonblocking(MYSQL *mysql,
671671
const char *db,
672672
bool *error);
673+
int mysql_get_socket_descriptor(MYSQL *mysql);
673674
void mysql_get_character_set_info(MYSQL *mysql,
674675
MY_CHARSET_INFO *charset);
675676
int mysql_session_track_get_first(MYSQL *mysql,

‎include/mysql_async.h‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ typedef struct NET_ASYNC {
172172
size_t compressed_buffers_size;
173173
} NET_ASYNC;
174174

175-
struct NET_EXTENSION {
175+
typedef struct NET_EXTENSION {
176176
NET_ASYNC *net_async_context;
177177
mysql_compress_context compress_ctx;
178-
};
178+
} NET_EXTENSION;
179179

180180
NET_EXTENSION *net_extension_init();
181181
void net_extension_free(NET *);
@@ -230,7 +230,7 @@ typedef struct MYSQL_ASYNC {
230230
struct MYSQL_RES *async_store_result_result;
231231

232232
/** the query parameters data */
233-
uchar *async_qp_data;
233+
unsigned char *async_qp_data;
234234
/** the query parameters data length */
235235
unsigned long async_qp_data_length;
236236

@@ -245,6 +245,4 @@ enum net_async_status net_write_command_nonblocking(
245245
bool *res);
246246
enum net_async_status my_net_read_nonblocking(NET *net, unsigned long *len_ptr);
247247

248-
int mysql_get_socket_descriptor(MYSQL *mysql);
249-
250248
#endif /* MYSQL_ASYNC_INCLUDED */

‎libmysql/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ SET(CLIENT_API_NONBLOCKING_FUNCTIONS
188188
mysql_real_query_nonblocking
189189
mysql_send_query_nonblocking
190190
mysql_store_result_nonblocking
191+
mysql_get_socket_descriptor
191192

192193
CACHE INTERNAL "Nonblocking functions exported by client API"
193194
)

‎sql-common/client.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4963,7 +4963,7 @@ static mysql_state_machine_status csm_send_one_init_command(
49634963

49644964
#define MAX_CONNECTION_ATTR_STORAGE_LENGTH 65536
49654965

4966-
int mysql_get_socket_descriptor(MYSQL *mysql) {
4966+
int STDCALL mysql_get_socket_descriptor(MYSQL *mysql) {
49674967
if (mysql && mysql->net.vio) {
49684968
return vio_fd(mysql->net.vio);
49694969
}

0 commit comments

Comments
 (0)