diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2009-11-10 17:36:38 -0200 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2009-11-10 17:36:38 -0200 |
commit | 17871ade9a47d1c2e34187c0be9c2cb880d29caa (patch) | |
tree | cd2a6e4896a743f9dc89d6b6b5273f487ba04ccb /client | |
parent | 80582b000f5cd5f6dfb24bed45df907b2c96ab02 (diff) | |
download | mariadb-git-17871ade9a47d1c2e34187c0be9c2cb880d29caa.tar.gz |
Backport of Bug#41860 to mysql-next-mr
------------------------------------------------------------
revno: 3317
revision-id: davi.arnaut@sun.com-20090522170916-fzc5ca3tjs9roy1t
parent: patrick.crews@sun.com-20090522152933-ole8s3suy4zqyvku
committer: Davi Arnaut <Davi.Arnaut@Sun.COM>
branch nick: 41860-6.0
timestamp: Fri 2009-05-22 14:09:16 -0300
message:
Bug#41860: Without Windows named pipe
The problem was that the patch for Bug#10374 broke named pipe
and shared memory transports on Windows due to a failure to
implement a dummy poll method for transports other than BSD
sockets. Another problem was that mysqltest lacked support
for named pipe and shared memory connections, which lead to
misleading test cases that were supposed run common queries
over both transports.
The solution is to properly implement, at the VIO layer, the
poll and is_connected methods. The is_connected method is
implemented for every suppported transport and the poll one
only where it makes sense. Furthermore, support for named pipe
and shared memory connections is added to mysqltest as to
enable testing of both transports using the test suite.
client/mysqltest.cc:
Add support for named pipe and shared memory connections.
include/violite.h:
Move private functions to vio/vio_priv.h
Add poll_read and is_connected methods.
mysql-test/t/named_pipe.test:
Run tests over a named pipe connection.
mysql-test/t/shm.test:
Run tests over a shared memory connection.
sql/item_func.cc:
Rename method.
sql/sql_class.cc:
Remove higher-level vio_is_connected implementation.
sql/sql_class.h:
Rename vio_is_connected to not conflict with the vio one.
Verify that there is a valid vio.
vio/vio.c:
Add poll_read and is_connected methods.
vio/vio_priv.h:
Add private functions.
vio/viosocket.c:
Implement the is_connected method for the various transports.
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqltest.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index b62d101e884..93e6e58e221 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -4859,6 +4859,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 +4869,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 +4880,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 +4910,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 +4953,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 +5009,26 @@ 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_OPT_PROTOCOL, &protocol); + mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, ds_shm.str); + } +#endif + + /* Use default db name */ if (ds_database.length == 0) dynstr_set(&ds_database, opt_db); @@ -5026,6 +5061,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; } |