added amb1276 - local socket support
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401796
This commit is contained in:
parent
46c98c64fa
commit
99ebeb1645
@ -94,6 +94,7 @@ const char *MyDriver::GetProductName()
|
|||||||
MYSQL *Connect(const DatabaseInfo *info, char *error, size_t maxlength)
|
MYSQL *Connect(const DatabaseInfo *info, char *error, size_t maxlength)
|
||||||
{
|
{
|
||||||
MYSQL *mysql = mysql_init(NULL);
|
MYSQL *mysql = mysql_init(NULL);
|
||||||
|
const char *host = NULL, *socket = NULL;
|
||||||
|
|
||||||
if (info->maxTimeout > 0)
|
if (info->maxTimeout > 0)
|
||||||
{
|
{
|
||||||
@ -106,13 +107,24 @@ MYSQL *Connect(const DatabaseInfo *info, char *error, size_t maxlength)
|
|||||||
my_bool my_true = true;
|
my_bool my_true = true;
|
||||||
mysql_options(mysql, MYSQL_OPT_RECONNECT, (const char *)&my_true);
|
mysql_options(mysql, MYSQL_OPT_RECONNECT, (const char *)&my_true);
|
||||||
|
|
||||||
|
if (info->host[0] == '/')
|
||||||
|
{
|
||||||
|
host = "localhost";
|
||||||
|
socket = info->host;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
host = info->host;
|
||||||
|
socket = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mysql_real_connect(mysql,
|
if (!mysql_real_connect(mysql,
|
||||||
info->host,
|
host,
|
||||||
info->user,
|
info->user,
|
||||||
info->pass,
|
info->pass,
|
||||||
info->database,
|
info->database,
|
||||||
info->port,
|
info->port,
|
||||||
NULL,
|
socket,
|
||||||
M_CLIENT_MULTI_RESULTS))
|
M_CLIENT_MULTI_RESULTS))
|
||||||
{
|
{
|
||||||
/* :TODO: expose UTIL_Format from smutil! */
|
/* :TODO: expose UTIL_Format from smutil! */
|
||||||
|
Loading…
Reference in New Issue
Block a user