GnuCash
5.6-150-g038405b370+
|
Public Member Functions | |
GncXmlBackend (const GncXmlBackend &)=delete | |
GncXmlBackend | operator= (const GncXmlBackend &)=delete |
GncXmlBackend (const GncXmlBackend &&)=delete | |
GncXmlBackend | operator= (const GncXmlBackend &&)=delete |
void | session_begin (QofSession *session, const char *new_uri, SessionOpenMode mode) override |
Open the file or connect to the server. More... | |
void | session_end () override |
void | load (QofBook *book, QofBackendLoadType loadType) override |
Load the minimal set of application data needed for the application to be operable at initial startup. More... | |
void | export_coa (QofBook *) override |
Extract the chart of accounts from the current database and create a new database with it. More... | |
void | sync (QofBook *book) override |
Synchronizes the engine contents to the backend. More... | |
void | safe_sync (QofBook *book) override |
Perform a sync in a way that prevents data loss on a DBI backend. | |
void | commit (QofInstance *instance) override |
Commits the changes from the engine to the backend data storage. | |
const char * | get_filename () |
QofBook * | get_book () |
Public Member Functions inherited from QofBackend | |
QofBackend (const QofBackend &)=delete | |
QofBackend (const QofBackend &&)=delete | |
virtual void | begin (QofInstance *) |
Called when the engine is about to make a change to a data structure. More... | |
virtual void | rollback (QofInstance *) |
Revert changes in the engine and unlock the backend. | |
void | set_error (QofBackendError err) |
Set the error value only if there isn't already an error already. | |
QofBackendError | get_error () |
Retrieve the currently-stored error and clear it. | |
bool | check_error () |
Report if there is an error. | |
void | set_message (std::string &&) |
Set a descriptive message that can be displayed to the user when there's an error. | |
const std::string && | get_message () |
Retrieve and clear the stored error message. | |
void | set_percentage (QofBePercentageFunc pctfn) |
Store and retrieve a backend-specific function for determining the progress in completing a long operation, for use with a progress meter. | |
QofBePercentageFunc | get_percentage () |
const std::string & | get_uri () |
Retrieve the backend's storage URI. | |
Additional Inherited Members | |
Static Public Member Functions inherited from QofBackend | |
static bool | register_backend (const char *, const char *) |
Class methods for dynamically loading the several backends and for freeing them at shutdown. | |
static void | release_backends () |
Protected Attributes inherited from QofBackend | |
QofBePercentageFunc | m_percentage |
std::string | m_fullpath |
Each backend resolves a fully-qualified file path. More... | |
Definition at line 26 of file gnc-xml-backend.hpp.
|
overridevirtual |
Extract the chart of accounts from the current database and create a new database with it.
Implemented only in the XML backend at present.
Reimplemented from QofBackend.
Definition at line 344 of file gnc-xml-backend.cpp.
|
overridevirtual |
Load the minimal set of application data needed for the application to be operable at initial startup.
It is assumed that the application will perform a 'run_query()' to obtain any additional data that it needs. For file-based backends, it is acceptable for the backend to return all data at load time; for SQL-based backends, it is acceptable for the backend to return no data.
Thus, for example, the old GnuCash postgres backend returned the account tree, all currencies, and the pricedb, as these were needed at startup. It did not have to return any transactions whatsoever, as these were obtained at a later stage when a user opened a register, resulting in a query being sent to the backend. The current DBI backend on the other hand loads the entire database into memory.
(Its OK to send over entities at this point, but one should be careful of the network load; also, its possible that whatever is sent is not what the user wanted anyway, which is why its better to wait for the query).
Implements QofBackend.
Definition at line 229 of file gnc-xml-backend.cpp.
|
overridevirtual |
Open the file or connect to the server.
session | The QofSession that will control the backend. |
new_uri | The location of the data store that the backend will use. |
mode | The session open mode. See qof_session_begin(). |
Implements QofBackend.
Definition at line 114 of file gnc-xml-backend.cpp.
|
overridevirtual |
Synchronizes the engine contents to the backend.
This should done by using version numbers (hack alert – the engine does not currently contain version numbers). If the engine contents are newer than what is in the backend, the data is stored to the backend. If the engine contents are older, then the engine contents are updated.
Note that this sync operation is only meant to apply to the current contents of the engine. This routine is not intended to be used to fetch entity data from the backend.
File based backends tend to use sync as if it was called dump. Data is written out into the backend, overwriting the previous data. Database backends should implement a more intelligent solution.
Implements QofBackend.
Definition at line 303 of file gnc-xml-backend.cpp.