Re: mssql_* overhead

From: Date: Wed, 10 Jan 2007 16:09:54 +0000
Subject: Re: mssql_* overhead
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-246844@lists.php.net to get a copy of this message
Philip Thompson wrote: > Hi. > > Does anyone know if the mssql_connect/_init/_bind/etc require a lot of > overhead? > > I have a page that requires multiple function calls and each of those > opens a new connection to the database, performs the necessary actions > in stored procedure(s), and then closes the connection. However, I found > this to be slower than I was wanting. So I thought, just create one > connection and assign it to the SESSION (a global), and in each function > that requires a connection, call that SESSION variable. At the end of > the page, close the connection and nullify the variable. I wouldn't stick it in the SESSION superglobal (my tactic is usually to create a little wrapper class to the relevant DB functions and store the connection as a property of the class/object. basically opening & closing the connection once per request is the way to go - if your going to using a global, better [than $_SESSION] to stick it in $GLOBALS imho. $_SESSION is used for persisting data over multiple requests - something that is not possible to do for 'resource identifiers' (which is what the connection [id] is). > > Does anyone see a problem with doing it this way? Security concerns? > Anything? > > Thanks in advance, > ~Philip > > --PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#246844) next »