diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2004-02-15 19:37:24 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2004-02-15 19:37:24 +0000 |
commit | 6223f2de19299c8c076870ced9015f960b3e69c9 (patch) | |
tree | ad636e3704f0a32f72b95772536ed90fc9dee982 /src | |
parent | e6f30fab4696a73db4150890ef7b7255c55ab11b (diff) | |
download | ellinika-6223f2de19299c8c076870ced9015f960b3e69c9.tar.gz ellinika-6223f2de19299c8c076870ced9015f960b3e69c9.tar.bz2 |
If hostname begins with a slash, treat it as a path to UNIX socket
git-svn-id: file:///home/puszcza/svnroot/ellinika/trunk@11 941c8c0f-9102-463b-b60b-cd22ce0e6858
Diffstat (limited to 'src')
-rw-r--r-- | src/sql.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -10,10 +10,16 @@ MYSQL_RES *result; void sql_connect() { + char *socket_path = NULL; + + if (sql_host[0] == '/') { + socket_path = sql_host; + sql_host = "localhost"; + } if (!mysql_real_connect(&mysql, sql_host, sql_user, sql_password, sql_database, sql_port, - NULL, 0)) { + socket_path, 0)) { fprintf(stderr, "cannot connect to MySQL server: %s\n", mysql_error(&mysql)); |