![]() |
YATiSh
Yet Another TIme SHeet
|
Interacts with yatish tables in a SQLite database. More...
#include <yatishDBsqlite.h>

Public Member Functions | |
| yatishDBsqlite () | |
Mainly connects to the yatish.sqlite database. More... | |
| ~yatishDBsqlite () | |
| bool | FillChoice (wxChoice *, tableID) |
Fills a wxChoice. More... | |
| int | ChoiceSelector (tableID, long) |
Finds the proper index for selection in a wxChoice. More... | |
| bool | StartTimeslot (int, int, int) |
| Starts a new row in the timeslot table. More... | |
| bool | StopTimeslot () |
| Stops current timeslot. More... | |
| int | RunningTimeslots () |
| Determines the number n of unfinished timeslots. More... | |
| void | SetLimit (bool b, int i) |
| bool | FillList (wxListCtrl *, tableID) |
| Fills a wxListCtrl. More... | |
| bool | FillPlotData (RawData &) |
Fills a RawData (typedefined in yatishTypes.h). More... | |
| void | AddToFilter (tableID, int) |
| Adds a condition to the WHERE clause of FillList(). More... | |
| void | AddToFilter (long) |
| Adds a condition to the WHERE clause of FillList(). More... | |
| wxString | GetFilter () const |
| void | ClearFilter () |
| long | FilteredTotal (wxTimeSpan &) const |
| Returns the total duration of currently viewed timeslots (and their count). More... | |
| wxString | FilteredTotalFormatted () |
| Writes the total and average durations of currently viewed timeslots. More... | |
| void | SetFirstDay (const wxDateTime &) |
Sets private member firstDay (for future SQL queries). More... | |
| void | SetLastDay (const wxDateTime &) |
Sets private member lastDay (for future SQL queries). More... | |
| wxDateTime | GetFirstDay () const |
| wxDateTime | GetLastDay () const |
| wxDateTime | First () |
| Obtains the minimum time in column start from currently selected rows of table yatish_timeslot. More... | |
| wxDateTime | Last () |
| Obtains the maximum time in column start from currently selected rows of table yatish_timeslot. More... | |
| long | LastActivity () |
| Reads the last activity_id in yatish_timeslot. More... | |
| long | Activity (long) |
| Reads the activity_id in a record of yatish_timeslot. More... | |
| bool | Delete (tableID, long) |
| Marks a local record for deletion. More... | |
| wxString | ReadName (tableID, long) |
Reads a wxString from the name column. More... | |
| bool | ReadDates (long, wxDateTime &, wxDateTime &) |
| Reads the start and stop fields of a yatish_timeslot record. More... | |
| bool | RecordName (tableID, long, const wxString &) |
| Modifies or creates a record with only one field (called name). More... | |
| bool | RecordProject (long, const wxString &, int) |
| Modifies or creates a record in the yatish_project table. More... | |
| bool | RecordActivity (long, int, int, int) |
| Modifies or creates a record in the yatish_activity table. More... | |
| bool | RecordTimeslot (long, const wxDateTime &, const wxDateTime &, int, int, int) |
| Modifies or creates a record in the yatish_timeslot table. More... | |
Private Attributes | |
| bool | limitRow |
| int | rowLimit |
| long | currentTimeslotID |
| long | slotCount |
| wxArrayLong | clientIDs |
| wxArrayLong | projectIDs |
| wxArrayLong | taskIDs |
| wxArrayLong | toolIDs |
| wxString | firstDay |
| wxString | lastDay |
| wxString | filter |
| wxDateTime | wxFirstDay |
| wxDateTime | wxLastDay |
| wxTimeSpan | totalSpan |
Additional Inherited Members | |
Static Public Attributes inherited from yatishDB | |
| static const char * | tableName [] |
Must be defined in the same order as enum tableID. More... | |
Protected Member Functions inherited from yatishDB | |
| wxDatabase * | GetDatabase (const wxString &) |
Sets up a (configuration) flux using its argument then calls wxDatabase::GetDatabase(). More... | |
| bool | TablesOk (wxDatabase *) |
Returns false if any of the yatish table is missings. More... | |
Static Protected Attributes inherited from yatishDB | |
| static wxDatabase * | masterDB = nullptr |
Interacts with yatish tables in a SQLite database.
Cf. the application example distributed with the wxDatabase library.
The sync field of each table only exists in the local (SQlite) database, with values among:
date('now'). Such timestamps are stored by SQLite as TEXT fields in the UTC timezone (i.e. we don't use date('now','localtime')).Definition at line 40 of file yatishDBsqlite.h.
| yatishDBsqlite::yatishDBsqlite | ( | ) |
Mainly connects to the yatish.sqlite database.
(initializing protected member yatishDB::masterDB).
Definition at line 16 of file yatishDBsqlite.cpp.
| yatishDBsqlite::~yatishDBsqlite | ( | ) |
Definition at line 49 of file yatishDBsqlite.cpp.
| long yatishDBsqlite::Activity | ( | long | id | ) |
Reads the activity_id in a record of yatish_timeslot.
| id | the record to read |
Definition at line 499 of file yatishDBsqlite.cpp.
| void yatishDBsqlite::AddToFilter | ( | long | activityID | ) |
Adds a condition to the WHERE clause of FillList().
| activityID | the foreign key |
Definition at line 377 of file yatishDBsqlite.cpp.
| void yatishDBsqlite::AddToFilter | ( | tableID | tid, |
| int | choice | ||
| ) |
Adds a condition to the WHERE clause of FillList().
| tid | the table used to build the new condition |
| choice | the item in this table (as returned from a previously filled wxChoice) |
Definition at line 352 of file yatishDBsqlite.cpp.
| int yatishDBsqlite::ChoiceSelector | ( | tableID | tid, |
| long | id | ||
| ) |
Finds the proper index for selection in a wxChoice.
The selection corresponds to a given record in the refering table (cf. foreign keys in the yatish database schema).
| tid | either client_tid, project_tid, task_tid or tool_tid |
| id | of the foreign key to read from the refering table |
wxChoice index (or wxNOT_FOUND in case of problem) Definition at line 108 of file yatishDBsqlite.cpp.
|
inline |
Definition at line 55 of file yatishDBsqlite.h.
| bool yatishDBsqlite::Delete | ( | tableID | tid, |
| long | id | ||
| ) |
Marks a local record for deletion.
Actually deletes it if its sync status was 'I'.
| tid | Which table? |
| id | Which record? |
false if something went wrong or deletion was cancelled Definition at line 516 of file yatishDBsqlite.cpp.
| bool yatishDBsqlite::FillChoice | ( | wxChoice * | choices, |
| tableID | tid | ||
| ) |
Fills a wxChoice.
Corresponding values of the SQL id field are stored for future reference.
| choices | the control to fill |
| tid | either client_tid, project_tid, task_tid or tool_tid |
false if something went wrong Definition at line 62 of file yatishDBsqlite.cpp.
| bool yatishDBsqlite::FillList | ( | wxListCtrl * | lst, |
| tableID | tid | ||
| ) |
Fills a wxListCtrl.
The SQL id is stored as the row data.
| lst | the control to fill |
| tid | the type of data to fetch |
false if something went wrong Definition at line 219 of file yatishDBsqlite.cpp.
| bool yatishDBsqlite::FillPlotData | ( | RawData & | v | ) |
Fills a RawData (typedefined in yatishTypes.h).
| v | where to write (reference) |
false if something went wrong Definition at line 321 of file yatishDBsqlite.cpp.
| long yatishDBsqlite::FilteredTotal | ( | wxTimeSpan & | ts | ) | const |
Returns the total duration of currently viewed timeslots (and their count).
| [out] | ts | where the total duration shall be written |
Definition at line 387 of file yatishDBsqlite.cpp.
| wxString yatishDBsqlite::FilteredTotalFormatted | ( | ) |
Writes the total and average durations of currently viewed timeslots.
One work day amounts to 7 hours.
wxString, or wxEmptyString if the currently viewed table is not yatish_timeslot Definition at line 400 of file yatishDBsqlite.cpp.
| wxDateTime yatishDBsqlite::First | ( | ) |
Obtains the minimum time in column start from currently selected rows of table yatish_timeslot.
This time is provided in the local timezone.
Now() if something went wrong Definition at line 433 of file yatishDBsqlite.cpp.
|
inline |
Definition at line 54 of file yatishDBsqlite.h.
|
inline |
Definition at line 60 of file yatishDBsqlite.h.
|
inline |
Definition at line 61 of file yatishDBsqlite.h.
| wxDateTime yatishDBsqlite::Last | ( | ) |
Obtains the maximum time in column start from currently selected rows of table yatish_timeslot.
This time is provided in the local timezone.
Now() if something went wrong Definition at line 458 of file yatishDBsqlite.cpp.
| long yatishDBsqlite::LastActivity | ( | ) |
Reads the last activity_id in yatish_timeslot.
Definition at line 482 of file yatishDBsqlite.cpp.
| bool yatishDBsqlite::ReadDates | ( | long | id, |
| wxDateTime & | dt1, | ||
| wxDateTime & | dt2 | ||
| ) |
Reads the start and stop fields of a yatish_timeslot record.
| id | Which record? |
| dt1 | where to write the start value |
| dt2 | where to write the stop value |
false if something went wrong (or activity still running) Definition at line 562 of file yatishDBsqlite.cpp.
| wxString yatishDBsqlite::ReadName | ( | tableID | tid, |
| long | id | ||
| ) |
Reads a wxString from the name column.
| tid | Which table? |
| id | Which record? |
Definition at line 546 of file yatishDBsqlite.cpp.
| bool yatishDBsqlite::RecordActivity | ( | long | id, |
| int | project, | ||
| int | task, | ||
| int | tool | ||
| ) |
Modifies or creates a record in the yatish_activity table.
| id | Which record? A new record is created if id == wxNOT_FOUND. |
| project,task,tool | indexes selected in previously filled wxChoices |
false if something went wrong Definition at line 646 of file yatishDBsqlite.cpp.
| bool yatishDBsqlite::RecordName | ( | tableID | tid, |
| long | id, | ||
| const wxString & | str | ||
| ) |
Modifies or creates a record with only one field (called name).
| tid | Which table? |
| id | Which record? A new record is created if id == wxNOT_FOUND. |
| str | the new name |
false if something went wrong Definition at line 588 of file yatishDBsqlite.cpp.
| bool yatishDBsqlite::RecordProject | ( | long | id, |
| const wxString & | str, | ||
| int | client_choice | ||
| ) |
Modifies or creates a record in the yatish_project table.
| id | Which record? A new record is created if id == wxNOT_FOUND. |
| str | the new name |
| client_choice | index selected in a previously filled wxChoice |
false if something went wrong Definition at line 617 of file yatishDBsqlite.cpp.
| bool yatishDBsqlite::RecordTimeslot | ( | long | id, |
| const wxDateTime & | dt1, | ||
| const wxDateTime & | dt2, | ||
| int | project, | ||
| int | task, | ||
| int | tool | ||
| ) |
Modifies or creates a record in the yatish_timeslot table.
Also inserts the corresponding row in the activity table, if necessary.
| id | Which record? A new record is created if id == wxNOT_FOUND. |
| dt1,dt2 | the new start and stop |
| project,task,tool | indexes selected in previously filled wxChoices |
false if something went wrong Definition at line 680 of file yatishDBsqlite.cpp.
| int yatishDBsqlite::RunningTimeslots | ( | ) |
Determines the number n of unfinished timeslots.
Definition at line 201 of file yatishDBsqlite.cpp.
| void yatishDBsqlite::SetFirstDay | ( | const wxDateTime & | dt | ) |
Sets private member firstDay (for future SQL queries).
firstDay is a UTC time string in ISO format.
Definition at line 415 of file yatishDBsqlite.cpp.
| void yatishDBsqlite::SetLastDay | ( | const wxDateTime & | dt | ) |
Sets private member lastDay (for future SQL queries).
lastDay is a UTC time string in ISO format.
Definition at line 424 of file yatishDBsqlite.cpp.
|
inline |
Definition at line 49 of file yatishDBsqlite.h.
| bool yatishDBsqlite::StartTimeslot | ( | int | project, |
| int | task, | ||
| int | tool | ||
| ) |
Starts a new row in the timeslot table.
Also inserts the corresponding row in the activity table, if necessary.
| project,task,tool | 0-based index of the item currently selected in panel #1 |
false if something went wrong Definition at line 148 of file yatishDBsqlite.cpp.
| bool yatishDBsqlite::StopTimeslot | ( | ) |
Stops current timeslot.
false if something went wrong Definition at line 186 of file yatishDBsqlite.cpp.
|
private |
Definition at line 77 of file yatishDBsqlite.h.
|
private |
Definition at line 76 of file yatishDBsqlite.h.
|
private |
Definition at line 78 of file yatishDBsqlite.h.
|
private |
Definition at line 78 of file yatishDBsqlite.h.
|
private |
Definition at line 78 of file yatishDBsqlite.h.
|
private |
Definition at line 74 of file yatishDBsqlite.h.
|
private |
Definition at line 77 of file yatishDBsqlite.h.
|
private |
Definition at line 75 of file yatishDBsqlite.h.
|
private |
Definition at line 76 of file yatishDBsqlite.h.
|
private |
Definition at line 77 of file yatishDBsqlite.h.
|
private |
Definition at line 77 of file yatishDBsqlite.h.
|
private |
Definition at line 80 of file yatishDBsqlite.h.
|
private |
Definition at line 79 of file yatishDBsqlite.h.
|
private |
Definition at line 79 of file yatishDBsqlite.h.