|
GnuCash 2.4.99
|
00001 /********************************************************************\ 00002 * qofbackend.h: api for data storage backend * 00003 * This program is free software; you can redistribute it and/or * 00004 * modify it under the terms of the GNU General Public License as * 00005 * published by the Free Software Foundation; either version 2 of * 00006 * the License, or (at your option) any later version. * 00007 * * 00008 * This program is distributed in the hope that it will be useful, * 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00011 * GNU General Public License for more details. * 00012 * * 00013 * You should have received a copy of the GNU General Public License* 00014 * along with this program; if not, contact: * 00015 * * 00016 * Free Software Foundation Voice: +1-617-542-5942 * 00017 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 00018 * Boston, MA 02110-1301, USA gnu@gnu.org * 00019 * * 00020 \********************************************************************/ 00044 #ifndef QOF_BACKEND_H 00045 #define QOF_BACKEND_H 00046 00047 #include "qofinstance.h" 00048 00049 #define QOF_MOD_BACKEND "qof.backend" 00050 00055 typedef enum 00056 { 00057 ERR_BACKEND_NO_ERR = 0, 00058 ERR_BACKEND_NO_HANDLER, 00059 ERR_BACKEND_NO_BACKEND, 00060 ERR_BACKEND_BAD_URL, 00061 ERR_BACKEND_NO_SUCH_DB, 00062 ERR_BACKEND_CANT_CONNECT, 00063 ERR_BACKEND_CONN_LOST, 00064 ERR_BACKEND_LOCKED, 00065 ERR_BACKEND_STORE_EXISTS, 00066 ERR_BACKEND_READONLY, 00067 ERR_BACKEND_TOO_NEW, 00068 ERR_BACKEND_DATA_CORRUPT, 00069 ERR_BACKEND_SERVER_ERR, 00070 ERR_BACKEND_ALLOC, 00071 ERR_BACKEND_PERM, 00073 ERR_BACKEND_MODIFIED, 00075 ERR_BACKEND_MOD_DESTROY, 00077 ERR_BACKEND_MISC, 00079 ERR_QOF_OVERFLOW, 00086 /* fileio errors */ 00087 ERR_FILEIO_FILE_BAD_READ = 1000, 00088 ERR_FILEIO_FILE_EMPTY, 00089 ERR_FILEIO_FILE_LOCKERR, 00090 ERR_FILEIO_FILE_NOT_FOUND, 00091 ERR_FILEIO_FILE_TOO_OLD, 00092 ERR_FILEIO_UNKNOWN_FILE_TYPE, 00093 ERR_FILEIO_PARSE_ERROR, 00094 ERR_FILEIO_BACKUP_ERROR, 00095 ERR_FILEIO_WRITE_ERROR, 00096 ERR_FILEIO_READ_ERROR, 00097 ERR_FILEIO_NO_ENCODING, 00098 ERR_FILEIO_FILE_EACCES, 00099 ERR_FILEIO_RESERVED_WRITE, 00101 ERR_FILEIO_FILE_UPGRADE, 00104 /* network errors */ 00105 ERR_NETIO_SHORT_READ = 2000, 00106 ERR_NETIO_WRONG_CONTENT_TYPE, 00107 ERR_NETIO_NOT_GNCXML, 00109 /* database errors */ 00110 ERR_SQL_MISSING_DATA = 3000, 00111 ERR_SQL_DB_TOO_OLD, 00112 ERR_SQL_DB_TOO_NEW, 00113 ERR_SQL_DB_BUSY, 00114 ERR_SQL_BAD_DBI, 00115 ERR_SQL_DBI_UNTESTABLE, 00117 /* RPC errors */ 00118 ERR_RPC_HOST_UNK = 4000, 00119 ERR_RPC_CANT_BIND, 00120 ERR_RPC_CANT_ACCEPT, 00121 ERR_RPC_NO_CONNECTION, 00122 ERR_RPC_BAD_VERSION, 00123 ERR_RPC_FAILED, 00124 ERR_RPC_NOT_ADDED, 00125 } QofBackendError; 00126 00133 typedef struct QofBackendProvider_s QofBackendProvider; 00134 00143 typedef struct QofBackend_s QofBackend; 00144 00146 typedef void (*QofBePercentageFunc) (/*@ null @*/ const char *message, double percent); 00147 00150 00151 void qof_backend_run_begin(QofBackend *be, QofInstance *inst); 00152 00153 gboolean qof_backend_begin_exists(const QofBackend *be); 00154 00155 void qof_backend_run_commit(QofBackend *be, QofInstance *inst); 00156 00157 gboolean qof_backend_commit_exists(const QofBackend *be); 00159 00163 void qof_backend_set_error (QofBackend *be, QofBackendError err); 00164 00167 QofBackendError qof_backend_get_error (QofBackend *be); 00168 00169 00179 gboolean 00180 qof_load_backend_library(const gchar *directory, const gchar* module_name); 00181 00183 void qof_finalize_backend_libraries(void); 00184 00186 QofBackend* qof_book_get_backend (const QofBook *book); 00187 00188 void qof_book_set_backend (QofBook *book, QofBackend *); 00189 00190 #endif /* QOF_BACKEND_H */ 00191
1.7.4