2010-05-14 15:04:01 +02:00
|
|
|
#ifndef DATABASE_H
|
|
|
|
#define DATABASE_H
|
|
|
|
|
2010-05-15 11:21:42 +02:00
|
|
|
#include <stdio.h>
|
2010-05-14 15:04:01 +02:00
|
|
|
#include <fstream>
|
|
|
|
#include <list>
|
|
|
|
#include <wx/wxsqlite3.h>
|
|
|
|
#include <wx/wx.h>
|
|
|
|
#include <sha1.h>
|
|
|
|
|
2010-05-15 11:21:42 +02:00
|
|
|
#include "model.h"
|
|
|
|
|
2010-05-14 15:04:01 +02:00
|
|
|
#define BDD_FILE "kc.bdd"
|
|
|
|
#define INIT_SCRIPT "init.sql"
|
|
|
|
|
|
|
|
class Database
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Database();
|
|
|
|
|
|
|
|
std::list<wxString> GetUsers();
|
|
|
|
bool IsValidUser(wxString user, wxString password);
|
2010-05-15 11:21:42 +02:00
|
|
|
|
|
|
|
User* LoadUser(wxString name);
|
2010-05-16 10:35:34 +02:00
|
|
|
void LoadYear(User* user, int year);
|
2010-05-14 15:04:01 +02:00
|
|
|
private:
|
|
|
|
wxSQLite3Database _db;
|
|
|
|
|
|
|
|
void CreateDatabase();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|