Update the metadata cursor implementation.

Move it into it's own cursor implementation, add a special search
routine that can search the metadata for the metadata table.

This is prototype code - I haven't tested the new functionality yet. It is not ready to be merged.

References issue #908