mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Auto-merge from mysql-next-mr.
This commit is contained in:
@@ -81,6 +81,9 @@ enum {
|
||||
static int record= 0, opt_sleep= -1;
|
||||
static char *opt_db= 0, *opt_pass= 0;
|
||||
const char *opt_user= 0, *opt_host= 0, *unix_sock= 0, *opt_basedir= "./";
|
||||
#ifdef HAVE_SMEM
|
||||
static char *shared_memory_base_name=0;
|
||||
#endif
|
||||
const char *opt_logdir= "";
|
||||
const char *opt_include= 0, *opt_charsets_dir;
|
||||
static int opt_port= 0;
|
||||
@@ -4859,6 +4862,8 @@ do_handle_error:
|
||||
<opts> - options to use for the connection
|
||||
* SSL - use SSL if available
|
||||
* COMPRESS - use compression if available
|
||||
* SHM - use shared memory if available
|
||||
* PIPE - use named pipe if available
|
||||
|
||||
*/
|
||||
|
||||
@@ -4867,6 +4872,7 @@ void do_connect(struct st_command *command)
|
||||
int con_port= opt_port;
|
||||
char *con_options;
|
||||
my_bool con_ssl= 0, con_compress= 0;
|
||||
my_bool con_pipe= 0, con_shm= 0;
|
||||
struct st_connection* con_slot;
|
||||
|
||||
static DYNAMIC_STRING ds_connection_name;
|
||||
@@ -4877,6 +4883,9 @@ void do_connect(struct st_command *command)
|
||||
static DYNAMIC_STRING ds_port;
|
||||
static DYNAMIC_STRING ds_sock;
|
||||
static DYNAMIC_STRING ds_options;
|
||||
#ifdef HAVE_SMEM
|
||||
static DYNAMIC_STRING ds_shm;
|
||||
#endif
|
||||
const struct command_arg connect_args[] = {
|
||||
{ "connection name", ARG_STRING, TRUE, &ds_connection_name, "Name of the connection" },
|
||||
{ "host", ARG_STRING, TRUE, &ds_host, "Host to connect to" },
|
||||
@@ -4904,6 +4913,11 @@ void do_connect(struct st_command *command)
|
||||
die("Illegal argument for port: '%s'", ds_port.str);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SMEM
|
||||
/* Shared memory */
|
||||
init_dynamic_string(&ds_shm, ds_sock.str, 0, 0);
|
||||
#endif
|
||||
|
||||
/* Sock */
|
||||
if (ds_sock.length)
|
||||
{
|
||||
@@ -4942,6 +4956,10 @@ void do_connect(struct st_command *command)
|
||||
con_ssl= 1;
|
||||
else if (!strncmp(con_options, "COMPRESS", 8))
|
||||
con_compress= 1;
|
||||
else if (!strncmp(con_options, "PIPE", 4))
|
||||
con_pipe= 1;
|
||||
else if (!strncmp(con_options, "SHM", 3))
|
||||
con_shm= 1;
|
||||
else
|
||||
die("Illegal option to connect: %.*s",
|
||||
(int) (end - con_options), con_options);
|
||||
@@ -4994,6 +5012,31 @@ void do_connect(struct st_command *command)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __WIN__
|
||||
if (con_pipe)
|
||||
{
|
||||
uint protocol= MYSQL_PROTOCOL_PIPE;
|
||||
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SMEM
|
||||
if (con_shm)
|
||||
{
|
||||
uint protocol= MYSQL_PROTOCOL_MEMORY;
|
||||
if (!ds_shm.length)
|
||||
die("Missing shared memory base name");
|
||||
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, ds_shm.str);
|
||||
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
|
||||
}
|
||||
else if(shared_memory_base_name)
|
||||
{
|
||||
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
|
||||
shared_memory_base_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Use default db name */
|
||||
if (ds_database.length == 0)
|
||||
dynstr_set(&ds_database, opt_db);
|
||||
@@ -5026,6 +5069,9 @@ void do_connect(struct st_command *command)
|
||||
dynstr_free(&ds_port);
|
||||
dynstr_free(&ds_sock);
|
||||
dynstr_free(&ds_options);
|
||||
#ifdef HAVE_SMEM
|
||||
dynstr_free(&ds_shm);
|
||||
#endif
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@@ -5692,6 +5738,12 @@ static struct my_option my_long_options[] =
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"server-file", 'F', "Read embedded server arguments from file.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifdef HAVE_SMEM
|
||||
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
"Base name of shared memory.", (uchar**) &shared_memory_base_name,
|
||||
(uchar**) &shared_memory_base_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
|
||||
0, 0, 0},
|
||||
#endif
|
||||
{"silent", 's', "Suppress all normal output. Synonym for --quiet.",
|
||||
(uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
|
||||
@@ -6743,10 +6795,8 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
|
||||
MYSQL_STMT *stmt;
|
||||
DYNAMIC_STRING ds_prepare_warnings;
|
||||
DYNAMIC_STRING ds_execute_warnings;
|
||||
ulonglong affected_rows;
|
||||
DBUG_ENTER("run_query_stmt");
|
||||
DBUG_PRINT("query", ("'%-.60s'", query));
|
||||
LINT_INIT(affected_rows);
|
||||
|
||||
/*
|
||||
Init a new stmt if it's not already one created for this connection
|
||||
@@ -6881,6 +6931,7 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
|
||||
Fetch info before fetching warnings, since it will be reset
|
||||
otherwise.
|
||||
*/
|
||||
|
||||
if (!disable_info)
|
||||
append_info(ds, mysql_stmt_affected_rows(stmt), mysql_info(mysql));
|
||||
|
||||
@@ -6895,18 +6946,17 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
|
||||
ds_warnings->length)
|
||||
{
|
||||
dynstr_append_mem(ds, "Warnings:\n", 10);
|
||||
if (ds_warnings->length)
|
||||
dynstr_append_mem(ds, ds_warnings->str,
|
||||
ds_warnings->length);
|
||||
if (ds_prepare_warnings.length)
|
||||
dynstr_append_mem(ds, ds_prepare_warnings.str,
|
||||
ds_prepare_warnings.length);
|
||||
if (ds_execute_warnings.length)
|
||||
dynstr_append_mem(ds, ds_execute_warnings.str,
|
||||
ds_execute_warnings.length);
|
||||
if (ds_warnings->length)
|
||||
dynstr_append_mem(ds, ds_warnings->str,
|
||||
ds_warnings->length);
|
||||
if (ds_prepare_warnings.length)
|
||||
dynstr_append_mem(ds, ds_prepare_warnings.str,
|
||||
ds_prepare_warnings.length);
|
||||
if (ds_execute_warnings.length)
|
||||
dynstr_append_mem(ds, ds_execute_warnings.str,
|
||||
ds_execute_warnings.length);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
end:
|
||||
@@ -7645,6 +7695,11 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SMEM
|
||||
if (shared_memory_base_name)
|
||||
mysql_options(&con->mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
|
||||
#endif
|
||||
|
||||
if (!(con->name = my_strdup("default", MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user