The nearest thing I can think of is MetaC:
http://www.maier-komor.de/metac/
(Already mentioned by FrustratedWithFormsDesigner a few days ago)
Put aside this, there are a number of other systems based on the C preprocessor that can be used (or abused) for this task. Have a look at Boost.Preprocessor, for example:
http://www.boost.org/doc/libs/1_52_0/libs/preprocessor/doc/index.html
Or P99 and ABCPP:
http://p99.gforge.inria.fr/
http://code.google.com/p/abcpp/
Despite this, I strongly suggest you to use of some kind of full-blown code-generation tool for this task (as Brian already did).
All of the above-mentioned preprocessor-based tools, at the very end, are just convoluted ways to perform some kind of code generation. You could just implement your own full-blown, well-behaved code-generation tool instead. Ruby, Python and Perl offer a lot of good tools for this. For example, Ruby has its own Modelling and Code Generation framework:
http://ruby-gen.org/
http://rgen.rubyforge.org/
Many other exists for other scripting languages. You could even use a template engine normally used for developing web applications, like Cheetah (Python-based):
http://www.cheetahtemplate.org/
Have a look at the general-purpose Ruby-based WLang framework, as well:
https://www.ruby-toolbox.com/projects/wlang
Using a general-purpose scripting language and a code-generation framework, you will end up developing a real, stand-alone application that will query your DB and generate metadata and code accordingly. It can look like a big and complicated solution but it is actually easier to write and much more maintaineable than a preprocessor-based one (because a full-blown scripting language is much more powerful and flexible than the C preprocessor).
Moreover, from your "feature-requests list" I'm getting the feeling that none of the existing preprocessor-based tools can be used for your task "as is" because the C preprocessor cannot easily deal with a DB and because your task will most likely require a two-pass process (one pass for quering the DB and generate the required metadata and a second one for generating the C code from the metadata).
This can be another reason for using a full-blown scripting language.