Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Good model plugin for newbie plugin author to study?

Thanks for the suggestions. It’s good to know that topicmeta can be queried directly in SQL rather than having to serially retrieve topics and address it through PHP data structures.

However, I still don’t know whether I’m clear on the concept. Is the point behind the topicmeta table to map individual topics to particular bits of metadata, on the basis of one (topic, metadata key, metadata value) tuple per row?

If so, how do you efficiently handle the case when you need multiple pieces of metadata per topic? A geolocation is actually two floating-point numbers (latitude and longitude). Ideally I’d like to be able to treat them as such in my queries without a lot of packing and unpacking to squeeze them into one field.

Finally, another SQL newb question: are there peformance or other reasons why I can’t use a join? Because I actually need to give the Google Maps API info from columns in the topics table, too. Setting aside the point about geolocations actually being two values, could I do something like this?

SELECT t.topic_id, topic_title, topic_poster_name, forum_id, meta_value

FROM bb_topics t, bb_topicmeta m

WHERE t.topic_id = m.topic_id

AND topic_status = 0

AND meta_key = ‘topic_geolocation’

AND meta_value [meets some other magic condition]

Skip to toolbar