Re: RE : TR : Bug #21549 [Opn->Fbk]: problem with INGRES II permanent connexions

From: Date: Fri, 31 Jan 2003 09:14:20 +0000
Subject: Re: RE : TR : Bug #21549 [Opn->Fbk]: problem with INGRES II permanent connexions
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-93834@lists.php.net to get a copy of this message
On Thu, 30 Jan 2003, pierre-marie mouliere wrote: > > Please attached find the patch We can not accept this patch as we can not allow: 1. having /* ARC INTERNATIONAL */ on every line you touched, 2. using the prefix _ai_ to functions you changed 3. indentation with spaces, and totally ignoring the Coding Standards Derick -- ------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ JDI Media Solutions http://www.jdimedia.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ -------------------------------------------------------------------------

192,195c192,209 < static void _clean_ii_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC) < { < II_LINK *link = (II_LINK *) rsrc->ptr; < IIAPI_AUTOPARM autoParm; --- > /* Create this function so it can be called by the close function */ > /* (calling parameter is link) */ > /* May be not the best way to do it */ > static void _ai_clean_ii_plink(II_LINK *link) /* ARC INTERNATIONAL */ > { /* ARC INTERNATIONAL */ > int ai_error = 0; /* ARC INTERNATIONAL */ > IIAPI_DISCONNPARM disconnParm; /* ARC INTERNATIONAL */ > IIAPI_AUTOPARM autoParm; /* ARC INTERNATIONAL */ > /* if link as always been marked as broken do nothing */ > /* This because we call this function directly from close function */ > /* And it's called by ZEND garbage at end of script */ > if (link->connHandle == NULL) { /* ARC INTERNATIONAL */ > return; /* ARC INTERNATIONAL */ > } /* ARC INTERNATIONAL */ > if(link->stmtHandle && _close_statement(link)) { /* ARC INTERNATIONAL */ > php_error(E_WARNING, "Ingres II: Unable to close statement !!"); /* ARC INTERNATIONAL */ > ai_error = 1; /* ARC INTERNATIONAL */ > } /* ARC INTERNATIONAL */ 197c211 < if (link->autocommit) { --- > if(link->autocommit) { /* ARC INTERNATIONAL */ 199,201c213,216 < if (link->stmtHandle && _close_statement(link)) { < php_error(E_WARNING, "Ingres II: Unable to close statement !!"); < } --- > autoParm.ac_genParm.gp_callback = NULL; /* ARC INTERNATIONAL */ > autoParm.ac_genParm.gp_closure = NULL; /* ARC INTERNATIONAL */ > autoParm.ac_connHandle = link->connHandle; /* ARC INTERNATIONAL */ > autoParm.ac_tranHandle = link->tranHandle; /* ARC INTERNATIONAL */ 203,206c218,219 < autoParm.ac_genParm.gp_callback = NULL; < autoParm.ac_genParm.gp_closure = NULL; < autoParm.ac_connHandle = link->connHandle; < autoParm.ac_tranHandle = link->tranHandle; --- > IIapi_autocommit(&autoParm); /* ARC INTERNATIONAL */ > ii_sync(&(autoParm.ac_genParm)); /* ARC INTERNATIONAL */ 208,209c221,223 < IIapi_autocommit(&autoParm); < ii_sync(&(autoParm.ac_genParm)); --- > if(ii_success(&(autoParm.ac_genParm))==II_FAIL) { /* ARC INTERNATIONAL */ > php_error(E_WARNING, "Ingres II: Unable to disable autocommit"); /* ARC INTERNATIONAL */ > } /* ARC INTERNATIONAL */ 211,213c225,227 < if (ii_success(&(autoParm.ac_genParm)) == II_FAIL) { < php_error(E_WARNING, "Ingres II: Unable to disable autocommit"); < } --- > link->autocommit = 0; /* ARC INTERNATIONAL */ > link->tranHandle = NULL; /* ARC INTERNATIONAL */ > } /* ARC INTERNATIONAL */ 215,217c229,242 < link->autocommit = 0; < link->tranHandle = NULL; < } --- > if(link->tranHandle && _rollback_transaction(link)) { /* ARC INTERNATIONAL */ > php_error(E_WARNING, "Ingres II: Unable to rollback transaction !!"); /* ARC INTERNATIONAL */ > } /* ARC INTERNATIONAL */ > /* Assume link is broken , close, and mark as broken with conn Handle NULL */ > if(ai_error) { /* ARC INTERNATIONAL */ > disconnParm.dc_genParm.gp_callback = NULL; /* ARC INTERNATIONAL */ > disconnParm.dc_genParm.gp_closure = NULL; /* ARC INTERNATIONAL */ > disconnParm.dc_connHandle = link->connHandle; /* ARC INTERNATIONAL */ > /* ARC INTERNATIONAL */ > IIapi_disconnect(&disconnParm); /* ARC INTERNATIONAL */ > /* ARC INTERNATIONAL */ > link->connHandle = NULL; /* ARC INTERNATIONAL */ > } /* ARC INTERNATIONAL */ > } /* ARC INTERNATIONAL */ 219,220c244,248 < if (link->tranHandle && _rollback_transaction(link)) { < php_error(E_WARNING, "Ingres II: Unable to rollback transaction !!"); --- > > static void _clean_ii_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* ARC INTERNATIONAL */ > { > II_LINK *link = (II_LINK *)rsrc->ptr; > _ai_clean_ii_plink(link); /* ARC INTERNATIONAL */ 222d249 < } 522a550,579 > /* Unfortunetaly NO !!!*/ > /* Ingres api does'nt reconnect */ > /* Have to reconnect if cleaning function as flagged link as broken */ > if(link->connHandle == NULL) { /* ARC INTERNATIONAL */ > php_error(E_WARNING,"Ingres II: Broken link (%s),reconnect", db); /*ARC INTERNATIONAL */ > /* Recreate the link */ /* ARC INTERNATIONAL */ > connParm.co_genParm.gp_callback = NULL; /* ARC INTERNATIONAL */ > connParm.co_genParm.gp_closure = NULL; /* ARC INTERNATIONAL */ > connParm.co_target = db; /* ARC INTERNATIONAL */ > connParm.co_username = user; /* ARC INTERNATIONAL */ > connParm.co_password = pass; /* ARC INTERNATIONAL */ > connParm.co_timeout = -1; /*-1 is no timeout*/ /* ARC INTERNATIONAL */ > connParm.co_connHandle = NULL; /* ARC INTERNATIONAL */ > connParm.co_tranHandle = NULL; /* ARC INTERNATIONAL */ > /* ARC INTERNATIONAL */ > IIapi_connect(&connParm); /* ARC INTERNATIONAL */ > /* ARC INTERNATIONAL */ > if(!ii_sync(&(connParm.co_genParm)) || ii_success(&(connParm.co_genParm)) == II_FAIL) { /* ARC INTERNATIONAL */ > efree(hashed_details); /* ARC INTERNATIONAL */ > php_error(E_WARNING,"Ingres II: Unable to connect to database (%s)", db); /* ARC INTERNATIONAL */ > RETURN_FALSE; /* ARC INTERNATIONAL */ > } /* ARC INTERNATIONAL */ > /* ARC INTERNATIONAL */ > link->connHandle = connParm.co_connHandle; /* ARC INTERNATIONAL */ > link->tranHandle = NULL; /* ARC INTERNATIONAL */ > link->stmtHandle = NULL; /* ARC INTERNATIONAL */ > link->fieldCount = 0; /* ARC INTERNATIONAL */ > link->descriptor = NULL; /* ARC INTERNATIONAL */ > link->autocommit = 0; /* ARC INTERNATIONAL */ > } /* ARC INTERNATIONAL */ 641a699,705 > > /* Seems to be a little bug here ? */ > link_id = (int) ii_link; /* ARC INTERNATIONAL */ > /* Call the clean function synchronously here */ > /* Otherwise have to wait for script ending before ZEND garbage occur */ > /* This way we can reuse the link in the same script */ > _ai_clean_ii_plink(ii_link); /* ARC INTERNATIONAL */
« previous php.dev (#93834) next »