[wp-hackers] DB connections

David Chait davebytes at comcast.net
Tue Aug 8 16:36:32 GMT 2006


Well one COULD argue that WPDB is an abstraction for JUST the WP database... 
that if you want to open another database, you should instantiate a 
different type of object (given WPDB now is more than just a generalized DB 
abstraction -- go grab the original wrapper/object code and use that 
instead...).

I guess I can see it being used to access a second WP database... but again, 
in THAT case you could instantiate another WPDB object.

How many plugins does this actually affect?

-d

----- Original Message ----- 
From: "Michael D Adams" <mikea at turbonet.com>
To: <wp-hackers at lists.automattic.com>
Sent: Tuesday, August 08, 2006 5:56 AM
Subject: Re: [Spam] Re: [wp-hackers] DB connections


| On Aug 8, 2006, at 1:25 AM, Matt Mullenweg wrote:
| > Aubrey Kilian wrote:
| >> Anyway, the article basically goes on to say that a method called
| >> "Lazy Loading" should be used to only create a connection to the
| >> mysql
| >> database if a query is actually executed against the database.  With
| >> the current way that wordpress works, that would be every single page
| >> load.
| >
| > The patch doesn't look bad. I think something like this is already
| > in the MU db class.
|
| It's possible some plugins use the wpdb class to connect to a
| different database with different username/password.  For backward
| compatibility in such a case (albeit edgy), we'd need to instantiate
| with the db constants rather than with the nicer looking no argument
| method that the patch [1] uses.
|
| But that would mean storing the arguments passed to wpdb in some
| local variables, multiplying the number of places db username/
| passwords are stored.  Good/Bad/Doesn't matter?
|
| Ticket: http://trac.wordpress.org/ticket/3012
|
| Michael
|
| [1] (from Aubrey Kilian's link) http://jpipes.com/source/wordpress-
| lazy-load.patch
| _______________________________________________
| wp-hackers mailing list
| wp-hackers at lists.automattic.com
| http://lists.automattic.com/mailman/listinfo/wp-hackers
| 



More information about the wp-hackers mailing list