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