Nucleus Support Forum Index

Find on the forum:
any terms  all terms  Advanced Search

RSS 2.0
Browse posts: Unanswered | Mark all read

« »
Loading Nucleus FAQ ticker...
Post new topic Reply to topic
Author Message
matt_t_hat
Nucleus Geek


Joined: 21 Aug 2005
Posts: 1124
Location: UK

Post Posted: Fri Sep 29, 2006 3:03 pm   Post subject: MySQL connection managment
Reply with quote

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

Back to top

View user's profile Send private message Visit poster's website
xiffy
Nucleus Guru
Nucleus Guru


Joined: 27 Mar 2002
Posts: 1218
Location: Deventer

Post Posted: Fri Sep 29, 2006 3:32 pm   Post subject:
Reply with quote

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

Back to top

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger ICQ Number
matt_t_hat
Nucleus Geek


Joined: 21 Aug 2005
Posts: 1124
Location: UK

Post Posted: Thu Oct 05, 2006 4:39 pm   Post subject:
Reply with quote

xiffy wrote:
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


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

Back to top

View user's profile Send private message Visit poster's website
Post new topic Reply to topic
Display posts from previous:   

Page 1 of 1

All times are GMT + 1 Hour

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2002 phpBB Group