[wp-hackers] Meta tables: Take 5
scribu at gmail.com
Fri Jul 24 17:21:06 UTC 2009
On Fri, Jul 24, 2009 at 8:03 PM, Otto <otto at ottodestruct.com> wrote:
> On Fri, Jul 24, 2009 at 5:21 AM, scribu<scribu at gmail.com> wrote:
> > - WP core shouldn't create tables that it doesn't use. The same principle
> I agree with this. However, there's several things that the core could
> be putting into a comment meta table. A lot of the lesser used columns
> could be moved to meta data and this speed up comments retrieval
> (probably by a trivial amount, but hey).
Well, if it was decided that it would be better to move all those columns to
I was very careful in my proposal  to talk about an api which was db
> structure agnostic, because they may be arguments both ways and I think the
> storage mechanism should be completely separate from the api and it is
> really the api we need to decide on first!
Ok, so let's focus on the API.
First, a function to register new meta types:
Then we have generalizations of the *_post_meta() functions:
function add_meta($type, $id, $key, $value, $single);
function update_meta($type, $id, $key, $value, $old_value);
function get_meta($type, $id, $key, $value, $single);
function delete_meta($type, $id, $key, $value);
We need to think how to map these functions:
Also, westi proposed functions for manipulating by key:
But we can go a step further and handle an entire type:
This is just the first draft, so don't starve the sarlaac yet.
More information about the wp-hackers