diff options
Diffstat (limited to 'src/mysql.c')
-rw-r--r-- | src/mysql.c | 11 |
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; } |