thekid Mon Nov 10 10:59:45 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/sybase_ct php_sybase_ct.c
Log:
- Added optional parameter "new" to sybase_connect
# [DOC] If a second call is made to sybase_connect() with the same arguments
# no new link will be established, but instead, the link identifier of the
# already opened link will be returned. The new parameter modifies this
# behavior and makes sybase_connect() always open a new link, even if
# sybase_connect() was called before with the same parameters.
http://cvs.php.net/viewvc.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5.2.13.2.12&r2=1.103.2.5.2.13.2.13&diff_format=u
Index: php-src/ext/sybase_ct/php_sybase_ct.c
diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.13.2.12
php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.13.2.13
--- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.13.2.12 Sun Nov 9
11:39:14 2008
+++ php-src/ext/sybase_ct/php_sybase_ct.c Mon Nov 10 10:59:44 2008
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sybase_ct.c,v 1.103.2.5.2.13.2.12 2008/11/09 11:39:14 thekid Exp $ */
+/* $Id: php_sybase_ct.c,v 1.103.2.5.2.13.2.13 2008/11/10 10:59:44 thekid Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -49,6 +49,7 @@
ZEND_ARG_INFO(0, password)
ZEND_ARG_INFO(0, charset)
ZEND_ARG_INFO(0, appname)
+ ZEND_ARG_INFO(0, new)
ZEND_END_ARG_INFO()
static
@@ -753,13 +754,19 @@
{
char *user, *passwd, *host, *charset, *appname;
char *hashed_details;
- int hashed_details_length;
- int len;
+ int hashed_details_length, len;
+ zend_bool new = 0;
sybase_link *sybase_ptr;
host= user= passwd= charset= appname= NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sssss", &host, &len, &user, &len,
&passwd, &len, &charset, &len, &appname, &len) == FAILURE) {
- return;
+ if (persistent) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!s!s!", &host, &len, &user,
&len, &passwd, &len, &charset, &len, &appname, &len) == FAILURE) {
+ return;
+ }
+ } else {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!s!s!b", &host, &len, &user,
&len, &passwd, &len, &charset, &len, &appname, &len, &new) == FAILURE) {
+ return;
+ }
}
hashed_details_length = spprintf(
&hashed_details,
@@ -865,7 +872,7 @@
* if it doesn't, open a new sybase 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 && zend_hash_find(&EG(regular_list), hashed_details,
hashed_details_length+1, (void **) &index_ptr)==SUCCESS) {
int type, link;
void *ptr;
@@ -929,7 +936,7 @@
}
-/* {{{ proto int sybase_connect([string host [, string user [, string password [, string charset [, string appname]]]]])
+/* {{{ proto int sybase_connect([string host [, string user [, string password
[, string charset [, string appname [, bool new]]]]]])
Open Sybase server connection */
PHP_FUNCTION(sybase_connect)
{