[wp-hackers] Coding Projects

Joseph Scott joseph at randomnetworks.com
Tue Dec 14 05:14:15 UTC 2004

On Dec 13, 2004, at 5:20 PM, Thiago Becker wrote:

> Ok. The sad history: for adding support to multiple category queries,
> i'll need to force everybody using alpha version of WP to use mysql
> 4.1, because I'll need to use subqueries to make the right queries. I
> tried, for the best of my understanding, to use joins, but it doesn't
> fit for this case. I can create ugly hacks for this, but it is not
> what I intend to do.
> I'm asking for the devs to look at what version of mysql they are
> using, and if there is any problem in breaking compatibility in alpha
> version.

	As others have already noted, it is unlikely that you will be able to 
rely on having on >= mysql 4.1 anytime in the near future.  In the past 
I've generally dealt with this in one of three ways:

1. Try to rewrite the query using only joins.  As you have already 
mentioned, sometimes this just doesn't fly.
2. Make multiple queries to the database and doing the 
matching/sorting/filtering in code.  This should always work because it 
doesn't require anything extra database features.
3. Make use of temporary tables.

	The bad news is that #1 can be tricky or may be even not possible.  #3 
is probably the next "most" correct option, but requires that the user 
have sufficient permissions to create temporary tables, which may be a 
problem if your hosting service doesn't allow that.  This leaves your 
with #2, which means more work for the programmer.  Unfortunately it is 
the only one that fits the "least common denominator" issue for 
WordPress users.

	This is where is resist the urge to plug PostgreSQL as an alternative 
to MySQL :-)

Joseph Scott

More information about the hackers mailing list