MySQL connect functionality lost from PHP3

From: Date: Wed, 05 Jan 2000 16:02:49 +0000
Subject: MySQL connect functionality lost from PHP3
Groups: php.version4 
Request: Send a blank email to php-version4+get-8927@lists.php.net to get a copy of this message
Just downloaded the PHP4 beta 3 to check out. I see that a change I submitted for PHP3 to allow mysql connections to a specific UNIX socket did not make it to PHP4. There were a number of problems with my original change, but I miss the functionality. Here is a diff of the changes I made to the PHP4 source to add this functionality back. Could someone review and apply the change if deemed appropriate? Thanks. *** php_mysql.c Fri Nov 5 14:43:53 1999 --- php_mysql.c.socket Tue Jan 4 13:15:21 2000 *************** *** 368,374 **** #if APACHE void (*handler) (int); #endif ! char *user,*passwd,*host,*tmp; char *hashed_details; int hashed_details_length,port; MYSQL *mysql; --- 368,374 ---- #if APACHE void (*handler) (int); #endif ! char *user,*passwd,*host,*mysqlsock,*tmp; char *hashed_details; int hashed_details_length,port; MYSQL *mysql; *************** *** 379,385 **** if (ARG_COUNT(ht)>0) { php_error(E_NOTICE,"SQL safe mode in effect - ignoring host/user/password information"); } ! host=passwd=NULL; user=_php3_get_current_user(); hashed_details_length = strlen(user)+5+3; hashed_details = (char *) emalloc(hashed_details_length+1); --- 379,385 ---- if (ARG_COUNT(ht)>0) { php_error(E_NOTICE,"SQL safe mode in effect - ignoring host/user/password information"); } ! host=passwd=mysqlsock=NULL; user=_php3_get_current_user(); hashed_details_length = strlen(user)+5+3; hashed_details = (char *) emalloc(hashed_details_length+1); *************** *** 388,393 **** --- 388,394 ---- host = MySG(default_host); user = MySG(default_user); passwd = MySG(default_password); + mysqlsock = NULL; switch(ARG_COUNT(ht)) { case 0: /* defaults */ *************** *** 443,449 **** if (host && (tmp=strchr(host,':'))) { *tmp=0; tmp++; ! port = atoi(tmp); } else { port = MySG(default_port); } --- 444,454 ---- if (host && (tmp=strchr(host,':'))) { *tmp=0; tmp++; ! if (tmp[0] != '/') { ! port = atoi(tmp); ! } else { ! mysqlsock = tmp; ! } } else { port = MySG(default_port); } *************** *** 476,482 **** 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) { #else if (mysql_connect(mysql,host,user,passwd)==NULL) { #endif --- 481,487 ---- 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,mysqlsock,0)==NULL) { #else if (mysql_connect(mysql,host,user,passwd)==NULL) { #endif *************** *** 514,520 **** 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) { #else if (mysql_connect(le->ptr,host,user,passwd)==NULL) { #endif --- 519,525 ---- 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,mysqlsock,0)==NULL) { #else if (mysql_connect(le->ptr,host,user,passwd)==NULL) { #endif *************** *** 567,573 **** 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) { #else if (mysql_connect(mysql,host,user,passwd)==NULL) { #endif --- 572,578 ---- 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,mysqlsock,0)==NULL) { #else if (mysql_connect(mysql,host,user,passwd)==NULL) { #endif ----------------------------------------------------------------------- Orion Poplawski, OPoplawski@cqg.com, Tel: (303) 440-4462x17, Fax: -4507 CQG, Inc., 250 Arapahoe Avenue, Boulder, CO 80302

« previous php.version4 (#8927) next »