#define UPDATE_TABLE(from, to, step) EXECUTE_SQL_UPDATE_WITH_CODE(req, , throw std::string("Error while upgrading from version " from " to version " to ", step " step);, });
ON_ERROR("Your current version of KissCount is too old and can't load this database. Please upgrade KissCount");
}
version--;
// Maybe one update is impossible
for(i=version;i<DATABASE_VERSION-1;i++)
{
if(!updates[i])
{
ON_ERROR("The database cannot be upgraded. Please use an older version of KissCount");
}
}
wxMessageDialogdialog(NULL,wxT("You use an old database model. KissCount will try to upgrade it to the lastest version"),wxT("KissCount"),wxICON_INFORMATION|wxOK|wxCANCEL);
if(dialog.ShowModal()==wxID_CANCEL)
throwstd::string("can't load this database");
_db.Begin();
try
{
for(i=version;i<DATABASE_VERSION-1;i++)
{
updates[i](_db);
}
req=wxT("UPDATE kisscount SET db_version='")+wxString::Format(wxT("%d"),DATABASE_VERSION)+wxT("'");
EXECUTE_SQL_UPDATE_WITH_CODE(req,,throwstd::string("Unable to set new database version"),{});