Embedding expansion information into a table view

I started work on code last night that does the following. Consider the following view


CREATE `gzc__config` AS SELECT
  `group` AS `id`,
  `name` AS `id_name`,
  `value` AS `id_name_value`
FROM `gzc__settings`

The reason for the wierd column names delimited by underscores is once PHP receives the view it does a transform to create a multidimensional array.


// column keys are broken down into this array structure guide...
array( 'id' => array (
  'name' => 'value'
));

// which when populated with information becomes...
array(
  'core' => array (
    'timezone' => 'America/New_York'
  )
);

At the moment I’m having to use a meta table that tells PHP which transform library goes with which view. MOST transforms will be a simple tier like this, or a tree structure. However, I want to be able to designate a class to handle the transform which will likely contain callbacks against the rows to create further derived data. Does MySQL have a means to store comments about a view like it can store comments about a field or a table? If so, I could use the comments field to hold the name of the class that perform the transformation – but is that a wise approach?

Other thoughts?

bumping to prevent the 1 month warning from showing. I’ve implemented this and it seems to work pretty well. It won’t cover every case, but I think it gets the majority. Still trying to figure out how to cleanly invoke callbacks in the PHP handler.