I'm trying to create a SSQLS structure to represent a derived type.
Consider the following:
// base.h
class base {
int id;
};
// derived.h
#include "base.h"
class derived : public base {
std::string name;
};
Generally, creating a SSQLS structure for derived is no problem:
sql_create_2(derivedStructure, 1, 2, mysqlpp::sql_int, id,
mysqlpp::sql_text, name)
But this requires explicit knowledge of the internals of base at the
time of creation, not to mention the same code repeated for every type
that inherits from base. What I'd like to do is something like this:
// in base.h...
#define BASE_ARGS mysqlpp::sql_int, id
// in derived.h...
#define DERIVED_ARGS mysqlpp::sql_text, name
sql_create_2(derivedStructure, 1, 2, BASE_ARGS, DERIVED_ARGS)
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?
Does anyone else compose SSQLS structures in a similar fashion? Any
help would be appreciated.
Ryan