Well, constructor is about the worst place to do login
It should look like this:
GUI_APP_MAIN
{
MySqlSession session;
if(!session.Connect("test", "welcome1", "example", "localhost")) {
Exclamation("Can't connect with MySql\n");
return;
}
SQL = session; // Use as global session
SqlSchema sch;
All_Tables(sch);
if(sch.ScriptChanged(SqlSchema::UPGRADE))
MySqlPerformScript(sch.Upgrade()); // Create schema without indexes, constraints etc...
if(sch.ScriptChanged(SqlSchema::ATTRIBUTES)) {
MySqlPerformScript(sch.Attributes()); // Add indexes, constraints...
}
if(sch.ScriptChanged(SqlSchema::CONFIG)) { // Fill with initial data if any
MySqlPerformScript(sch.ConfigDrop());
MySqlPerformScript(sch.Config());
}
sch.SaveNormal(); // Save as files for later use if needed
SQLApp().Run();
}
Then remove "session" from MyApp and all Sql constructor leave default (sometimes you can use SQL instead of defining Sql - basicaly for all non-query statements, queries are somewhat risky )