CVS update: php3/functions

From: Date: Mon, 14 Jun 1999 21:59:57 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-6974@lists.php.net to get a copy of this message
Date: Monday June 14, 1999 @ 17:59 Author: jim Update of /repository/php3/functions In directory php:/tmp/cvs-serv2689/functions Modified Files: mysql.c Log Message: Add "localhost:/path/to/socket" syntax patch from Orion Poplawski. Index: php3/functions/mysql.c diff -u php3/functions/mysql.c:1.182 php3/functions/mysql.c:1.183 --- php3/functions/mysql.c:1.182 Thu Jun 10 16:14:12 1999 +++ php3/functions/mysql.c Mon Jun 14 17:59:57 1999 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysql.c,v 1.182 1999/06/10 20:14:12 sas Exp $ */ +/* $Id: mysql.c,v 1.183 1999/06/14 21:59:57 jim Exp $ */ /* TODO: @@ -386,7 +386,7 @@ #if APACHE void (*handler) (int); #endif - char *user,*passwd,*host,*tmp; + char *user,*passwd,*host,*socket,*tmp; char *hashed_details; int hashed_details_length,port; MYSQL *mysql; @@ -398,7 +398,7 @@ if (ARG_COUNT(ht)>0) { php3_error(E_NOTICE,"SQL safe mode in effect - ignoring host/user/password information"); } - host=passwd=NULL; + host=passwd=socket=NULL; user=_php3_get_current_user(); hashed_details_length = strlen(user)+5+3; hashed_details = (char *) emalloc(hashed_details_length+1); @@ -464,7 +464,11 @@ if (host && (tmp=strchr(host,':'))) { *tmp=0; tmp++; - port = atoi(tmp); + if (tmp[0] != '/') { + port = atoi(tmp); + } else { + socket = tmp; + } } else { port = MySQL_GLOBAL(php3_mysql_module).default_port; } @@ -497,7 +501,7 @@ mysql = (MYSQL *) malloc(sizeof(MYSQL)); #if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */ mysql_init(mysql); - if (mysql_real_connect(mysql,host,user,passwd,NULL,port,NULL,0)==NULL) { + if (mysql_real_connect(mysql,host,user,passwd,NULL,port,socket,0)==NULL) { #else if (mysql_connect(mysql,host,user,passwd)==NULL) { #endif @@ -535,7 +539,7 @@ signal(SIGPIPE,handler); #endif #if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */ - if (mysql_real_connect(le->ptr,host,user,passwd,NULL,port,NULL,0)==NULL) { + if (mysql_real_connect(le->ptr,host,user,passwd,NULL,port,socket,0)==NULL) { #else if (mysql_connect(le->ptr,host,user,passwd)==NULL) { #endif @@ -591,7 +595,7 @@ mysql = (MYSQL *) emalloc(sizeof(MYSQL)); #if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */ mysql_init(mysql); - if (mysql_real_connect(mysql,host,user,passwd,NULL,port,NULL,0)==NULL) { + if (mysql_real_connect(mysql,host,user,passwd,NULL,port,socket,0)==NULL) { #else if (mysql_connect(mysql,host,user,passwd)==NULL) { #endif

« previous php.dev (#6974) next »