GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Functions
qofsession.h File Reference

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"
 
#define QOF_STDOUT   ">"
 Allow session data to be printed to stdout. More...
 

Typedefs

typedef struct _QofSession QofSession
 
typedef void(* QofPercentageFunc )(const char *message, double percent)
 

Functions

QofSessionqof_session_new (void)
 
void qof_session_destroy (QofSession *session)
 
void qof_session_swap_data (QofSession *session_1, QofSession *session_2)
 
void qof_session_begin (QofSession *session, const char *book_id, gboolean ignore_lock, gboolean create, gboolean force)
 
void qof_session_load (QofSession *session, QofPercentageFunc percentage_func)
 
QofBookqof_session_get_book (const QofSession *session)
 
const char * qof_session_get_file_path (const QofSession *session)
 
const char * qof_session_get_url (const QofSession *session)
 
gboolean qof_session_save_in_progress (const QofSession *session)
 
void qof_session_save (QofSession *session, QofPercentageFunc percentage_func)
 
void qof_session_safe_save (QofSession *session, QofPercentageFunc percentage_func)
 
void qof_session_end (QofSession *session)
 
void qof_session_add_close_hook (GFunc fn, gpointer data)
 
void qof_session_call_close_hooks (QofSession *session)
 
gboolean qof_session_export (QofSession *tmp_session, QofSession *real_session, QofPercentageFunc percentage_func)
 
GList * qof_backend_get_registered_access_method_list (void)
 
void qof_session_ensure_all_data_loaded (QofSession *session)
 
Session Errors
QofBackendError qof_session_get_error (QofSession *session)
 
const char * qof_session_get_error_message (const QofSession *session)
 
QofBackendError qof_session_pop_error (QofSession *session)
 
Event Handling
gboolean qof_session_events_pending (const QofSession *session)
 
gboolean qof_session_process_events (QofSession *session)
 

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.

Macro Definition Documentation

#define QOF_STDOUT   ">"

Allow session data to be printed to stdout.

book_id can't be NULL and we do need to have an access_method, so use one to solve the other.

To print a session to stdout, use qof_session_begin. Example:

qof_session_begin(session,QOF_STDOUT,TRUE,FALSE);

When you call qof_session_save(session, NULL), the output will appear on stdout and can be piped or redirected to other processes.

Currently, only the QSF backend supports writing to stdout, other backends may return a QofBackendError.

Definition at line 273 of file qofsession.h.

Function Documentation

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.

void qof_session_add_close_hook ( GFunc  fn,
gpointer  data 
)

Register a function to be called just before a session is closed.

Parameters
fnThe function to be called. The function definition must be func(gpointer session, gpointer user_data);
dataThe data to be passed to the function.
void qof_session_call_close_hooks ( QofSession session)

Call all registered session close hooks, informing them that the specified session is about to be closed.

Parameters
sessionA pointer to the session being closed.
void qof_session_ensure_all_data_loaded ( QofSession session)

Ensure all of the data is loaded from the session.

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. It returns TRUE if the engine was modified while engine events were suspended.