On Wed, Dec 3, 2008 at 2:03 PM, Warren Young <mysqlpp@stripped> wrote:
> 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.
I apologize, as I probably over-explained my problem. I already have
my tables laid out and working in MySQL. Say I have a base with an
int and two different derived types that inherit from it:
// base.h
class base { int id; }
// derived1.h
class derived1 : public base { std::string name; }
// derived2.h
class derived2 : public base { double d; }
table derived1 looks like:
| INT id | TEXT name |
table derived2 looks like:
| INT id | DOUBLE d |
I understand the limitations of MySQL as an OODB and have designed my
tables accordingly.
I create my SSQLS for derived1 with:
sql_create_2(derived1Struct, 1, 2, mysqlpp::sql_int, id,
mysqlpp::sql_text, name)
I create my SSQLS for derived2 with:
sql_create_2(derived2Struct, 1, 2, mysqlpp::sql_int, id, mysqlpp::sql_double, d)
This all works fine. I'm just trying to get around the fact that (in
the above) I have 'mysqlpp::sql_int, id' hard-coded into every
sql_create_ call.
My problem is simply one of the macro-expansion I'm trying to do not
working the way I expect. In a way more general, non mysql++ related
example:
#define FIRSTARGS a0, a1
#define SECONDARGS a2, a3
#define MACROREQUIRINGFOURARGS(a,b,c,d) ...
MACROREQUIRINGFOURARGS(FIRSTARGS, SECONDARGS) // does not work
The way I understand cpp's macro expansion, this should first expand to:
MACROREQUIRINGFOURARGS(a0, a1, a2, a3)
and as a result work fine. But I'm wrong.
Thanks again,
Ryan