Fixing my plugin's SQL for WordPress 2.3

I just upgraded WordPress to version 2.3 RC 1 at my test blog, and found out that changes in the taxonomy schema break my Parental Control plugin in a nasty way. Fortunately, it was quite easy to fix.

I added a test for WordPress’ version and branched the SQL accordingly:

if (version_compare(get_bloginfo('version'), '2.3-RC1', '<')) {
	$text .= " AND ( '".$jupc_excluded_cat."'  ALL (SELECT category_id FROM $wpdb->post2cat WHERE $wpdb->post2cat.post_id = $wpdb->posts.ID) )";
else {
	$text .= " AND ( '".$jupc_excluded_cat."'  ALL (SELECT term_taxonomy_id FROM $wpdb->term_relationships WHERE $wpdb->term_relationships.object_id = $wpdb->posts.ID) )";

The code above reserved for versions 2.3 RC1 and above would probably work with the 2.3 Betas as well, but as I don’t have any interest in testing already obsolete versions, I decided to draw the line to 2.3 RC1, so the code above probably won’t work with 2.3 trunk versions below RC1.