В сообщении от 17 октября 2006 16:04 Warren Young написал(a):
> Королев Илья wrote:
> > Why we can't just drop away static names[] ( and table)?
>
> How would SSQLS build queries without a table of the field names?
like this:
template <class Manip> std::ostream& operator << (std::ostream& s,
const
DB_AdvBase_field_list<Manip>& obj) {
s << obj.manip << "user_id" << obj.delem;
s << obj.manip << "position" << obj.delem;
s << obj.manip << "ts" << obj.delem;
s << obj.manip << "pads";
return s;
}
IMHO in such way we don't need names[] at all.
>
> > The only advantage IMHO is that we can change names[](table) on the
> > fly.
>
> Every single table in my own use of MySQL++ has a different name than
> the corresponding SSQLS. I am unwilling to give up that feature.
Explain please.
Does one SSQLS correspond one table?
sql_create_4(
DB_ClickStatRequest, 1, 0,
OID, id,
OID, click_id,
OID, program_id,
mysqlpp::sql_timestamp, ts
);
and after use it with table "TableName"?
So, you change a static variable table?
DB_ClickStatRequest::table() = "TableName";
DB_ClickStatRequest obj;
Q << "SELECT " << obj.field_list() << " FROM " << obj.table();
In such case IMHO it's possible to declare "TableName" in other way.
#define TABLE_NAME "TableName"
Q << "SELECT " << obj.field_list() << " FROM " << TABLE_NAME;
Or I misunderstand again? :)