Closed suisou closed 4 years ago
I add " conn.reconnect(); " after "connection conn(MYSQL_LINK);" last row run passed!
That's an interresting constalation. I'll take a look into it.
After creating a connection
, you have to explicitly call connect()
to open the database connection. So, the call to reconnect()
does the job too.
Btw: When working with a session
you can call s.select<s_comconf>()
to retrieve the objects. Returned ist an object of type object_view<s_comconf>
which can be iterated in STL way. When starting your app with an available database schema you can call persistence::load()
to load all objects into the object_store
. (I plan provide a sync_schema()
for persistence
)
thanks,I use it as the demo code on http://zussel.github.io/matador/. Please modify it with the new version. OR , the fresh will be confused with it again.
Ok, thanks! I fixed the demo code.
struct s_comconf { identifier id;
std::string DEV_NAME;
int SPEED;
int FLOW_CTRL;
int DATABITS;
int STOPBITS;
int PARITY;
};
connection conn(MYSQL_LINK); query q(COM_CONF_TABLENAME);
the error showed from last row.