Re: Small modfication request for mysql_connect
| From: | Orion Poplawski | Date: | Mon, 14 Jun 1999 19:55:30 +0000 |
| Subject: | Re: Small modfication request for mysql_connect | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-6960@lists.php.net to get a copy of this message | ||
Jim Winstead Writes:
> On Jun 11, Orion Poplawski wrote:
> > I have a modification for mysql_connect to allow it to specify the
> > location of the UNIX domain socket if connecting to a server on the
> > localhost.
>
> Your change sounds good. Just send a patch to php-dev@lists.php.net.
>
> Jim
>
Here's the patch. Not sure if it's the exact format you'd like, but
it's a diff -c output between the current CVS mysql.c and a new
mysql.c.new with the new capability:
*** mysql.c Mon Jun 14 09:07:22 1999
--- mysql.c.new Mon Jun 14 10:34:40 1999
***************
*** 388,390 ****
#endif
! char *user,*passwd,*host,*tmp;
char *hashed_details;
--- 388,390 ----
#endif
! char *user,*passwd,*host,*socket,*tmp;
char *hashed_details;
***************
*** 400,402 ****
}
! host=passwd=NULL;
user=_php3_get_current_user();
--- 400,402 ----
}
! host=passwd=socket=NULL;
user=_php3_get_current_user();
***************
*** 466,468 ****
tmp++;
! port = atoi(tmp);
} else {
--- 466,472 ----
tmp++;
! if (tmp[0] != '/') {
! port = atoi(tmp);
! } else {
! socket = tmp;
! }
} else {
***************
*** 499,501 ****
mysql_init(mysql);
! if (mysql_real_connect(mysql,host,user,passwd,NULL,port,NULL,0)==NULL) {
#else
--- 503,505 ----
mysql_init(mysql);
! if (mysql_real_connect(mysql,host,user,passwd,NULL,port,socket,0)==NULL) {
#else
***************
*** 537,539 ****
#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
--- 541,543 ----
#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
! if
(mysql_real_connect(le->ptr,host,user,passwd,NULL,port,socket,0)==NULL) {
#else
***************
*** 593,595 ****
mysql_init(mysql);
! if (mysql_real_connect(mysql,host,user,passwd,NULL,port,NULL,0)==NULL) {
#else
--- 597,599 ----
mysql_init(mysql);
! if (mysql_real_connect(mysql,host,user,passwd,NULL,port,socket,0)==NULL) {
#else
-----------------------------------------------------------------------
Orion Poplawski, OPoplawski@cqg.com, Tel: (303) 440-4462x17, Fax: -4507
CQG, Inc., 250 Arapahoe Avenue, Boulder, CO 80302