summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2012-01-06 12:43:18 +0100
committerunknown <knielsen@knielsen-hq.org>2012-01-06 12:43:18 +0100
commit17940b652d0a078f5a28b089aa0f5362756d438e (patch)
tree0c198251f33fd1b19ae2bb443a732496a3bf5ee3 /sql-common
parenta5b881594da4258257b18cc42f5ce7be3524e02c (diff)
downloadmariadb-git-17940b652d0a078f5a28b089aa0f5362756d438e.tar.gz
MWL#192: non-blocking client API, after-review fixes.
Main change is that non-blocking operation is now an option that must be explicitly enabled with mysql_option(mysql, MYSQL_OPT_NONBLOCK, ...) before any non-blocing operation can be used. Also the CLIENT_REMEMBER_OPTIONS flag is now always enabled and thus effectively ignored (it was not really useful anyway, and this simplifies things when non-blocking mysql_real_connect() fails).
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c165
-rw-r--r--sql-common/mysql_async.c1441
2 files changed, 1028 insertions, 578 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index f56a6d5111f..ad407136b92 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -108,7 +108,8 @@ my_bool net_flush(NET *net);
#include "client_settings.h"
#include <sql_common.h>
#include <mysql/client_plugin.h>
-#include "my_context.h"
+#include <my_context.h>
+#include <mysql_async.h>
#define native_password_plugin_name "mysql_native_password"
#define old_password_plugin_name "mysql_old_password"
@@ -1051,23 +1052,17 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
return 0;
}
-#define mysql_extension_get(MYSQL, X) \
- ((MYSQL)->extension ? (MYSQL)->extension->X : NULL)
-#define mysql_extension_set(MYSQL, X, VAL) \
- if (!(MYSQL)->extension) \
- (MYSQL)->extension= (struct st_mysql_extension *) \
- my_malloc(sizeof(struct st_mysql_extension), \
+#define extension_set(OPTS, X, VAL) \
+ if (!(OPTS)->extension) \
+ (OPTS)->extension= (struct st_mysql_options_extention *) \
+ my_malloc(sizeof(struct st_mysql_options_extention), \
MYF(MY_WME | MY_ZEROFILL)); \
- (MYSQL)->extension->X= VAL;
+ (OPTS)->extension->X= VAL;
#define extension_set_string(OPTS, X, STR) \
if ((OPTS)->extension) \
my_free((OPTS)->extension->X, MYF(MY_ALLOW_ZERO_PTR)); \
- else \
- (OPTS)->extension= (struct st_mysql_options_extention *) \
- my_malloc(sizeof(struct st_mysql_options_extention), \
- MYF(MY_WME | MY_ZEROFILL)); \
- (OPTS)->extension->X= my_strdup((STR), MYF(MY_WME));
+ extension_set(OPTS, X, my_strdup((STR), MYF(MY_WME)));
void mysql_read_default_options(struct st_mysql_options *options,
const char *filename,const char *group)
@@ -1276,36 +1271,6 @@ void mysql_read_default_options(struct st_mysql_options *options,
DBUG_VOID_RETURN;
}
-/*
- Fetch the context for asynchronous API calls, allocating a new one if
- necessary.
-*/
-#define STACK_SIZE (4096*15)
-
-struct mysql_async_context *
-mysql_get_async_context(MYSQL *mysql)
-{
- struct mysql_async_context *b;
- if ((b= mysql_extension_get(mysql, async_context)))
- return b;
-
- if (!(b= (struct mysql_async_context *)
- my_malloc(sizeof(*b), MYF(MY_ZEROFILL))))
- {
- set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
- return NULL;
- }
- if (my_context_init(&b->async_context, STACK_SIZE))
- {
- my_free(b, MYF(0));
- return NULL;
- }
- mysql_extension_set(mysql, async_context, b)
- if (mysql->net.vio)
- mysql->net.vio->async_context= b;
- return b;
-}
-
/**************************************************************************
Get column lengths of the current row
@@ -2581,20 +2546,16 @@ static int
connect_sync_or_async(MYSQL *mysql, NET *net, my_socket fd,
const struct sockaddr *name, uint namelen)
{
- extern int my_connect_async(struct mysql_async_context *b, my_socket fd,
- const struct sockaddr *name, uint namelen,
- uint timeout);
- struct mysql_async_context *actxt= mysql_extension_get(mysql, async_context);
-
- if (actxt && actxt->active)
+ if (mysql->options.extension && mysql->options.extension->async_context &&
+ mysql->options.extension->async_context->active)
{
my_bool old_mode;
vio_blocking(net->vio, FALSE, &old_mode);
- return my_connect_async(actxt, fd, name, namelen,
- mysql->options.connect_timeout);
+ return my_connect_async(mysql->options.extension->async_context, fd,
+ name, namelen, mysql->options.connect_timeout);
}
- else
- return my_connect(fd, name, namelen, mysql->options.connect_timeout);
+
+ return my_connect(fd, name, namelen, mysql->options.connect_timeout);
}
MYSQL * STDCALL
@@ -2612,7 +2573,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
struct sockaddr_in sock_addr;
ulong pkt_length;
NET *net= &mysql->net;
- struct mysql_async_context *actxt;
#ifdef MYSQL_SERVER
thr_alarm_t alarmed;
ALARM alarm_buff;
@@ -2881,8 +2841,9 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
goto error;
}
- if ((actxt= mysql_extension_get(mysql, async_context)) && actxt->active)
- net->vio->async_context= actxt;
+ if (mysql->options.extension && mysql->options.extension->async_context &&
+ mysql->options.extension->async_context->active)
+ net->vio->async_context= mysql->options.extension->async_context;
if (my_net_init(net, net->vio))
{
@@ -3114,8 +3075,6 @@ error:
/* Free alloced memory */
end_server(mysql);
mysql_close_free(mysql);
- if (!(client_flag & CLIENT_REMEMBER_OPTIONS))
- mysql_close_free_options(mysql);
}
DBUG_RETURN(0);
}
@@ -3184,7 +3143,6 @@ my_bool mysql_reconnect(MYSQL *mysql)
DBUG_RETURN(1);
}
mysql_init(&tmp_mysql);
- tmp_mysql.extension= mysql->extension;
tmp_mysql.options= mysql->options;
tmp_mysql.options.my_cnf_file= tmp_mysql.options.my_cnf_group= 0;
tmp_mysql.rpl_pivot= mysql->rpl_pivot;
@@ -3199,7 +3157,9 @@ my_bool mysql_reconnect(MYSQL *mysql)
(The vio will be put in the original MYSQL permanently once we successfully
reconnect, or be discarded if we fail to reconnect.)
*/
- if ((ctxt= mysql_extension_get(mysql, async_context)) && ctxt->active)
+ if (mysql->options.extension &&
+ (ctxt= mysql->options.extension->async_context) &&
+ mysql->options.extension->async_context->active)
{
hook_data.orig_mysql= mysql;
hook_data.new_mysql= &tmp_mysql;
@@ -3208,7 +3168,7 @@ my_bool mysql_reconnect(MYSQL *mysql)
}
if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
mysql->db, mysql->port, mysql->unix_socket,
- mysql->client_flag | CLIENT_REMEMBER_OPTIONS))
+ mysql->client_flag))
{
if (ctxt)
my_context_install_suspend_resume_hook(ctxt, NULL, NULL);
@@ -3220,7 +3180,6 @@ my_bool mysql_reconnect(MYSQL *mysql)
if (mysql_set_character_set(&tmp_mysql, mysql->charset->csname))
{
DBUG_PRINT("error", ("mysql_set_character_set() failed"));
- tmp_mysql.extension= NULL;
bzero((char*) &tmp_mysql.options,sizeof(tmp_mysql.options));
mysql_close(&tmp_mysql);
if (ctxt)
@@ -3241,11 +3200,7 @@ my_bool mysql_reconnect(MYSQL *mysql)
tmp_mysql.stmts= mysql->stmts;
mysql->stmts= 0;
- /*
- Don't free options as these are now used in tmp_mysql.
- Same with extension.
- */
- mysql->extension= NULL;
+ /* Don't free options as these are now used in tmp_mysql */
bzero((char*) &mysql->options,sizeof(mysql->options));
mysql->free_me=0;
mysql_close(mysql);
@@ -3315,8 +3270,14 @@ static void mysql_close_free_options(MYSQL *mysql)
#endif /* HAVE_SMEM */
if (mysql->options.extension)
{
+ struct mysql_async_context *ctxt= mysql->options.extension->async_context;
my_free(mysql->options.extension->plugin_dir,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.extension->default_auth,MYF(MY_ALLOW_ZERO_PTR));
+ if (ctxt)
+ {
+ my_context_destroy(&ctxt->async_context);
+ my_free(ctxt, MYF(0));
+ }
my_free(mysql->options.extension,MYF(0));
}
bzero((char*) &mysql->options,sizeof(mysql->options));
@@ -3324,21 +3285,6 @@ static void mysql_close_free_options(MYSQL *mysql)
}
-static void
-mysql_close_free_extension(MYSQL *mysql)
-{
- if (mysql->extension)
- {
- if (mysql->extension->async_context)
- {
- my_context_destroy(&mysql->extension->async_context->async_context);
- my_free(mysql->extension->async_context, MYF(0));
- }
- my_free(mysql->extension, MYF(0));
- mysql->extension= NULL;
- }
-}
-
static void mysql_close_free(MYSQL *mysql)
{
my_free((uchar*) mysql->host_info,MYF(MY_ALLOW_ZERO_PTR));
@@ -3447,14 +3393,11 @@ void mysql_detach_stmt_list(LIST **stmt_list __attribute__((unused)),
used for non-blocking operation of blocking stuff, so that later part can
_not_ be done non-blocking.
- Therefore, mysql_pre_close() is used to run the parts of mysql_close() that
- may block. It can be called before mysql_close(), and in that case
- mysql_close() is guaranteed not to need to block.
-*/
-void mysql_pre_close(MYSQL *mysql)
+ Therefore, mysql_close_slow_part() is used to run the parts of mysql_close()
+ that may block. It can be called before mysql_close(), and in that case
+ mysql_close() is guaranteed not to need to block. */
+void STDCALL mysql_close_slow_part(MYSQL *mysql)
{
- if (!mysql)
- return;
/* If connection is still up, send a QUIT message */
if (mysql->net.vio != 0)
{
@@ -3473,9 +3416,8 @@ void STDCALL mysql_close(MYSQL *mysql)
if (mysql) /* Some simple safety */
{
- mysql_pre_close(mysql);
+ mysql_close_slow_part(mysql);
mysql_close_free_options(mysql);
- mysql_close_free_extension(mysql);
mysql_close_free(mysql);
mysql_detach_stmt_list(&mysql->stmts, "mysql_close");
#ifndef TO_BE_DELETED
@@ -3806,9 +3748,14 @@ mysql_fetch_lengths(MYSQL_RES *res)
}
+#define ASYNC_CONTEXT_DEFAULT_STACK_SIZE (4096*15)
+
int STDCALL
mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
{
+ struct mysql_async_context *ctxt;
+ size_t stacksize;
+
DBUG_ENTER("mysql_option");
DBUG_PRINT("enter",("option: %d",(int) option));
switch (option) {
@@ -3892,6 +3839,39 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
case MYSQL_DEFAULT_AUTH:
extension_set_string(&mysql->options, default_auth, arg);
break;
+ case MYSQL_OPT_NONBLOCK:
+ if (mysql->options.extension &&
+ (ctxt = mysql->options.extension->async_context) != 0)
+ {
+ /*
+ We must not allow changing the stack size while a non-blocking call is
+ suspended (as the stack is then in use).
+ */
+ if (ctxt->suspended)
+ DBUG_RETURN(1);
+ my_context_destroy(&ctxt->async_context);
+ my_free(ctxt, MYF(0));
+ }
+ if (!(ctxt= (struct mysql_async_context *)
+ my_malloc(sizeof(*ctxt), MYF(MY_ZEROFILL))))
+ {
+ set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
+ DBUG_RETURN(1);
+ }
+ stacksize= 0;
+ if (arg)
+ stacksize= *(const size_t *)arg;
+ if (!stacksize)
+ stacksize= ASYNC_CONTEXT_DEFAULT_STACK_SIZE;
+ if (my_context_init(&ctxt->async_context, stacksize))
+ {
+ my_free(ctxt, MYF(0));
+ DBUG_RETURN(1);
+ }
+ extension_set(&(mysql->options), async_context, ctxt)
+ if (mysql->net.vio)
+ mysql->net.vio->async_context= ctxt;
+ break;
default:
DBUG_RETURN(1);
}
@@ -4102,6 +4082,5 @@ mysql_get_socket(const MYSQL *mysql)
{
if (mysql->net.vio)
return mysql->net.vio->sd;
- else
- return INVALID_SOCKET;
+ return INVALID_SOCKET;
}
diff --git a/sql-common/mysql_async.c b/sql-common/mysql_async.c
index a8e699e5012..a2b818b77e2 100644
--- a/sql-common/mysql_async.c
+++ b/sql-common/mysql_async.c
@@ -1,17 +1,15 @@
/*
- Copyright 2011 Kristian Nielsen
+ Copyright 2011 Kristian Nielsen and Monty Program Ab
- Experiments with non-blocking libmysql.
+ This file is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
- This is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 2 of the License, or
- (at your option) any later version.
-
- This is distributed in the hope that it will be useful,
+ This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
along with this. If not, see <http://www.gnu.org/licenses/>.
@@ -28,6 +26,7 @@
#include "sql_common.h"
#include "my_context.h"
#include "violite.h"
+#include "mysql_async.h"
#ifdef __WIN__
@@ -36,15 +35,13 @@
that the socket is non-blocking at the start of every operation.
*/
#define WIN_SET_NONBLOCKING(mysql) { \
- my_bool old_mode__; \
- if ((mysql)->net.vio) vio_blocking((mysql)->net.vio, FALSE, &old_mode__); \
+ my_bool old_mode; \
+ if ((mysql)->net.vio) vio_blocking((mysql)->net.vio, FALSE, &old_mode); \
}
#else
#define WIN_SET_NONBLOCKING(mysql)
#endif
-extern struct mysql_async_context *mysql_get_async_context(MYSQL *mysql);
-
void
my_context_install_suspend_resume_hook(struct mysql_async_context *b,
@@ -62,12 +59,9 @@ my_connect_async(struct mysql_async_context *b, my_socket fd,
const struct sockaddr *name, uint namelen, uint timeout)
{
int res;
-#ifdef __WIN__
- int s_err_size;
-#else
- socklen_t s_err_size;
-#endif
+ size_socket s_err_size;
+ b->events_to_wait_for= 0;
/*
Start to connect asynchronously.
If this will block, we suspend the call and return control to the
@@ -75,33 +69,31 @@ my_connect_async(struct mysql_async_context *b, my_socket fd,
polls ready for write, indicating that the connection attempt completed.
*/
res= connect(fd, name, namelen);
-#ifdef __WIN__
if (res != 0)
{
+#ifdef __WIN__
int wsa_err= WSAGetLastError();
if (wsa_err != WSAEWOULDBLOCK)
return res;
+ b->events_to_wait_for|= MYSQL_WAIT_EXCEPT;
#else
- if (res < 0)
- {
- if (errno != EINPROGRESS && errno != EALREADY && errno != EAGAIN)
+ int err= errno;
+ if (err != EINPROGRESS && err != EALREADY && err != EAGAIN)
return res;
#endif
+ b->events_to_wait_for|= MYSQL_WAIT_WRITE;
b->timeout_value= timeout;
- b->ret_status= MYSQL_WAIT_WRITE |
- (timeout ? MYSQL_WAIT_TIMEOUT : 0);
-#ifdef __WIN__
- b->ret_status|= MYSQL_WAIT_EXCEPT;
-#endif
+ if (timeout)
+ b->events_to_wait_for|= MYSQL_WAIT_TIMEOUT;
if (b->suspend_resume_hook)
(*b->suspend_resume_hook)(TRUE, b->suspend_resume_hook_user_data);
my_context_yield(&b->async_context);
if (b->suspend_resume_hook)
(*b->suspend_resume_hook)(FALSE, b->suspend_resume_hook_user_data);
- if (b->ret_status & MYSQL_WAIT_TIMEOUT)
+ if (b->events_occured & MYSQL_WAIT_TIMEOUT)
return -1;
- s_err_size= sizeof(int);
+ s_err_size= sizeof(res);
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*) &res, &s_err_size) != 0)
return -1;
if (res)
@@ -113,6 +105,10 @@ my_connect_async(struct mysql_async_context *b, my_socket fd,
return res;
}
+#define IS_BLOCKING_ERROR() \
+ IF_WIN(WSAGetLastError() != WSAEWOULDBLOCK, \
+ (errno != EAGAIN && errno != EINTR))
+
ssize_t
my_recv_async(struct mysql_async_context *b, int fd,
unsigned char *buf, size_t size, uint timeout)
@@ -121,25 +117,13 @@ my_recv_async(struct mysql_async_context *b, int fd,
for (;;)
{
- res= recv(fd, buf, size,
-#ifdef __WIN__
- 0
-#else
- MSG_DONTWAIT
-#endif
- );
- if (res >= 0 ||
-#ifdef __WIN__
- WSAGetLastError() != WSAEWOULDBLOCK
-#else
- (errno != EAGAIN && errno != EINTR)
-#endif
- )
+ res= recv(fd, buf, size, IF_WIN(0, MSG_DONTWAIT));
+ if (res >= 0 || IS_BLOCKING_ERROR())
return res;
- b->ret_status= MYSQL_WAIT_READ;
+ b->events_to_wait_for= MYSQL_WAIT_READ;
if (timeout)
{
- b->ret_status|= MYSQL_WAIT_TIMEOUT;
+ b->events_to_wait_for|= MYSQL_WAIT_TIMEOUT;
b->timeout_value= timeout;
}
if (b->suspend_resume_hook)
@@ -147,11 +131,12 @@ my_recv_async(struct mysql_async_context *b, int fd,
my_context_yield(&b->async_context);
if (b->suspend_resume_hook)
(*b->suspend_resume_hook)(FALSE, b->suspend_resume_hook_user_data);
- if (b->ret_status & MYSQL_WAIT_TIMEOUT)
+ if (b->events_occured & MYSQL_WAIT_TIMEOUT)
return -1;
}
}
+
ssize_t
my_send_async(struct mysql_async_context *b, int fd,
const unsigned char *buf, size_t size, uint timeout)
@@ -160,25 +145,13 @@ my_send_async(struct mysql_async_context *b, int fd,
for (;;)
{
- res= send(fd, buf, size,
-#ifdef __WIN__
- 0
-#else
- MSG_DONTWAIT
-#endif
- );
- if (res >= 0 ||
-#ifdef __WIN__
- WSAGetLastError() != WSAEWOULDBLOCK
-#else
- (errno != EAGAIN && errno != EINTR)
-#endif
- )
+ res= send(fd, buf, size, IF_WIN(0, MSG_DONTWAIT));
+ if (res >= 0 || IS_BLOCKING_ERROR())
return res;
- b->ret_status= MYSQL_WAIT_WRITE;
+ b->events_to_wait_for= MYSQL_WAIT_WRITE;
if (timeout)
{
- b->ret_status|= MYSQL_WAIT_TIMEOUT;
+ b->events_to_wait_for|= MYSQL_WAIT_TIMEOUT;
b->timeout_value= timeout;
}
if (b->suspend_resume_hook)
@@ -186,7 +159,7 @@ my_send_async(struct mysql_async_context *b, int fd,
my_context_yield(&b->async_context);
if (b->suspend_resume_hook)
(*b->suspend_resume_hook)(FALSE, b->suspend_resume_hook_user_data);
- if (b->ret_status & MYSQL_WAIT_TIMEOUT)
+ if (b->events_occured & MYSQL_WAIT_TIMEOUT)
return -1;
}
}
@@ -195,41 +168,51 @@ my_send_async(struct mysql_async_context *b, int fd,
my_bool
my_poll_read_async(struct mysql_async_context *b, uint timeout)
{
- b->ret_status= MYSQL_WAIT_READ | MYSQL_WAIT_TIMEOUT;
+ b->events_to_wait_for= MYSQL_WAIT_READ | MYSQL_WAIT_TIMEOUT;
b->timeout_value= timeout;
if (b->suspend_resume_hook)
(*b->suspend_resume_hook)(TRUE, b->suspend_resume_hook_user_data);
my_context_yield(&b->async_context);
if (b->suspend_resume_hook)
(*b->suspend_resume_hook)(FALSE, b->suspend_resume_hook_user_data);
- return (b->ret_status & MYSQL_WAIT_READ) ? 0 : 1;
+ return (b->events_occured & MYSQL_WAIT_READ) ? 0 : 1;
}
#ifdef HAVE_OPENSSL
+static my_bool
+my_ssl_async_check_result(int res, struct mysql_async_context *b, SSL *ssl)
+{
+ int ssl_err;
+ b->events_to_wait_for= 0;
+ if (res >= 0)
+ return 1;
+ ssl_err= SSL_get_error(ssl, res);
+ if (ssl_err == SSL_ERROR_WANT_READ)
+ b->events_to_wait_for|= MYSQL_WAIT_READ;
+ else if (ssl_err == SSL_ERROR_WANT_WRITE)
+ b->events_to_wait_for|= MYSQL_WAIT_WRITE;
+ else
+ return 1;
+ if (b->suspend_resume_hook)
+ (*b->suspend_resume_hook)(TRUE, b->suspend_resume_hook_user_data);
+ my_context_yield(&b->async_context);
+ if (b->suspend_resume_hook)
+ (*b->suspend_resume_hook)(FALSE, b->suspend_resume_hook_user_data);
+ return 0;
+}
+
int
my_ssl_read_async(struct mysql_async_context *b, SSL *ssl,
void *buf, int size)
{
- int res, ssl_err;
+ int res;
for (;;)
{
res= SSL_read(ssl, buf, size);
- if (res >= 0)
+ if (my_ssl_async_check_result(res, b, ssl))
return res;
- ssl_err= SSL_get_error(ssl, res);
- if (ssl_err == SSL_ERROR_WANT_READ)
- b->ret_status= MYSQL_WAIT_READ;
- else if (ssl_err == SSL_ERROR_WANT_WRITE)
- b->ret_status= MYSQL_WAIT_WRITE;
- else
- return res;
- if (b->suspend_resume_hook)
- (*b->suspend_resume_hook)(TRUE, b->suspend_resume_hook_user_data);
- my_context_yield(&b->async_context);
- if (b->suspend_resume_hook)
- (*b->suspend_resume_hook)(FALSE, b->suspend_resume_hook_user_data);
}
}
@@ -237,25 +220,13 @@ int
my_ssl_write_async(struct mysql_async_context *b, SSL *ssl,
const void *buf, int size)
{
- int res, ssl_err;
+ int res;
for (;;)
{
res= SSL_write(ssl, buf, size);
- if (res >= 0)
+ if (my_ssl_async_check_result(res, b, ssl))
return res;
- ssl_err= SSL_get_error(ssl, res);
- if (ssl_err == SSL_ERROR_WANT_READ)
- b->ret_status= MYSQL_WAIT_READ;
- else if (ssl_err == SSL_ERROR_WANT_WRITE)
- b->ret_status= MYSQL_WAIT_WRITE;
- else
- return res;
- if (b->suspend_resume_hook)
- (*b->suspend_resume_hook)(TRUE, b->suspend_resume_hook_user_data);
- my_context_yield(&b->async_context);
- if (b->suspend_resume_hook)
- (*b->suspend_resume_hook)(FALSE, b->suspend_resume_hook_user_data);
}
}
#endif /* HAVE_OPENSSL */
@@ -263,12 +234,10 @@ my_ssl_write_async(struct mysql_async_context *b, SSL *ssl,
unsigned int STDCALL
mysql_get_timeout_value(const MYSQL *mysql)
{
- if (mysql->extension && mysql->extension->async_context)
- return mysql->extension->async_context->timeout_value;
- else
- return 0;
+ return mysql->options.extension->async_context->timeout_value;
}
+
/*
Now create non-blocking definitions for all the calls that may block.
@@ -279,184 +248,123 @@ mysql_get_timeout_value(const MYSQL *mysql)
can continue a suspended operation.
*/
-#define MK_ASYNC_CALLS(call__, decl_args__, invoke_args__, cont_arg__, mysql_val__, parms_mysql_val__, parms_assign__, ret_type__, err_val__, ok_val__, extra1__) \
-static void \
-call__ ## _start_internal(void *d) \
-{ \
- struct call__ ## _params *parms; \
- ret_type__ ret; \
- struct mysql_async_context *b; \
- \
- parms= (struct call__ ## _params *)d; \
- b= (parms_mysql_val__)->extension->async_context; \
+#define MK_ASYNC_INTERNAL_BODY(call, invoke_args, mysql_val, ret_type, ok_val)\
+ struct call ## _params *parms= (struct call ## _params *)d; \
+ ret_type ret; \
+ struct mysql_async_context *b= \
+ (mysql_val)->options.extension->async_context; \
\
- ret= call__ invoke_args__; \
- b->ret_result. ok_val__ = ret; \
- b->ret_status= 0; \
-} \
-int STDCALL \
-call__ ## _start decl_args__ \
-{ \
+ ret= call invoke_args; \
+ b->ret_result. ok_val = ret; \
+ b->events_to_wait_for= 0;
+
+#define MK_ASYNC_START_BODY(call, mysql_val, parms_assign, err_val, ok_val, extra1) \
int res; \
struct mysql_async_context *b; \
- struct call__ ## _params parms; \
+ struct call ## _params parms; \
\
- extra1__ \
- if (!(b= mysql_get_async_context((mysql_val__)))) \
- { \
- *ret= err_val__; \
- return 0; \
- } \
- parms_assign__ \
+ extra1 \
+ b= mysql_val->options.extension->async_context; \
+ parms_assign \
\
b->active= 1; \
- res= my_context_spawn(&b->async_context, call__ ## _start_internal, &parms);\
- b->active= 0; \
- if (res < 0) \
- { \
- set_mysql_error((mysql_val__), CR_OUT_OF_MEMORY, unknown_sqlstate); \
- b->suspended= 0; \
- *ret= err_val__; \
- return 0; \
- } \
- else if (res > 0) \
+ res= my_context_spawn(&b->async_context, call ## _start_internal, &parms); \
+ b->active= b->suspended= 0; \
+ if (res > 0) \
{ \
/* Suspended. */ \
b->suspended= 1; \
- return b->ret_status; \
+ return b->events_to_wait_for; \
} \
- else \
+ if (res < 0) \
{ \
- /* Finished. */ \
- b->suspended= 0; \
- *ret= b->ret_result. ok_val__; \
- return 0; \
+ set_mysql_error((mysql_val), CR_OUT_OF_MEMORY, unknown_sqlstate); \
+ *ret= err_val; \
} \
-} \
-int STDCALL \
-call__ ## _cont(ret_type__ *ret, cont_arg__, int ready_status) \
-{ \
+ else \
+ *ret= b->ret_result. ok_val; \
+ return 0;
+
+#define MK_ASYNC_CONT_BODY(mysql_val, err_val, ok_val) \
int res; \
- struct mysql_async_context *b; \
- \
- b= (mysql_val__)->extension->async_context; \
- if (!b || !b->suspended) \
+ struct mysql_async_context *b= \
+ (mysql_val)->options.extension->async_context; \
+ if (!b->suspended) \
{ \
- set_mysql_error((mysql_val__), CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);\
- *ret= err_val__; \
+ set_mysql_error((mysql_val), CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate); \
+ *ret= err_val; \
return 0; \
} \
\
b->active= 1; \
- b->ret_status= ready_status; \
+ b->events_occured= ready_status; \
res= my_context_continue(&b->async_context); \
b->active= 0; \
+ if (res > 0) \
+ return b->events_to_wait_for; /* (Still) suspended */ \
+ b->suspended= 0; \
if (res < 0) \
{ \
- set_mysql_error((mysql_val__), CR_OUT_OF_MEMORY, unknown_sqlstate); \
- b->suspended= 0; \
- *ret= err_val__; \
- return 0; \
- } \
- else if (res > 0) \
- { \
- /* Suspended. */ \
- return b->ret_status; \
+ set_mysql_error((mysql_val), CR_OUT_OF_MEMORY, unknown_sqlstate); \
+ *ret= err_val; \
} \
else \
- { \
- /* Finished. */ \
- b->suspended= 0; \
- *ret= b->ret_result. ok_val__; \
- return 0; \
- } \
-}
+ *ret= b->ret_result. ok_val; /* Finished. */ \
+ return 0;
-#define MK_ASYNC_CALLS_VOID_RETURN(call__, decl_args__, invoke_args__, cont_arg__, mysql_val__, parms_mysql_val__, parms_assign__, extra1__) \
-static void \
-call__ ## _start_internal(void *d) \
-{ \
- struct call__ ## _params *parms; \
- struct mysql_async_context *b; \
- \
- parms= (struct call__ ## _params *)d; \
- b= (parms_mysql_val__)->extension->async_context; \
+#define MK_ASYNC_INTERNAL_BODY_VOID_RETURN(call, invoke_args, mysql_val) \
+ struct call ## _params *parms= (struct call ## _params *)d; \
+ struct mysql_async_context *b= \
+ (mysql_val)->options.extension->async_context; \
\
- call__ invoke_args__; \
- b->ret_status= 0; \
-} \
-int STDCALL \
-call__ ## _start decl_args__ \
-{ \
+ call invoke_args; \
+ b->events_to_wait_for= 0;
+
+#define MK_ASYNC_START_BODY_VOID_RETURN(call, mysql_val, parms_assign, extra1)\
int res; \
struct mysql_async_context *b; \
- struct call__ ## _params parms; \
+ struct call ## _params parms; \
\
- extra1__ \
- if (!(b= mysql_get_async_context((mysql_val__)))) \
- { \
- return 0; \
- } \
- parms_assign__ \
+ extra1 \
+ b= mysql_val->options.extension->async_context; \
+ parms_assign \
\
b->active= 1; \
- res= my_context_spawn(&b->async_context, call__ ## _start_internal, &parms);\
- b->active= 0; \
- if (res < 0) \
- { \
- set_mysql_error((mysql_val__), CR_OUT_OF_MEMORY, unknown_sqlstate); \
- b->suspended= 0; \
- return 0; \
- } \
- else if (res > 0) \
+ res= my_context_spawn(&b->async_context, call ## _start_internal, &parms); \
+ b->active= b->suspended= 0; \
+ if (res > 0) \
{ \
/* Suspended. */ \
b->suspended= 1; \
- return b->ret_status; \
+ return b->events_to_wait_for; \
} \
- else \
- { \
- /* Finished. */ \
- b->suspended= 0; \
- return 0; \
- } \
-} \
-int STDCALL \
-call__ ## _cont(cont_arg__, int ready_status) \
-{ \
+ if (res < 0) \
+ set_mysql_error((mysql_val), CR_OUT_OF_MEMORY, unknown_sqlstate); \
+ return 0;
+
+#define MK_ASYNC_CONT_BODY_VOID_RETURN(mysql_val) \
int res; \
- struct mysql_async_context *b; \
- \
- b= (mysql_val__)->extension->async_context; \
- if (!b || !b->suspended) \
+ struct mysql_async_context *b= \
+ (mysql_val)->options.extension->async_context; \
+ if (!b->suspended) \
{ \
- set_mysql_error((mysql_val__), CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);\
+ set_mysql_error((mysql_val), CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate); \
return 0; \
} \
\
b->active= 1; \
- b->ret_status= ready_status; \
+ b->events_occured= ready_status; \
res= my_context_continue(&b->async_context); \
b->active= 0; \
+ if (res > 0) \
+ return b->events_to_wait_for; /* (Still) suspended */ \
+ b->suspended= 0; \
if (res < 0) \
- { \
- set_mysql_error((mysql_val__), CR_OUT_OF_MEMORY, unknown_sqlstate); \
- b->suspended= 0; \
- return 0; \
- } \
- else if (res > 0) \
- { \
- /* Suspended. */ \
- return b->ret_status; \
- } \
- else \
- { \
- /* Finished. */ \
- b->suspended= 0; \
- return 0; \
- } \
-}
+ set_mysql_error((mysql_val), CR_OUT_OF_MEMORY, unknown_sqlstate); \
+ return 0;
+
+/* Structure used to pass parameters from mysql_real_connect_start(). */
struct mysql_real_connect_params {
MYSQL *mysql;
const char *host;
@@ -467,16 +375,26 @@ struct mysql_real_connect_params {
const char *unix_socket;
unsigned long client_flags;
};
-MK_ASYNC_CALLS(
+static void
+mysql_real_connect_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_real_connect,
- (MYSQL **ret, MYSQL *mysql, const char *host, const char *user,
- const char *passwd, const char *db, unsigned int port,
- const char *unix_socket, unsigned long client_flags),
(parms->mysql, parms->host, parms->user, parms->passwd, parms->db,
parms->port, parms->unix_socket, parms->client_flags),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ MYSQL *,
+ r_ptr)
+}
+int STDCALL
+mysql_real_connect_start(MYSQL **ret, MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db,
+ unsigned int port, const char *unix_socket,
+ unsigned long client_flags)
+{
+MK_ASYNC_START_BODY(
+ mysql_real_connect,
+ mysql,
{
parms.mysql= mysql;
parms.host= host;
@@ -487,49 +405,84 @@ MK_ASYNC_CALLS(
parms.unix_socket= unix_socket;
parms.client_flags= client_flags;
},
- MYSQL *,
NULL,
r_ptr,
/* Nothing */)
+}
+int STDCALL
+mysql_real_connect_cont(MYSQL **ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ NULL,
+ r_ptr)
+}
+/* Structure used to pass parameters from mysql_real_query_start(). */
struct mysql_real_query_params {
MYSQL *mysql;
const char *stmt_str;
unsigned long length;
};
-MK_ASYNC_CALLS(
+static void
+mysql_real_query_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_real_query,
- (int *ret, MYSQL *mysql, const char *stmt_str, unsigned long length),
(parms->mysql, parms->stmt_str, parms->length),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_real_query_start(int *ret, MYSQL *mysql, const char *stmt_str, unsigned long length)
+{
+MK_ASYNC_START_BODY(
+ mysql_real_query,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
parms.stmt_str= stmt_str;
parms.length= length;
},
- int,
1,
r_int,
/* Nothing */)
+}
+int STDCALL
+mysql_real_query_cont(int *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_fetch_row_start(). */
struct mysql_fetch_row_params {
MYSQL_RES *result;
};
-MK_ASYNC_CALLS(
+static void
+mysql_fetch_row_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_fetch_row,
- (MYSQL_ROW *ret, MYSQL_RES *result),
(parms->result),
- MYSQL_RES *result,
- result->handle,
parms->result->handle,
+ MYSQL_ROW,
+ r_ptr)
+}
+int STDCALL
+mysql_fetch_row_start(MYSQL_ROW *ret, MYSQL_RES *result)
+{
+MK_ASYNC_START_BODY(
+ mysql_fetch_row,
+ result->handle,
{
WIN_SET_NONBLOCKING(result->handle)
parms.result= result;
},
- MYSQL_ROW,
NULL,
r_ptr,
/*
@@ -542,103 +495,191 @@ MK_ASYNC_CALLS(
{
*ret= mysql_fetch_row(result);
return 0;
- }
-)
+ })
+}
+int STDCALL
+mysql_fetch_row_cont(MYSQL_ROW *ret, MYSQL_RES *result, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ result->handle,
+ NULL,
+ r_ptr)
+}
+/* Structure used to pass parameters from mysql_set_character_set_start(). */
struct mysql_set_character_set_params {
MYSQL *mysql;
const char *csname;
};
-MK_ASYNC_CALLS(
+static void
+mysql_set_character_set_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_set_character_set,
- (int *ret, MYSQL *mysql, const char *csname),
(parms->mysql, parms->csname),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_set_character_set_start(int *ret, MYSQL *mysql, const char *csname)
+{
+MK_ASYNC_START_BODY(
+ mysql_set_character_set,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
parms.csname= csname;
},
- int,
1,
r_int,
/* Nothing */)
+}
+int STDCALL
+mysql_set_character_set_cont(int *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_sekect_db_start(). */
struct mysql_select_db_params {
MYSQL *mysql;
const char *db;
};
-MK_ASYNC_CALLS(
+static void
+mysql_select_db_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_select_db,
- (int *ret, MYSQL *mysql, const char *db),
(parms->mysql, parms->db),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_select_db_start(int *ret, MYSQL *mysql, const char *db)
+{
+MK_ASYNC_START_BODY(
+ mysql_select_db,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
parms.db= db;
},
- int,
1,
r_int,
/* Nothing */)
+}
+int STDCALL
+mysql_select_db_cont(int *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_send_query_start(). */
struct mysql_send_query_params {
MYSQL *mysql;
const char *q;
unsigned long length;
};
-MK_ASYNC_CALLS(
+static void
+mysql_send_query_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_send_query,
- (int *ret, MYSQL *mysql, const char *q, unsigned long length),
(parms->mysql, parms->q, parms->length),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_send_query_start(int *ret, MYSQL *mysql, const char *q, unsigned long length)
+{
+MK_ASYNC_START_BODY(
+ mysql_send_query,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
parms.q= q;
parms.length= length;
},
- int,
1,
r_int,
/* Nothing */)
+}
+int STDCALL
+mysql_send_query_cont(int *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_store_result_start(). */
struct mysql_store_result_params {
MYSQL *mysql;
};
-MK_ASYNC_CALLS(
+static void
+mysql_store_result_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_store_result,
- (MYSQL_RES **ret, MYSQL *mysql),
(parms->mysql),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ MYSQL_RES *,
+ r_ptr)
+}
+int STDCALL
+mysql_store_result_start(MYSQL_RES **ret, MYSQL *mysql)
+{
+MK_ASYNC_START_BODY(
+ mysql_store_result,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
},
- MYSQL_RES *,
NULL,
r_ptr,
/* Nothing */)
+}
+int STDCALL
+mysql_store_result_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ NULL,
+ r_ptr)
+}
+/* Structure used to pass parameters from mysql_free_result_start(). */
struct mysql_free_result_params {
MYSQL_RES *result;
};
-MK_ASYNC_CALLS_VOID_RETURN(
+static void
+mysql_free_result_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY_VOID_RETURN(
mysql_free_result,
- (MYSQL_RES *result),
(parms->result),
- MYSQL_RES *result,
+ parms->result->handle)
+}
+int STDCALL
+mysql_free_result_start(MYSQL_RES *result)
+{
+MK_ASYNC_START_BODY_VOID_RETURN(
+ mysql_free_result,
result->handle,
- parms->result->handle,
{
WIN_SET_NONBLOCKING(result->handle)
parms.result= result;
@@ -655,30 +696,49 @@ MK_ASYNC_CALLS_VOID_RETURN(
mysql_free_result(result);
return 0;
})
+}
+int STDCALL
+mysql_free_result_cont(MYSQL_RES *result, int ready_status)
+{
+MK_ASYNC_CONT_BODY_VOID_RETURN(result->handle)
+}
-struct mysql_pre_close_params {
+/* Structure used to pass parameters from mysql_close_slow_part_start(). */
+struct mysql_close_slow_part_params {
MYSQL *sock;
};
/*
We need special handling for mysql_close(), as the first part may block,
while the last part needs to free our extra library context stack.
- So we do the first part (mysql_pre_close()) non-blocking, but the last part
- blocking.
+ So we do the first part (mysql_close_slow_part()) non-blocking, but the last
+ part blocking.
*/
-extern void mysql_pre_close(MYSQL *mysql);
-MK_ASYNC_CALLS_VOID_RETURN(
- mysql_pre_close,
- (MYSQL *sock),
+static void
+mysql_close_slow_part_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY_VOID_RETURN(
+ mysql_close_slow_part,
(parms->sock),
- MYSQL *sock,
+ parms->sock)
+}
+int STDCALL
+mysql_close_slow_part_start(MYSQL *sock)
+{
+MK_ASYNC_START_BODY_VOID_RETURN(
+ mysql_close_slow_part,
sock,
- parms->sock,
{
WIN_SET_NONBLOCKING(sock)
parms.sock= sock;
},
/* Nothing */)
+}
+int STDCALL
+mysql_close_slow_part_cont(MYSQL *sock, int ready_status)
+{
+MK_ASYNC_CONT_BODY_VOID_RETURN(sock)
+}
int STDCALL
mysql_close_start(MYSQL *sock)
{
@@ -687,7 +747,7 @@ mysql_close_start(MYSQL *sock)
/* It is legitimate to have NULL sock argument, which will do nothing. */
if (sock)
{
- res= mysql_pre_close_start(sock);
+ res= mysql_close_slow_part_start(sock);
/* If we need to block, return now and do the rest in mysql_close_cont(). */
if (res)
return res;
@@ -700,101 +760,41 @@ mysql_close_cont(MYSQL *sock, int ready_status)
{
int res;
- res= mysql_pre_close_cont(sock, ready_status);
+ res= mysql_close_slow_part_cont(sock, ready_status);
if (res)
return res;
mysql_close(sock);
return 0;
}
-#ifdef USE_OLD_FUNCTIONS
-struct mysql_connect_params {
- MYSQL *mysql;
- const char *host;
- const char *user;
- const char *passwd;
-};
-MK_ASYNC_CALLS(
- mysql_connect,
- (MYSQL **ret, MYSQL *mysql, const char *host, const char *user, const char *passwd),
- (parms->mysql, parms->host, parms->user, parms->passwd),
- MYSQL *mysql,
- mysql,
- parms->mysql,
- {
- WIN_SET_NONBLOCKING(mysql)
- parms.mysql= mysql;
- parms.host= host;
- parms.user= user;
- parms.passwd= passwd;
- },
- MYSQL *,
- NULL,
- r_ptr,
- /* Nothing */)
-
-struct mysql_create_db_params {
- MYSQL *mysql;
- const char *DB;
-};
-MK_ASYNC_CALLS(
- mysql_create_db,
- (int *ret, MYSQL *mysql, const char *DB),
- (parms->mysql, parms->DB),
- MYSQL *mysql,
- mysql,
- parms->mysql,
- {
- WIN_SET_NONBLOCKING(mysql)
- parms.mysql= mysql;
- parms.DB= DB;
- },
- int,
- 1,
- r_int,
- /* Nothing */)
-
-struct mysql_drop_db_params {
- MYSQL *mysql;
- const char *DB;
-};
-MK_ASYNC_CALLS(
- mysql_drop_db,
- (int *ret, MYSQL *mysql, const char *DB),
- (parms->mysql, parms->DB),
- MYSQL *mysql,
- mysql,
- parms->mysql,
- {
- WIN_SET_NONBLOCKING(mysql)
- parms.mysql= mysql;
- parms.DB= DB;
- },
- int,
- 1,
- r_int,
- /* Nothing */)
-
-#endif
-
/*
These following are not available inside the server (neither blocking or
non-blocking).
*/
#ifndef MYSQL_SERVER
+/* Structure used to pass parameters from mysql_change_user_start(). */
struct mysql_change_user_params {
MYSQL *mysql;
const char *user;
const char *passwd;
const char *db;
};
-MK_ASYNC_CALLS(
+static void
+mysql_change_user_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_change_user,
- (my_bool *ret, MYSQL *mysql, const char *user, const char *passwd, const char *db),
(parms->mysql, parms->user, parms->passwd, parms->db),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ my_bool,
+ r_my_bool)
+}
+int STDCALL
+mysql_change_user_start(my_bool *ret, MYSQL *mysql, const char *user, const char *passwd, const char *db)
+{
+MK_ASYNC_START_BODY(
+ mysql_change_user,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
@@ -802,295 +802,549 @@ MK_ASYNC_CALLS(
parms.passwd= passwd;
parms.db= db;
},
- my_bool,
TRUE,
r_my_bool,
/* Nothing */)
+}
+int STDCALL
+mysql_change_user_cont(my_bool *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ TRUE,
+ r_my_bool)
+}
+/* Structure used to pass parameters from mysql_query_start(). */
struct mysql_query_params {
MYSQL *mysql;
const char *q;
};
-MK_ASYNC_CALLS(
+static void
+mysql_query_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_query,
- (int *ret, MYSQL *mysql, const char *q),
(parms->mysql, parms->q),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_query_start(int *ret, MYSQL *mysql, const char *q)
+{
+MK_ASYNC_START_BODY(
+ mysql_query,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
parms.q= q;
},
- int,
1,
r_int,
/* Nothing */)
+}
+int STDCALL
+mysql_query_cont(int *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_shutdown_start(). */
struct mysql_shutdown_params {
MYSQL *mysql;
enum mysql_enum_shutdown_level shutdown_level;
};
-MK_ASYNC_CALLS(
+static void
+mysql_shutdown_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_shutdown,
- (int *ret, MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level),
(parms->mysql, parms->shutdown_level),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_shutdown_start(int *ret, MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level)
+{
+MK_ASYNC_START_BODY(
+ mysql_shutdown,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
parms.shutdown_level= shutdown_level;
},
- int,
1,
r_int,
/* Nothing */)
+}
+int STDCALL
+mysql_shutdown_cont(int *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_dump_debug_info_start(). */
struct mysql_dump_debug_info_params {
MYSQL *mysql;
};
-MK_ASYNC_CALLS(
+static void
+mysql_dump_debug_info_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_dump_debug_info,
- (int *ret, MYSQL *mysql),
(parms->mysql),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_dump_debug_info_start(int *ret, MYSQL *mysql)
+{
+MK_ASYNC_START_BODY(
+ mysql_dump_debug_info,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
},
- int,
1,
r_int,
/* Nothing */)
+}
+int STDCALL
+mysql_dump_debug_info_cont(int *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_refresh_start(). */
struct mysql_refresh_params {
MYSQL *mysql;
unsigned int refresh_options;
};
-MK_ASYNC_CALLS(
+static void
+mysql_refresh_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_refresh,
- (int *ret, MYSQL *mysql, unsigned int refresh_options),
(parms->mysql, parms->refresh_options),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_refresh_start(int *ret, MYSQL *mysql, unsigned int refresh_options)
+{
+MK_ASYNC_START_BODY(
+ mysql_refresh,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
parms.refresh_options= refresh_options;
},
- int,
1,
r_int,
/* Nothing */)
+}
+int STDCALL
+mysql_refresh_cont(int *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_kill_start(). */
struct mysql_kill_params {
MYSQL *mysql;
unsigned long pid;
};
-MK_ASYNC_CALLS(
+static void
+mysql_kill_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_kill,
- (int *ret, MYSQL *mysql, unsigned long pid),
(parms->mysql, parms->pid),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_kill_start(int *ret, MYSQL *mysql, unsigned long pid)
+{
+MK_ASYNC_START_BODY(
+ mysql_kill,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
parms.pid= pid;
},
- int,
1,
r_int,
/* Nothing */)
+}
+int STDCALL
+mysql_kill_cont(int *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_set_server_option_start(). */
struct mysql_set_server_option_params {
MYSQL *mysql;
enum enum_mysql_set_option option;
};
-MK_ASYNC_CALLS(
+static void
+mysql_set_server_option_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_set_server_option,
- (int *ret, MYSQL *mysql, enum enum_mysql_set_option option),
(parms->mysql, parms->option),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_set_server_option_start(int *ret, MYSQL *mysql,
+ enum enum_mysql_set_option option)
+{
+MK_ASYNC_START_BODY(
+ mysql_set_server_option,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
parms.option= option;
},
- int,
1,
r_int,
/* Nothing */)
+}
+int STDCALL
+mysql_set_server_option_cont(int *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_ping_start(). */
struct mysql_ping_params {
MYSQL *mysql;
};
-MK_ASYNC_CALLS(
+static void
+mysql_ping_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_ping,
- (int *ret, MYSQL *mysql),
(parms->mysql),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_ping_start(int *ret, MYSQL *mysql)
+{
+MK_ASYNC_START_BODY(
+ mysql_ping,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
},
- int,
1,
r_int,
/* Nothing */)
+}
+int STDCALL
+mysql_ping_cont(int *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_stat_start(). */
struct mysql_stat_params {
MYSQL *mysql;
};
-MK_ASYNC_CALLS(
+static void
+mysql_stat_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_stat,
- (const char **ret, MYSQL *mysql),
(parms->mysql),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ const char *,
+ r_const_ptr)
+}
+int STDCALL
+mysql_stat_start(const char **ret, MYSQL *mysql)
+{
+MK_ASYNC_START_BODY(
+ mysql_stat,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
},
- const char *,
NULL,
r_const_ptr,
/* Nothing */)
+}
+int STDCALL
+mysql_stat_cont(const char **ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ NULL,
+ r_const_ptr)
+}
+/* Structure used to pass parameters from mysql_list_dbs_start(). */
struct mysql_list_dbs_params {
MYSQL *mysql;
const char *wild;
};
-MK_ASYNC_CALLS(
+static void
+mysql_list_dbs_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_list_dbs,
- (MYSQL_RES **ret, MYSQL *mysql, const char *wild),
(parms->mysql, parms->wild),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ MYSQL_RES *,
+ r_ptr)
+}
+int STDCALL
+mysql_list_dbs_start(MYSQL_RES **ret, MYSQL *mysql, const char *wild)
+{
+MK_ASYNC_START_BODY(
+ mysql_list_dbs,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
parms.wild= wild;
},
- MYSQL_RES *,
NULL,
r_ptr,
/* Nothing */)
+}
+int STDCALL
+mysql_list_dbs_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ NULL,
+ r_ptr)
+}
+/* Structure used to pass parameters from mysql_list_tables_start(). */
struct mysql_list_tables_params {
MYSQL *mysql;
const char *wild;
};
-MK_ASYNC_CALLS(
+static void
+mysql_list_tables_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_list_tables,
- (MYSQL_RES **ret, MYSQL *mysql, const char *wild),
(parms->mysql, parms->wild),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ MYSQL_RES *,
+ r_ptr)
+}
+int STDCALL
+mysql_list_tables_start(MYSQL_RES **ret, MYSQL *mysql, const char *wild)
+{
+MK_ASYNC_START_BODY(
+ mysql_list_tables,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
parms.wild= wild;
},
- MYSQL_RES *,
NULL,
r_ptr,
/* Nothing */)
+}
+int STDCALL
+mysql_list_tables_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ NULL,
+ r_ptr)
+}
+/* Structure used to pass parameters from mysql_list_processes_start(). */
struct mysql_list_processes_params {
MYSQL *mysql;
};
-MK_ASYNC_CALLS(
+static void
+mysql_list_processes_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_list_processes,
- (MYSQL_RES **ret, MYSQL *mysql),
(parms->mysql),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ MYSQL_RES *,
+ r_ptr)
+}
+int STDCALL
+mysql_list_processes_start(MYSQL_RES **ret, MYSQL *mysql)
+{
+MK_ASYNC_START_BODY(
+ mysql_list_processes,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
},
- MYSQL_RES *,
NULL,
r_ptr,
/* Nothing */)
+}
+int STDCALL
+mysql_list_processes_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ NULL,
+ r_ptr)
+}
+/* Structure used to pass parameters from mysql_list_fields_start(). */
struct mysql_list_fields_params {
MYSQL *mysql;
const char *table;
const char *wild;
};
-MK_ASYNC_CALLS(
+static void
+mysql_list_fields_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_list_fields,
- (MYSQL_RES **ret, MYSQL *mysql, const char *table, const char *wild),
(parms->mysql, parms->table, parms->wild),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ MYSQL_RES *,
+ r_ptr)
+}
+int STDCALL
+mysql_list_fields_start(MYSQL_RES **ret, MYSQL *mysql, const char *table,
+ const char *wild)
+{
+MK_ASYNC_START_BODY(
+ mysql_list_fields,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
parms.table= table;
parms.wild= wild;
},
- MYSQL_RES *,
NULL,
r_ptr,
/* Nothing */)
+}
+int STDCALL
+mysql_list_fields_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ NULL,
+ r_ptr)
+}
+/* Structure used to pass parameters from mysql_read_query_result_start(). */
struct mysql_read_query_result_params {
MYSQL *mysql;
};
-MK_ASYNC_CALLS(
+static void
+mysql_read_query_result_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_read_query_result,
- (my_bool *ret, MYSQL *mysql),
(parms->mysql),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ my_bool,
+ r_my_bool)
+}
+int STDCALL
+mysql_read_query_result_start(my_bool *ret, MYSQL *mysql)
+{
+MK_ASYNC_START_BODY(
+ mysql_read_query_result,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
},
- my_bool,
TRUE,
r_my_bool,
/* Nothing */)
+}
+int STDCALL
+mysql_read_query_result_cont(my_bool *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ TRUE,
+ r_my_bool)
+}
+/* Structure used to pass parameters from mysql_stmt_prepare_start(). */
struct mysql_stmt_prepare_params {
MYSQL_STMT *stmt;
const char *query;
unsigned long length;
};
-MK_ASYNC_CALLS(
+static void
+mysql_stmt_prepare_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_stmt_prepare,
- (int *ret, MYSQL_STMT *stmt, const char *query, unsigned long length),
(parms->stmt, parms->query, parms->length),
- MYSQL_STMT *stmt,
- stmt->mysql,
parms->stmt->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_stmt_prepare_start(int *ret, MYSQL_STMT *stmt, const char *query,
+ unsigned long length)
+{
+MK_ASYNC_START_BODY(
+ mysql_stmt_prepare,
+ stmt->mysql,
{
WIN_SET_NONBLOCKING(stmt->mysql)
parms.stmt= stmt;
parms.query= query;
parms.length= length;
},
- int,
1,
r_int,
/* If stmt->mysql==NULL then we will not block so can call directly. */
@@ -1099,22 +1353,40 @@ MK_ASYNC_CALLS(
*ret= mysql_stmt_prepare(stmt, query, length);
return 0;
})
+}
+int STDCALL
+mysql_stmt_prepare_cont(int *ret, MYSQL_STMT *stmt, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ stmt->mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_stmt_execute_start(). */
struct mysql_stmt_execute_params {
MYSQL_STMT *stmt;
};
-MK_ASYNC_CALLS(
+static void
+mysql_stmt_execute_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_stmt_execute,
- (int *ret, MYSQL_STMT *stmt),
(parms->stmt),
- MYSQL_STMT *stmt,
- stmt->mysql,
parms->stmt->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_stmt_execute_start(int *ret, MYSQL_STMT *stmt)
+{
+MK_ASYNC_START_BODY(
+ mysql_stmt_execute,
+ stmt->mysql,
{
WIN_SET_NONBLOCKING(stmt->mysql)
parms.stmt= stmt;
},
- int,
1,
r_int,
/*
@@ -1126,22 +1398,40 @@ MK_ASYNC_CALLS(
*ret= mysql_stmt_execute(stmt);
return 0;
})
+}
+int STDCALL
+mysql_stmt_execute_cont(int *ret, MYSQL_STMT *stmt, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ stmt->mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_stmt_fetch_start(). */
struct mysql_stmt_fetch_params {
MYSQL_STMT *stmt;
};
-MK_ASYNC_CALLS(
+static void
+mysql_stmt_fetch_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_stmt_fetch,
- (int *ret, MYSQL_STMT *stmt),
(parms->stmt),
- MYSQL_STMT *stmt,
- stmt->mysql,
parms->stmt->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_stmt_fetch_start(int *ret, MYSQL_STMT *stmt)
+{
+MK_ASYNC_START_BODY(
+ mysql_stmt_fetch,
+ stmt->mysql,
{
WIN_SET_NONBLOCKING(stmt->mysql)
parms.stmt= stmt;
},
- int,
1,
r_int,
/* If stmt->mysql==NULL then we will not block so can call directly. */
@@ -1150,22 +1440,40 @@ MK_ASYNC_CALLS(
*ret= mysql_stmt_fetch(stmt);
return 0;
})
+}
+int STDCALL
+mysql_stmt_fetch_cont(int *ret, MYSQL_STMT *stmt, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ stmt->mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_stmt_store_result_start(). */
struct mysql_stmt_store_result_params {
MYSQL_STMT *stmt;
};
-MK_ASYNC_CALLS(
+static void
+mysql_stmt_store_result_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_stmt_store_result,
- (int *ret, MYSQL_STMT *stmt),
(parms->stmt),
- MYSQL_STMT *stmt,
- stmt->mysql,
parms->stmt->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_stmt_store_result_start(int *ret, MYSQL_STMT *stmt)
+{
+MK_ASYNC_START_BODY(
+ mysql_stmt_store_result,
+ stmt->mysql,
{
WIN_SET_NONBLOCKING(stmt->mysql)
parms.stmt= stmt;
},
- int,
1,
r_int,
/* If stmt->mysql==NULL then we will not block so can call directly. */
@@ -1174,22 +1482,40 @@ MK_ASYNC_CALLS(
*ret= mysql_stmt_store_result(stmt);
return 0;
})
+}
+int STDCALL
+mysql_stmt_store_result_cont(int *ret, MYSQL_STMT *stmt, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ stmt->mysql,
+ 1,
+ r_int)
+}
+/* Structure used to pass parameters from mysql_stmt_close_start(). */
struct mysql_stmt_close_params {
MYSQL_STMT *stmt;
};
-MK_ASYNC_CALLS(
+static void
+mysql_stmt_close_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_stmt_close,
- (my_bool *ret, MYSQL_STMT *stmt),
(parms->stmt),
- MYSQL_STMT *stmt,
- stmt->mysql,
parms->stmt->mysql,
+ my_bool,
+ r_my_bool)
+}
+int STDCALL
+mysql_stmt_close_start(my_bool *ret, MYSQL_STMT *stmt)
+{
+MK_ASYNC_START_BODY(
+ mysql_stmt_close,
+ stmt->mysql,
{
WIN_SET_NONBLOCKING(stmt->mysql)
parms.stmt= stmt;
},
- my_bool,
TRUE,
r_my_bool,
/* If stmt->mysql==NULL then we will not block so can call directly. */
@@ -1198,22 +1524,40 @@ MK_ASYNC_CALLS(
*ret= mysql_stmt_close(stmt);
return 0;
})
+}
+int STDCALL
+mysql_stmt_close_cont(my_bool *ret, MYSQL_STMT *stmt, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ stmt->mysql,
+ TRUE,
+ r_my_bool)
+}
+/* Structure used to pass parameters from mysql_stmt_reset_start(). */
struct mysql_stmt_reset_params {
MYSQL_STMT *stmt;
};
-MK_ASYNC_CALLS(
+static void
+mysql_stmt_reset_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_stmt_reset,
- (my_bool *ret, MYSQL_STMT *stmt),
(parms->stmt),
- MYSQL_STMT *stmt,
- stmt->mysql,
parms->stmt->mysql,
+ my_bool,
+ r_my_bool)
+}
+int STDCALL
+mysql_stmt_reset_start(my_bool *ret, MYSQL_STMT *stmt)
+{
+MK_ASYNC_START_BODY(
+ mysql_stmt_reset,
+ stmt->mysql,
{
WIN_SET_NONBLOCKING(stmt->mysql)
parms.stmt= stmt;
},
- my_bool,
TRUE,
r_my_bool,
/* If stmt->mysql==NULL then we will not block so can call directly. */
@@ -1222,22 +1566,40 @@ MK_ASYNC_CALLS(
*ret= mysql_stmt_reset(stmt);
return 0;
})
+}
+int STDCALL
+mysql_stmt_reset_cont(my_bool *ret, MYSQL_STMT *stmt, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ stmt->mysql,
+ TRUE,
+ r_my_bool)
+}
+/* Structure used to pass parameters from mysql_stmt_free_result_start(). */
struct mysql_stmt_free_result_params {
MYSQL_STMT *stmt;
};
-MK_ASYNC_CALLS(
+static void
+mysql_stmt_free_result_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_stmt_free_result,
- (my_bool *ret, MYSQL_STMT *stmt),
(parms->stmt),
- MYSQL_STMT *stmt,
- stmt->mysql,
parms->stmt->mysql,
+ my_bool,
+ r_my_bool)
+}
+int STDCALL
+mysql_stmt_free_result_start(my_bool *ret, MYSQL_STMT *stmt)
+{
+MK_ASYNC_START_BODY(
+ mysql_stmt_free_result,
+ stmt->mysql,
{
WIN_SET_NONBLOCKING(stmt->mysql)
parms.stmt= stmt;
},
- my_bool,
TRUE,
r_my_bool,
/* If stmt->mysql==NULL then we will not block so can call directly. */
@@ -1246,20 +1608,41 @@ MK_ASYNC_CALLS(
*ret= mysql_stmt_free_result(stmt);
return 0;
})
+}
+int STDCALL
+mysql_stmt_free_result_cont(my_bool *ret, MYSQL_STMT *stmt, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ stmt->mysql,
+ TRUE,
+ r_my_bool)
+}
+/* Structure used to pass parameters from mysql_stmt_send_long_data_start(). */
struct mysql_stmt_send_long_data_params {
MYSQL_STMT *stmt;
unsigned int param_number;
const char *data;
unsigned long length;
};
-MK_ASYNC_CALLS(
+static void
+mysql_stmt_send_long_data_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_stmt_send_long_data,
- (my_bool *ret, MYSQL_STMT *stmt, unsigned int param_number, const char *data, unsigned long length),
(parms->stmt, parms->param_number, parms->data, parms->length),
- MYSQL_STMT *stmt,
- stmt->mysql,
parms->stmt->mysql,
+ my_bool,
+ r_my_bool)
+}
+int STDCALL
+mysql_stmt_send_long_data_start(my_bool *ret, MYSQL_STMT *stmt,
+ unsigned int param_number,
+ const char *data, unsigned long length)
+{
+MK_ASYNC_START_BODY(
+ mysql_stmt_send_long_data,
+ stmt->mysql,
{
WIN_SET_NONBLOCKING(stmt->mysql)
parms.stmt= stmt;
@@ -1267,7 +1650,6 @@ MK_ASYNC_CALLS(
parms.data= data;
parms.length= length;
},
- my_bool,
TRUE,
r_my_bool,
/* If stmt->mysql==NULL then we will not block so can call directly. */
@@ -1276,88 +1658,177 @@ MK_ASYNC_CALLS(
*ret= mysql_stmt_send_long_data(stmt, param_number, data, length);
return 0;
})
+}
+int STDCALL
+mysql_stmt_send_long_data_cont(my_bool *ret, MYSQL_STMT *stmt, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ stmt->mysql,
+ TRUE,
+ r_my_bool)
+}
+/* Structure used to pass parameters from mysql_commit_start(). */
struct mysql_commit_params {
MYSQL *mysql;
};
-MK_ASYNC_CALLS(
+static void
+mysql_commit_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_commit,
- (my_bool *ret, MYSQL *mysql),
(parms->mysql),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ my_bool,
+ r_my_bool)
+}
+int STDCALL
+mysql_commit_start(my_bool *ret, MYSQL *mysql)
+{
+MK_ASYNC_START_BODY(
+ mysql_commit,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
},
- my_bool,
TRUE,
r_my_bool,
/* Nothing */)
+}
+int STDCALL
+mysql_commit_cont(my_bool *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ TRUE,
+ r_my_bool)
+}
+/* Structure used to pass parameters from mysql_rollback_start(). */
struct mysql_rollback_params {
MYSQL *mysql;
};
-MK_ASYNC_CALLS(
+static void
+mysql_rollback_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_rollback,
- (my_bool *ret, MYSQL *mysql),
(parms->mysql),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ my_bool,
+ r_my_bool)
+}
+int STDCALL
+mysql_rollback_start(my_bool *ret, MYSQL *mysql)
+{
+MK_ASYNC_START_BODY(
+ mysql_rollback,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
},
- my_bool,
TRUE,
r_my_bool,
/* Nothing */)
+}
+int STDCALL
+mysql_rollback_cont(my_bool *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ TRUE,
+ r_my_bool)
+}
+/* Structure used to pass parameters from mysql_autocommit_start(). */
struct mysql_autocommit_params {
MYSQL *mysql;
my_bool auto_mode;
};
-MK_ASYNC_CALLS(
+static void
+mysql_autocommit_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_autocommit,
- (my_bool *ret, MYSQL *mysql, my_bool auto_mode),
(parms->mysql, parms->auto_mode),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ my_bool,
+ r_my_bool)
+}
+int STDCALL
+mysql_autocommit_start(my_bool *ret, MYSQL *mysql, my_bool auto_mode)
+{
+MK_ASYNC_START_BODY(
+ mysql_autocommit,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
parms.auto_mode= auto_mode;
},
- my_bool,
TRUE,
r_my_bool,
/* Nothing */)
+}
+int STDCALL
+mysql_autocommit_cont(my_bool *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ TRUE,
+ r_my_bool)
+}
+/* Structure used to pass parameters from mysql_next_result_start(). */
struct mysql_next_result_params {
MYSQL *mysql;
};
-MK_ASYNC_CALLS(
+static void
+mysql_next_result_start_internal(void *d)
+{
+MK_ASYNC_INTERNAL_BODY(
mysql_next_result,
- (int *ret, MYSQL *mysql),
(parms->mysql),
- MYSQL *mysql,
- mysql,
parms->mysql,
+ int,
+ r_int)
+}
+int STDCALL
+mysql_next_result_start(int *ret, MYSQL *mysql)
+{
+MK_ASYNC_START_BODY(
+ mysql_next_result,
+ mysql,
{
WIN_SET_NONBLOCKING(mysql)
parms.mysql= mysql;
},
- int,
1,
r_int,
/* Nothing */)
+}
+int STDCALL
+mysql_next_result_cont(int *ret, MYSQL *mysql, int ready_status)
+{
+MK_ASYNC_CONT_BODY(
+ mysql,
+ 1,
+ r_int)
+}
#endif
/*
+ The following functions are deprecated, and so have no non-blocking version:
+
+ mysql_connect
+ mysql_create_db
+ mysql_drop_db
+*/
+
+/*
The following functions can newer block, and so do not have special
non-blocking versions: