Re: MySQL close connection, what's the purpose?

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

 



On Sat, 2006-04-01 at 20:48, Jasper Bryant-Greene wrote:
>
> Yeah, e.g. I have a database objects layer that means I only write SQL 
> in classes, everything else is just calling object methods. I create the 
> database object at the start of every script but that doesn't 
> necessarily open the database connection. The database connection is 
> opened when I make my first query.
> 
> That way if a page does no queries (I use APC caching so it is fairly 
> common for a page to do no queries) then no database connection is opened.
> 
> I never close connections; PHP does that for me and has never caused any 
> problems doing that. I don't see it as sloppy programming, it is a 
> documented feature that PHP closes resources such as database 
> connections at the end of the script.
> 
> But, as has been said, each to their own.

There's smart lazy programming, and sloppy lazy programming. I don't
trust anything magical in PHP. Most of us are familiar with the magic
quotes and global vars fiascos *LOL*. But hey, if you can squeeze a
rewrite of an application out of a client for relying on dirty
techniques, who am I to critique your forward thinking manipulative
methods -- not to say that's your intent -- but I'd sure question your
motives and judgement if it comes around ;)

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
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