Re: mssql_* overhead

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 10 January 2007 17:47, 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.
>
> Does anyone see a problem with doing it this way? Security concerns?
> Anything?
>
> Thanks in advance,
> ~Philip


Using pconnect solves your problem (if I understood correctly (I had liddle 
English knowladge). Putting data into $_SESSION may bit slower because every 
time you nullf the variable and that means php have to serialize $_SESSION 
and wrote into disk. (You may use SQL or Memcached base sessions)

just generate for example $_db variable and make it global, call every 
function. if your regenerate your db connection data every time you init the 
script, you don't need to store int $_SESSION. 

$_SESSION gives you state, not security. Actually it stores data into disk (or 
sql or memory (depends your config)) per connection state (PHPSESSID).

and if you bored declaring global $_db in ever function you may use 
$GLOBALS['_db'] = $_db 

then call in other functions

and if you want speed  use Memcached.  Using SQL for state like using Tractor 
in F1 Race.

Regards

Sancar

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux