Bug #2236 mysql_real_connect() doesnt default to named pipe w/ null host
Submitted: 30 Dec 2003 8:02 Modified: 6 Jan 2004 4:23
Reporter: Edmund Mierzwa Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.2 OS:Windows (WinXP)
Assigned to: CPU Architecture:Any

[30 Dec 2003 8:02] Edmund Mierzwa
Description:
If you call "mysql_real_connect(_my, NULL, _user, _pw, _db, 0, NULL,
CLIENT_MULTI_STATEMENTS)" using NULL as the host (argument 2) and then
check the connection type using "mysql_get_host_info()" it says it is
using "localhost via TCP/IP" instead of ". via named pipe" as when I
actually code the "." for the host.
The documentation for C function call "mysql_real_connect" says:

The value of host may be either a hostname or an IP address. If host is
NULL or the string "localhost", a connection to the local host is
assumed. If the OS supports sockets (Unix) or named pipes (Windows),
they are used instead of TCP/IP to connect to the server.

My cnf file has pipes turned on.
[mysqld]
enable-named-pipe

Am I reading the docs wrong? I posted on win32@lists.mysql.com but received no replies. The documented behavior is an advantage for my apps.

Using mysqld-nt Alpha 4.1.2 on WinXP, DELL 2.6ghz 600mg ram.

Thanks,
Ed

How to repeat:
mysql_real_connect(_my, NULL, _user, _pw, _db, 0, NULL,
CLIENT_MULTI_STATEMENTS);

mysql_get_host_info();

Suggested fix:
Use named pipes when possible or change the documentation?
[3 Jan 2004 11:19] MySQL Verification Team
I assume that you are using a server built for yourself since
the release package is 4.1.1. If yes could you please say me
what is the last changeset from the BK tree that you used for
to compile that server.
[5 Jan 2004 17:28] MySQL Verification Team
The changeset you have mentioned are only one day later regarding
to the changeset 1.1664.1.1 which has fixed a bug with the named
pipe. Then please open the file /vio/vio.c and verify around the
line 43:

#ifdef __WIN__
  if (type == VIO_TYPE_NAMEDPIPE)
  {
    vio->viodelete	=vio_delete;
    vio->vioerrno	=vio_errno;
    vio->read           =vio_read_pipe;
    vio->write          =vio_write_pipe;
    vio->fastsend	=vio_fastsend;
    vio->viokeepalive	=vio_keepalive;
    vio->should_retry	=vio_should_retry;
    vio->vioclose	=vio_close_pipe;
    vio->peer_addr	=vio_peer_addr;
    vio->in_addr	=vio_in_addr;
    vio->vioblocking	=vio_blocking;
    vio->is_blocking	=vio_is_blocking;
    vio->timeout	=vio_ignore_timeout;
  } 

if exist the line: vio->timeout	=vio_ignore_timeout;

if no, please update your repository and compile the server
and test it again. Otherwise let me know via this forum.
Thanks.