abies           Mon May 31 20:52:15 2004 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/informix       ifx.ec 
  Log:
  MFH: Fixed bug #28569 (connection id is not thread safe)
  
http://cvs.php.net/diff.php/php-src/ext/informix/ifx.ec?r1=1.69.2.26&r2=1.69.2.27&ty=u
Index: php-src/ext/informix/ifx.ec
diff -u php-src/ext/informix/ifx.ec:1.69.2.26 php-src/ext/informix/ifx.ec:1.69.2.27
--- php-src/ext/informix/ifx.ec:1.69.2.26       Mon May 31 16:59:56 2004
+++ php-src/ext/informix/ifx.ec Mon May 31 20:52:14 2004
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: ifx.ec,v 1.69.2.26 2004/05/31 20:59:56 pajoye Exp $ */
+/* $Id: ifx.ec,v 1.69.2.27 2004/06/01 00:52:14 abies Exp $ */
 
 /* -------------------------------------------------------------------
  * if you want a function reference : "grep '^\*\*' ifx.ec" will give
@@ -54,6 +54,12 @@
 #include <winsock.h>
 #endif
 
+#ifdef ZTS
+#define IFX_THRD_ID tsrm_thread_id()
+#else
+#define IFX_THRD_ID 0
+#endif
+
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
@@ -542,7 +548,7 @@
                        /* create the link */
                        ifx = (char *) malloc(sizeof(IFX));
                        IFXG(connectionid)++;
-                       sprintf(ifx, "%s%x", SAFE_STRING(user), IFXG(connectionid));
+                       sprintf(ifx, "%s%x_%x", SAFE_STRING(user), 
IFX_THRD_ID,IFXG(connectionid));
                        
                        EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd 
WITH CONCURRENT TRANSACTION;  
        
@@ -645,7 +651,7 @@
 
                ifx = (char *) emalloc(sizeof(IFX));
                IFXG(connectionid)++;
-               sprintf(ifx, "connec%x", IFXG(connectionid));
+               sprintf(ifx, "connec%x_%x", IFX_THRD_ID, IFXG(connectionid));
                
                EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH 
CONCURRENT TRANSACTION;
 
@@ -818,10 +824,10 @@
        statement = Z_STRVAL_PP(query);
 
        IFXG(cursorid)++;
-       sprintf(statemid, "statem%x", IFXG(cursorid)); 
-       sprintf(cursorid, "cursor%x", IFXG(cursorid)); 
-       sprintf(descrpid, "descrp%x", IFXG(cursorid)); 
-       sprintf(i_descrpid, "i_descrp%x", IFXG(cursorid));
+       sprintf(statemid, "statem%x_%x", IFX_THRD_ID, IFXG(cursorid));
+       sprintf(cursorid, "cursor%x_%x", IFX_THRD_ID, IFXG(cursorid));
+       sprintf(descrpid, "descrp%x_%x", IFX_THRD_ID, IFXG(cursorid));
+       sprintf(i_descrpid, "i_descrp%x_%x", IFX_THRD_ID,IFXG(cursorid));
 
        EXEC SQL set connection :ifx;
        PHP_IFX_CHECK_CONNECTION(ifx);
@@ -1242,10 +1248,10 @@
        statement = Z_STRVAL_PP(query);
 
        IFXG(cursorid)++;
-       sprintf(statemid, "statem%x", IFXG(cursorid)); 
-       sprintf(cursorid, "cursor%x", IFXG(cursorid)); 
-       sprintf(descrpid, "descrp%x", IFXG(cursorid)); 
-       sprintf(i_descrpid, "i_descrp%x", IFXG(cursorid));
+       sprintf(statemid, "statem%x_%x", IFX_THRD_ID, IFXG(cursorid));
+       sprintf(cursorid, "cursor%x_%x", IFX_THRD_ID, IFXG(cursorid));
+       sprintf(descrpid, "descrp%x_%x", IFX_THRD_ID, IFXG(cursorid));
+       sprintf(i_descrpid, "i_descrp%x_%x", IFX_THRD_ID,IFXG(cursorid));
 
        EXEC SQL set connection :ifx;
        PHP_IFX_CHECK_CONNECTION(ifx);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to