Re: cvs: php4 /ext/mysql php_mysql.c
| From: | Andi Gutmans | Date: | Thu, 22 Nov 2001 21:46:46 +0000 |
| Subject: | Re: cvs: php4 /ext/mysql php_mysql.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-8289@lists.php.net to get a copy of this message | ||
Is this patch definitely OK? Under which circumstances is it needed?
Andi
At 07:58 AM 11/22/2001 +0000, Derick Rethans wrote:
derick Thu Nov 22 02:58:37 2001 EDTModified files:/php4/ext/mysql php_mysql.cLog: - Added a parameter to mysql_connect to force a new database link to becreated. (patch by Markus Fischer <mfischer@guru.josefine.at>)@- Added a parameter to mysql_connect to force a new database link to be @ created. (Markus, Derick) Index: php4/ext/mysql/php_mysql.c diff -u php4/ext/mysql/php_mysql.c:1.107 php4/ext/mysql/php_mysql.c:1.108--- php4/ext/mysql/php_mysql.c:1.107 Thu Nov 8 17:05:56 2001+++ php4/ext/mysql/php_mysql.c Thu Nov 22 02:58:37 2001 @@ -16,7 +16,7 @@+----------------------------------------------------------------------+*/ -/* $Id: php_mysql.c,v 1.107 2001/11/08 22:05:56 eschmid Exp $ */ +/* $Id: php_mysql.c,v 1.108 2001/11/22 07:58:37 derick Exp $ */ /* TODO: @@ -431,8 +431,8 @@int hashed_details_length, port = MYSQL_PORT; php_mysql_conn *mysql=NULL; void (*handler) (int); - zval **z_host=NULL, **z_user=NULL, **z_passwd=NULL; - zend_bool free_host=0; + zval **z_host=NULL, **z_user=NULL, **z_passwd=NULL, **z_new_link=NULL; + zend_bool free_host=0, new_link=0;socket = MySG(default_socket);@@ -477,6 +477,17 @@passwd = Z_STRVAL_PP(z_passwd); } break; + case 4: { + if (zend_get_parameters_ex(4, &z_host, &z_user, &z_passwd, &z_new_link) == FAILURE) { + MYSQL_DO_CONNECT_RETURN_FALSE(); + } + convert_to_string_ex(z_user); + convert_to_string_ex(z_passwd); + user = Z_STRVAL_PP(z_user); + passwd = Z_STRVAL_PP(z_passwd); + new_link = Z_BVAL_PP(z_new_link); + } + break; default: WRONG_PARAM_COUNT; break;@@ -532,7 +543,7 @@list_entry *le;/* try to find if we already have this link in our persistent list */ - if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */ + if (new_link || zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */ list_entry new_le;if (MySG(max_links)!=-1 && MySG(num_links)>=MySG(max_links)) {@@ -612,7 +623,7 @@* if it doesn't, open a new mysql link, add it to the resource list, * and add a pointer to it with hashed_details as the key. */ - if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length+1,(void **) &index_ptr)==SUCCESS) { + if (!new_link && zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length+1,(void **) &index_ptr)==SUCCESS) { int type, link; void *ptr;-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net For additional commands, e-mail: php-cvs-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net