Ryan W. Frenz wrote:
> I can't make this work under MSVC 2005 (not enough actual parameters
> for macro 'sql_create_2'). I'm sure there some macro-related reason
> that this can't work. Or maybe not?
GCC 4.1 rejects it, too, so it's probably illegal, not just a limitation
of VC++ 2005.
I question how well this is going to work with MySQL to begin with,
since it isn't an OODB.
You could have a separate table per subtype, but then it's impossible to
keep the keys synchronized among the subtype tables, so joins are
impossible.
You could have a table for the base class and tables for all of the
subtypes declaring only the additional data members, but populating
SSQLSes from multiple tables ranges from tricky to impossible, depending
on which SSQLS feature we're talking about.
Unless you've discovered a better method, or are willing to put up with
these limitations, I'd give up on trying to arm-twist MySQL into
becoming an OODB. If I had to have multiple C++ types, I'd probably
just define a single table that has a superset of columns for all the
subtypes, declare one SSQLS for that, then define a static factory
method on the base class that knows how to make subtypes from the SSQLS
based on the contents of the row:
Base* Base::Create(const MySsqlsType& ssqls) ...