00001 /********************************************************************\ 00002 * qofsession-p.h -- private functions for QOF sessions. * 00003 * * 00004 * This program is free software; you can redistribute it and/or * 00005 * modify it under the terms of the GNU General Public License as * 00006 * published by the Free Software Foundation; either version 2 of * 00007 * the License, or (at your option) any later version. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU General Public License* 00015 * along with this program; if not, contact: * 00016 * * 00017 * Free Software Foundation Voice: +1-617-542-5942 * 00018 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 00019 * Boston, MA 02110-1301, USA gnu@gnu.org * 00020 * * 00021 \********************************************************************/ 00022 00023 /* 00024 * HISTORY: 00025 * Copyright (c) 2001 Linux Developers Group 00026 * Copyright (c) 1998-2003 Linas Vepstas <linas@linas.org> 00027 */ 00028 00029 #ifndef QOF_SESSION_P_H 00030 #define QOF_SESSION_P_H 00031 00032 #include "qofbook.h" 00033 #include "qofsession.h" 00034 00035 struct _QofSession 00036 { 00037 /* This is just a "fake" entry point to allow me to pass a Session as 00038 * an Entity. NOTE: THIS IS NOT AN ENTITY! THE ONLY PART OF ENTITY 00039 * THAT IS VALID IS E_TYPE! 00040 */ 00041 QofEntity entity; 00042 00043 /* A book holds pointers to the various types of datasets. 00044 * A session may have multiple books. */ 00045 GList *books; 00046 00047 /* The requested book id, in the form or a URI, such as 00048 * file:/some/where, or sql:server.host.com:555 00049 */ 00050 char *book_id; 00051 00052 /* If any book subroutine failed, this records the failure reason 00053 * (file not found, etc). 00054 * This is a 'stack' that is one deep. (Should be deeper ??) 00055 * FIXME: Each backend has its own error stack. The session 00056 * and the backends should all be using (or making it look like) 00057 * there is only one stack. 00058 */ 00059 QofBackendError last_err; 00060 char *error_message; 00061 00062 /* ---------------------------------------------------- */ 00063 /* Pointer to the backend that is actually used to move data 00064 * between the persistant store and the local engine. */ 00065 QofBackend *backend; 00066 }; 00067 00068 00069 QofBackend *qof_session_get_backend (QofSession * session); 00070 00071 void qof_session_push_error (QofSession * session, QofBackendError err, 00072 const char *message); 00073 00074 QofBackend *gncBackendInit_file (const char *book_id, void *data); 00075 00076 #endif