update db: insert special seller
This commit is contained in:
parent
1ee1252c46
commit
3a40f586fa
2 changed files with 13 additions and 1 deletions
|
@ -101,6 +101,15 @@ void Database::createNew()
|
|||
endTransaction();
|
||||
}
|
||||
|
||||
void Database::updateDbToVer2()
|
||||
{
|
||||
beginTransaction();
|
||||
exec("INSERT INTO sellers (id, seller_no, first_name, last_name, num_offered_articles) VALUES "
|
||||
"('11111111-1111-1111-1111-111111111111', 0, 'Sonderkonto', 'Sonderkonto', 0)");
|
||||
exec("UPDATE kima2 SET version = 2");
|
||||
endTransaction();
|
||||
}
|
||||
|
||||
void Database::init()
|
||||
{
|
||||
const int errCode = sqlite3_open(dbname_.c_str(), &db_);
|
||||
|
@ -117,7 +126,9 @@ void Database::init()
|
|||
case 0:
|
||||
createNew();
|
||||
break;
|
||||
// perhaps handle upgrades for db schema here...
|
||||
case 1:
|
||||
updateDbToVer2();
|
||||
break;
|
||||
default:
|
||||
// Do nothing because we are up-to-date.
|
||||
break;
|
||||
|
|
|
@ -34,6 +34,7 @@ class Database
|
|||
void createNew();
|
||||
int getVersion();
|
||||
unsigned int storeArticles(std::vector<Article*> articles);
|
||||
void updateDbToVer2();
|
||||
};
|
||||
|
||||
#endif // DATABASE_H
|
Loading…
Reference in a new issue