mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Add shared memory protocol and option --protocol
This commit is contained in:
@@ -152,6 +152,11 @@ static FILE *PAGER, *OUTFILE;
|
||||
static MEM_ROOT hash_mem_root;
|
||||
static uint prompt_counter;
|
||||
|
||||
#ifdef HAVE_SMEM
|
||||
static char *shared_memory_base_name=0;
|
||||
#endif
|
||||
static uint opt_protocol=0;
|
||||
|
||||
#include "sslopt-vars.h"
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
@@ -425,6 +430,9 @@ sig_handler mysql_end(int sig)
|
||||
my_free(full_username,MYF(MY_ALLOW_ZERO_PTR));
|
||||
my_free(part_username,MYF(MY_ALLOW_ZERO_PTR));
|
||||
my_free(default_prompt,MYF(MY_ALLOW_ZERO_PTR));
|
||||
#ifdef HAVE_SMEM
|
||||
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
|
||||
#endif
|
||||
my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
|
||||
mysql_server_end();
|
||||
free_defaults(defaults_argv);
|
||||
@@ -532,6 +540,8 @@ static struct my_option my_long_options[] =
|
||||
{"prompt", OPT_PROMPT, "Set the mysql prompt to this value.",
|
||||
(gptr*) ¤t_prompt, (gptr*) ¤t_prompt, 0, GET_STR_ALLOC,
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory)",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"quick", 'q',
|
||||
"Don't cache result, print it row by row. This may slow down the server if the output is suspended. Doesn't use history file. ",
|
||||
(gptr*) &quick, (gptr*) &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
@@ -540,6 +550,11 @@ static struct my_option my_long_options[] =
|
||||
0, 0, 0},
|
||||
{"silent", 's', "Be more silent.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
|
||||
0, 0},
|
||||
#ifdef HAVE_SMEM
|
||||
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
"Base name of shared memory", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
|
||||
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"socket", 'S', "Socket file to use for connection.",
|
||||
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR_ALLOC,
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
@@ -644,6 +659,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
case OPT_NOPAGER:
|
||||
printf("WARNING: option deprecated; use --disable-pager instead.\n");
|
||||
opt_nopager= 1;
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0)
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'A':
|
||||
rehash= 0;
|
||||
@@ -706,7 +730,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
break;
|
||||
case 'W':
|
||||
#ifdef __WIN__
|
||||
opt_mysql_unix_port= my_strdup(MYSQL_NAMEDPIPE, MYF(0));
|
||||
opt_protocol = MYSQL_PROTOCOL_PIPE;
|
||||
#endif
|
||||
break;
|
||||
#include <sslopt-case.h>
|
||||
@@ -2349,6 +2373,12 @@ sql_real_connect(char *host,char *database,char *user,char *password,
|
||||
if (opt_use_ssl)
|
||||
mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
|
||||
opt_ssl_capath, opt_ssl_cipher);
|
||||
#endif
|
||||
if (opt_protocol)
|
||||
mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol);
|
||||
#ifdef HAVE_SMEM
|
||||
if (shared_memory_base_name)
|
||||
mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
|
||||
#endif
|
||||
if (safe_updates)
|
||||
{
|
||||
|
Reference in New Issue
Block a user