KIMA2 ist ein kleines Kassenprogramm für Kindersachenmärkte. https://www.rustysoft.de/?01_kima2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

42 lines
1.2 KiB

#ifndef DATABASE_H
#define DATABASE_H
#include "sale.h"
#include "seller.h"
#include <string>
#include <sqlite3.h>
class Database
{
public:
explicit Database(const std::string& dbname);
Database();
~Database();
Database(const Database&) = delete;
Database& operator=(const Database&) = delete;
void exec(const std::string& sql);
unsigned int storeSellers(std::vector<std::unique_ptr<Seller>>& sellers,
bool onlyDelete = false);
unsigned int loadSellers(std::vector<std::unique_ptr<Seller>>& sellers);
unsigned int storeSales(std::vector<std::unique_ptr<Sale>>& sales);
unsigned int loadSales(std::vector<std::unique_ptr<Sale>>& sales,
std::vector<std::unique_ptr<Seller>>& sellers);
void updateCashPointNo(int oldCashPointNo, int newCashPointNo);
void newDb();
private:
sqlite3* db_{nullptr};
std::string dbname_;
void init();
void beginTransaction();
void endTransaction();
void createNew();
int getVersion();
unsigned int storeArticles(std::vector<Article*> articles);
void updateDbToVer2();
void updateDbToVer3();
};
#endif // DATABASE_H