aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2004-02-14 10:00:24 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2004-02-14 10:00:24 +0000
commitdcda71fbaac3620758797565a3345ff28e48cfb9 (patch)
tree0a2b6619f4c31398bd5ce67af1d92c5d3d76fd1f /src
parent4c6de4be1b8652212d06188a4dd511243babd0be (diff)
downloadgamma-dcda71fbaac3620758797565a3345ff28e48cfb9.tar.gz
gamma-dcda71fbaac3620758797565a3345ff28e48cfb9.tar.bz2
(s_mysql_connect): If hostname starts with a slash, treat it as a path to UNIX socket.
Diffstat (limited to 'src')
-rw-r--r--src/mysql.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mysql.c b/src/mysql.c
index fdaaeee..ea74d5b 100644
--- a/src/mysql.c
+++ b/src/mysql.c
@@ -1,5 +1,5 @@
/* This file is part of guile-sql.
- Copyright (C) 2002 Sergey Poznyakoff
+ Copyright (C) 2002,2004 Sergey Poznyakoff
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,13 +46,18 @@ s_mysql_connect (char *hostname, int port,
MYSQL *mysql;
SCM smob;
struct sql_connect *conn;
-
+ char *socket_path = NULL;
+
mysql = mysql_init(NULL);
if (!mysql)
return SCM_BOOL_F;
+ if (hostname[0] == '/') {
+ socket_path = hostname;
+ hostname = "localhost";
+ }
if (!mysql_real_connect(mysql, hostname,
user, pass, dbname,
- port, NULL, 0)) {
+ port, socket_path, 0)) {
mysql_close(mysql);
return SCM_BOOL_F;
}

Return to:

Send suggestions and report system problems to the System administrator.