summaryrefslogtreecommitdiff
path: root/gd_content_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'gd_content_interface.c')
-rw-r--r--gd_content_interface.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/gd_content_interface.c b/gd_content_interface.c
index f609990..4537b21 100644
--- a/gd_content_interface.c
+++ b/gd_content_interface.c
@@ -45,17 +45,41 @@ int GdInitDatabase( MYSQL *db )
{
return -1;
}
-
- if( mysql_real_connect( db,
- the_setup.DbHost,
- the_setup.DbUser,
- the_setup.DbPass,
- the_setup.DbName,
- the_setup.DbPort,
- NULL, 0 ) == NULL )
+
+ if (the_setup.DbSocket != NULL)
{
- return -2;
- }
+ mgDebug(1,"Using sockets for connecting to Database.");
+
+ //mgDebug(3,"Socket is: '%s'",the_setup.DbSocket);
+ //mgDebug(3,"DbUser is: '%s'",the_setup.DbUser);
+ //mgDebug(3,"DbPassword is: '%s'",the_setup.DbPass);
+
+ if( mysql_real_connect( db,
+ "",
+ the_setup.DbUser,
+ the_setup.DbPass,
+ the_setup.DbName,
+ 0,
+ the_setup.DbSocket, 0 ) == NULL )
+ {
+ return -2;
+ } // if mysql_real_connect
+ } //if DbSocket
+ else
+ {
+ mgDebug(1,"Using TCP-host for connecting to Database.");
+ if( mysql_real_connect( db,
+ the_setup.DbHost,
+ the_setup.DbUser,
+ the_setup.DbPass,
+ the_setup.DbName,
+ the_setup.DbPort,
+ "", 0 ) == NULL )
+ {
+ return -2;
+ } // if mysql_real_connect
+ } // else (if DbSocket)
+
return 0;
}