RSS 2.0
Browse posts:
Unanswered |
Mark all read
| Author | Message | ||
|---|---|---|---|
|
matt_t_hat Nucleus Geek Joined: 21 Aug 2005 Posts: 1124 Location: UK |
I have been happily working on a class that creates child instences of same and so on etc based on data. That works very well and I'm rather happy with the results. However the class also creates it's own connection. It has struck me that each object will have it's own connection... that's too much stress for a ssytem and not really needed. My question is this - how do I first look for an existant connection? I ask only for reference as my "fix" was to allow the makechild to pass the connection byref to the init function. _________________ Host Plugins | Blog | Hundred Quid A Day | My Big Fat Arse |
||
|
|
|||
|
xiffy Nucleus Guru ![]() Joined: 27 Mar 2002 Posts: 1218 Location: Deventer |
Just don't do anything with connections and DB's and run sqlquery directly. be amazed by the result. PHP will use the 'current' db connection by default. -less is more _________________ __deus ex machina__ http://xiffy.nl/weblog/ Japan photo's: http://2006.cooljapan.nl/main.php?g2_itemId=20 |
||
|
|
|||
|
matt_t_hat Nucleus Geek Joined: 21 Aug 2005 Posts: 1124 Location: UK |
I figured this was the case however the class should be able to run in an environment where other connections to other DBs might exist... plus the fully dificult bit of the connection being made when the class is first called into existence. Currently passing the conn is the only way I know of that would let me know if there is a conn I can use. However I am growing aware that certain users here (yourself for example) have a better knowledge of this stuff than me. However what's to stop other scripts accidently using the classes connection? I hadn't considered this... _________________ Host Plugins | Blog | Hundred Quid A Day | My Big Fat Arse |
||
|
|
|||
|
|
|||
|
All times are GMT + 1 Hour
You cannot post new topics in this forum |
|||