48 wxInputStream * configStream;
49 wxDatabase * pDatabase;
51 if ( configString.IsEmpty() ) {
52 wxString configPath = wxStandardPaths::Get().GetUserLocalDataDir() + wxFILE_SEP_PATH +
"yatish.auth";
53 if ( !wxFileName::FileExists (configPath) ) {
55 msg.Printf (_(
"Authentication file '%s' not found"), configPath);
56 throw ( wxDatabaseException (-1, msg) );
58 configStream =
new wxFileInputStream (configPath);
59 if ( !configStream->IsOk() ) {
61 msg.Printf (_(
"Authentication file '%s' cannot be opened"), configPath);
62 throw ( wxDatabaseException (-2, msg) );
65 configStream =
new wxStringInputStream (configString);
67 wxFileConfig config (*configStream);
68 wxString err = wxEmptyString;
69 pDatabase = wxDatabase::GetDatabase (config, &err);
72 msg.Printf (_(
"Error while reading the authentication file:\n%s"), err);
73 throw ( wxDatabaseException (-3, msg) );
83 return pDatabase->TableExists (
"yatish_client") &&
84 pDatabase->TableExists (
"yatish_project") &&
85 pDatabase->TableExists (
"yatish_task") &&
86 pDatabase->TableExists (
"yatish_tool") &&
87 pDatabase->TableExists (
"yatish_activity")&&
88 pDatabase->TableExists (
"yatish_timeslot");
wxDatabase * GetDatabase(const wxString &)
Sets up a (configuration) flux using its argument then calls wxDatabase::GetDatabase().
static wxDatabase * masterDB
bool TablesOk(wxDatabase *)
Returns false if any of the yatish table is missings.
#define CATCH(returnValue)
static const char * tableName[]
Must be defined in the same order as enum tableID.