Files | |
file | qofbackend-p.h |
private api for data storage backend | |
file | qofbook-p.h |
Private QofBook interface. | |
file | qofobject-p.h |
the Core Object Registration/Lookup Private Interface | |
Data Structures | |
struct | QofBackendProvider_s |
struct | QofBackend_s |
struct | _QofBook |
Backend_Private | |
Pseudo-object defining how the engine can interact with different back-ends (which may be SQL databases, or network interfaces to remote QOF servers. File-io is just one type of backend).
The callbacks will be called at the appropriate times during a book session to allow the backend to store the data as needed. | |
void | qof_backend_register_provider (QofBackendProvider *) |
void | qof_backend_set_error (QofBackend *be, QofBackendError err) |
QofBackendError | qof_backend_get_error (QofBackend *be) |
void | qof_backend_set_message (QofBackend *be, const gchar *format,...) |
gchar * | qof_backend_get_message (QofBackend *be) |
void | qof_backend_init (QofBackend *be) |
gchar | qof_book_get_open_marker (QofBook *book) |
gint32 | qof_book_get_version (QofBook *book) |
guint32 | qof_book_get_idata (QofBook *book) |
void | qof_book_set_version (QofBook *book, gint32 version) |
void | qof_book_set_idata (QofBook *book, guint32 idata) |
Book_Private | |
void | qof_book_set_backend (QofBook *book, QofBackend *be) |
Set the backend used by this book. | |
gboolean | qof_book_register (void) |
Class_Private | |
void | qof_class_init (void) |
void | qof_class_shutdown (void) |
QofSortFunc | qof_class_get_default_sort (QofIdTypeConst obj_name) |
Entity_Private | |
void | qof_entity_set_guid (QofEntity *ent, const GUID *guid) |
void | qof_collection_insert_entity (QofCollection *, QofEntity *) |
void | qof_collection_mark_clean (QofCollection *) |
void | qof_collection_mark_dirty (QofCollection *) |
Objects_Private | |
void | qof_object_book_begin (QofBook *book) |
void | qof_object_book_end (QofBook *book) |
gboolean | qof_object_is_dirty (QofBook *book) |
void | qof_object_mark_clean (QofBook *book) |
gboolean | qof_object_compliance (QofIdTypeConst type_name, gboolean warn) |
check an object can be created and supports iteration |
|
The qof_backend_get_error() routine pops an error code off the error stack. Definition at line 58 of file qofbackend.c. 00059 { 00060 QofBackendError err; 00061 if (!be) 00062 return ERR_BACKEND_NO_BACKEND; 00063 00064 /* use 'stack-pop' semantics */ 00065 err = be->last_err; 00066 be->last_err = ERR_BACKEND_NO_ERR; 00067 return err; 00068 }
|
|
The qof_backend_get_message() pops the error message string from the Backend. This string should be freed with g_free(). Definition at line 97 of file qofbackend.c. 00098 { 00099 gchar *msg; 00100 00101 if (!be) 00102 return g_strdup ("ERR_BACKEND_NO_BACKEND"); 00103 if (!be->error_msg) 00104 return NULL; 00105 00106 /* 00107 * Just return the contents of the error_msg and then set it to 00108 * NULL. This is necessary, because the Backends don't seem to 00109 * have a destroy_backend function to take care of freeing stuff 00110 * up. The calling function should free the copy. 00111 * Also, this is consistent with the qof_backend_get_error() popping. 00112 */ 00113 00114 msg = be->error_msg; 00115 be->error_msg = NULL; 00116 return msg; 00117 }
|
|
Definition at line 122 of file qofbackend.c. 00123 { 00124 be->session_begin = NULL; 00125 be->session_end = NULL; 00126 be->destroy_backend = NULL; 00127 be->load = NULL; 00128 be->begin = NULL; 00129 be->commit = NULL; 00130 be->rollback = NULL; 00131 be->compile_query = NULL; 00132 be->free_query = NULL; 00133 be->run_query = NULL; 00134 be->sync = NULL; 00135 be->load_config = NULL; 00136 be->events_pending = NULL; 00137 be->process_events = NULL; 00138 be->last_err = ERR_BACKEND_NO_ERR; 00139 if (be->error_msg) 00140 g_free (be->error_msg); 00141 be->error_msg = NULL; 00142 be->percentage = NULL; 00143 be->backend_configuration = kvp_frame_new (); 00144 00146 be->price_lookup = NULL; 00148 be->export = NULL; 00149 }
|
|
Let the sytem know about a new provider of backends. This function is typically called by the provider library at library load time. This function allows the backend library to tell QOF infrastructure that it can handle URL's of a certain type. Note that a single backend library may register more than one provider, if it is capable of handling more than one URL access method. Definition at line 56 of file qofsession.c.
|
|
The qof_backend_set_error() routine pushes an error code onto the error stack. (FIXME: the stack is 1 deep in current implementation). Definition at line 46 of file qofbackend.c. 00047 { 00048 if (!be) 00049 return; 00050 00051 /* use stack-push semantics. Only the earliest error counts */ 00052 if (ERR_BACKEND_NO_ERR != be->last_err) 00053 return; 00054 be->last_err = err; 00055 }
|
|
The qof_backend_set_message() assigns a string to the backend error message. Definition at line 71 of file qofbackend.c. 00072 { 00073 va_list args; 00074 gchar *buffer; 00075 00076 if (!be) 00077 return; 00078 00079 /* If there's already something here, free it */ 00080 if (be->error_msg) 00081 g_free (be->error_msg); 00082 00083 if (!format) 00084 { 00085 be->error_msg = NULL; 00086 return; 00087 } 00088 00089 va_start (args, format); 00090 buffer = (gchar *) g_strdup_vprintf (format, args); 00091 va_end (args); 00092 00093 be->error_msg = buffer; 00094 }
|
|
get the book tag number used for kvp management in sql backends. Definition at line 295 of file qofbook.c. 00296 { 00297 if (!book) 00298 { 00299 return 0; 00300 } 00301 return book->idata; 00302 }
|
|
Allow backends to see if the book is open
Definition at line 275 of file qofbook.c. 00276 { 00277 if (!book) 00278 { 00279 return 'n'; 00280 } 00281 return book->book_open; 00282 }
|
|
get the book version used for tracking multiuser updates in backends.
Definition at line 285 of file qofbook.c. 00286 { 00287 if (!book) 00288 { 00289 return -1; 00290 } 00291 return book->version; 00292 }
|
|
Register books with the framework Definition at line 376 of file qofbook.c. 00377 { 00378 static QofParam params[] = { 00379 {QOF_PARAM_GUID, QOF_TYPE_GUID, 00380 (QofAccessFunc) qof_entity_get_guid, 00381 NULL}, 00382 {QOF_PARAM_KVP, QOF_TYPE_KVP, 00383 (QofAccessFunc) qof_instance_get_slots, 00384 NULL}, 00385 {NULL}, 00386 }; 00387 00388 qof_class_register (QOF_ID_BOOK, NULL, params); 00389 00390 return TRUE; 00391 }
|
|
Set the backend used by this book. Should only be used within a backend itself. Definition at line 170 of file qofbook.c. 00171 { 00172 if (!book) 00173 return; 00174 ENTER ("book=%p be=%p", book, be); 00175 book->backend = be; 00176 LEAVE (" "); 00177 }
|
|
Take entity, remove it from whatever collection its currently in, and place it in a new collection. To be used only for moving entity from one book to another. Definition at line 197 of file qofid.c. 00198 { 00199 if (!col || !ent) 00200 return; 00201 if (guid_equal (&ent->guid, guid_null ())) 00202 return; 00203 g_return_if_fail (col->e_type == ent->e_type); 00204 qof_collection_remove_entity (ent); 00205 g_hash_table_insert (col->hash_of_entities, &ent->guid, ent); 00206 qof_collection_mark_dirty (col); 00207 ent->collection = col; 00208 }
|
|
reset value of dirty flag Definition at line 368 of file qofid.c.
|
|
Set the ID of the entity, over-riding the previous ID. Very dangerous, use only for file i/o work. Definition at line 92 of file qofid.c. 00093 { 00094 QofCollection *col; 00095 if (guid_equal (guid, &ent->guid)) 00096 return; 00097 00098 col = ent->collection; 00099 qof_collection_remove_entity (ent); 00100 ent->guid = *guid; 00101 qof_collection_insert_entity (col, ent); 00102 }
|
|
To be called from within the book Definition at line 60 of file qofobject.c. 00061 { 00062 GList *l; 00063 00064 if (!book) 00065 return; 00066 ENTER (" "); 00067 for (l = object_modules; l; l = l->next) 00068 { 00069 QofObject *obj = l->data; 00070 if (obj->book_begin) 00071 obj->book_begin (book); 00072 } 00073 00074 /* Remember this book for later */ 00075 book_list = g_list_prepend (book_list, book); 00076 LEAVE (" "); 00077 }
|
|
check an object can be created and supports iteration
Definition at line 155 of file qofobject.c. 00156 { 00157 const QofObject *obj; 00158 00159 obj = qof_object_lookup (type_name); 00160 if ((obj->create == NULL) || (obj->foreach == NULL)) 00161 { 00162 if (warn) 00163 { 00164 PINFO (" Object type %s is not fully QOF compliant", 00165 obj->e_type); 00166 } 00167 return FALSE; 00168 } 00169 return TRUE; 00170 }
|