GnuCash  4.8a-80-g9825132ea+
Macros | Typedefs | Enumerations | Functions

Encapsulates a connection to a backend (persistent store) More...

#include "qofbackend.h"
#include "qofbook.h"
#include "qofclass.h"
#include "qofobject.h"

Go to the source code of this file.

Macros

#define QOF_MOD_SESSION   "qof.session"
 

Typedefs

typedef void(* QofPercentageFunc) (const char *message, double percent)
 The qof_session_load() method causes the QofBook to be made ready to to use with this URL/datastore. More...
 

Enumerations

enum  SessionOpenMode {
  SESSION_NORMAL_OPEN = 0, SESSION_NEW_STORE = 2, SESSION_NEW_OVERWRITE = 3, SESSION_READ_ONLY = 4,
  SESSION_BREAK_LOCK = 5
}
 Mode for opening sessions. More...
 

Functions

QofSession * qof_session_new (QofBook *book)
 
void qof_session_destroy (QofSession *session)
 
void qof_session_swap_data (QofSession *session_1, QofSession *session_2)
 The qof_session_swap_data () method swaps the book of the two given sessions. More...
 
void qof_session_begin (QofSession *session, const char *new_uri, SessionOpenMode mode)
 Begins a new session. More...
 
void qof_session_load (QofSession *session, QofPercentageFunc percentage_func)
 
QofBook * qof_session_get_book (const QofSession *session)
 Returns the QofBook of this session. More...
 
const char * qof_session_get_file_path (const QofSession *session)
 The qof_session_get_file_path() routine returns the fully-qualified file path for the session. More...
 
const char * qof_session_get_url (const QofSession *session)
 
gboolean qof_session_save_in_progress (const QofSession *session)
 The qof_session_not_saved() subroutine will return TRUE if any data in the session hasn't been saved to long-term storage.
 
QofBackendqof_session_get_backend (const QofSession *session)
 Returns the qof session's backend.
 
void qof_session_save (QofSession *session, QofPercentageFunc percentage_func)
 The qof_session_save() method will commit all changes that have been made to the session. More...
 
void qof_session_safe_save (QofSession *session, QofPercentageFunc percentage_func)
 A special version of save used in the sql backend which moves the existing tables aside, then saves everything to new tables, then deletes the old tables after the save is completed without error. More...
 
void qof_session_end (QofSession *session)
 The qof_session_end() method will release the session lock. More...
 
gboolean qof_session_export (QofSession *tmp_session, QofSession *real_session, QofPercentageFunc percentage_func)
 
GList * qof_backend_get_registered_access_method_list (void)
 Return a list of strings for the registered access methods. More...
 
void qof_session_ensure_all_data_loaded (QofSession *session)
 Ensure all of the data is loaded from the session.
 
Session Errors
QofBackendError qof_session_get_error (QofSession *session)
 The qof_session_get_error() routine can be used to obtain the reason for any failure. More...
 
const char * qof_session_get_error_message (const QofSession *session)
 
QofBackendError qof_session_pop_error (QofSession *session)
 The qof_session_pop_error() routine can be used to obtain the reason for any failure. More...
 
Event Handling
gboolean qof_session_events_pending (const QofSession *session)
 The qof_session_events_pending() method will return TRUE if the backend has pending events which must be processed to bring the engine up to date with the backend.
 
gboolean qof_session_process_events (QofSession *session)
 The qof_session_process_events() method will process any events indicated by the qof_session_events_pending() method. More...
 

Detailed Description

Encapsulates a connection to a backend (persistent store)

Author
Copyright (c) 1998, 1999, 2001, 2002 Linas Vepstas linas.nosp@m.@lin.nosp@m.as.or.nosp@m.g
Copyright (c) 2000 Dave Peticolas
Copyright (c) 2005 Neil Williams linux.nosp@m.@cod.nosp@m.ehelp.nosp@m..co..nosp@m.uk

Definition in file qofsession.h.

Function Documentation

◆ qof_backend_get_registered_access_method_list()

GList* qof_backend_get_registered_access_method_list ( void  )

Return a list of strings for the registered access methods.

The owner is responsible for freeing the list but not the strings.

Definition at line 107 of file qofsession.cpp.

108 {
109  GList* list = NULL;
110  std::for_each(s_providers.begin(), s_providers.end(),
111  [&list](QofBackendProvider_ptr& provider) {
112  gpointer method = reinterpret_cast<gpointer>(const_cast<char*>(provider->access_method));
113  list = g_list_prepend(list, method);
114  });
115  return list;
116 }

◆ qof_session_process_events()

gboolean qof_session_process_events ( QofSession *  session)

The qof_session_process_events() method will process any events indicated by the qof_session_events_pending() method.

It returns TRUE if the engine was modified while engine events were suspended.

Definition at line 673 of file qofsession.cpp.

674 {
675  if (!session) return FALSE;
676  return session->process_events ();
677 }