YATISH
Yet Another TIme SHeet
/home/nicolas/sources/yatish/yatishDB.h
Go to the documentation of this file.
1 /***************************************************************
2  * Name: yatishDB.h
3  * Purpose: Defines the base classe for yatish database controllers
4  * Author: Nicolas PĂ©renne (nicolas.perenne@eif-services.eu)
5  * Created: 2020-04-15
6  * Copyright: EIF-services (https://www.eif-services.eu)
7  * License: GPLv3
8  **************************************************************/
9 
10 #ifndef YATISHDB_H
11 #define YATISHDB_H
12 
13 #include <wx/database/wxprec.h>
14 #include <wx/fileconf.h>
15 #include <wx/filename.h>
16 #include <wx/sstream.h>
17 #include <wx/stdpaths.h>
18 #include <wx/wfstream.h>
19 
20 enum tableID {
21  client_tid, // 0
27 };
28 
29 #define CATCH(returnValue) catch (wxDatabaseException& e) {\
30  wxLogError ( "[%d] %s", e.GetErrorCode(), e.GetErrorMessage() );\
31  return returnValue; }
32 
49 class yatishDB {
50  public:
51  static const char * tableName [];
52  protected:
53  static wxDatabase * masterDB;
54  wxDatabase * GetDatabase (const wxString&);
55  bool TablesOk (wxDatabase *);
56 };
57 
58 #endif // YATISHDB_H
wxDatabase * GetDatabase(const wxString &)
Sets up a (configuration) flux using its argument then calls wxDatabase::GetDatabase().
Definition: yatishDB.cpp:47
static wxDatabase * masterDB
Definition: yatishDB.h:53
tableID
Definition: yatishDB.h:20
bool TablesOk(wxDatabase *)
Returns false if any of the yatish table is missings.
Definition: yatishDB.cpp:82
static const char * tableName[]
Must be defined in the same order as enum tableID.
Definition: yatishDB.h:51
Provides a few basic methods and (static) members to interact with yatish tables. ...
Definition: yatishDB.h:49