diff options
| author | David Sommerseth <dazo@users.sourceforge.net> | 2008-12-18 09:44:58 +0100 |
|---|---|---|
| committer | David Sommerseth <dazo@users.sourceforge.net> | 2008-12-18 09:44:58 +0100 |
| commit | 51cc59081231e0397b963167be4ed32df995f755 (patch) | |
| tree | fb6ec7d4fdfbfa1940e5f28ccfc11da9097aef02 /database/sqlite | |
| parent | 5c1af0cbf682c056f01e0c392321ba648b33def4 (diff) | |
Added more comments and some XML format documentation
Diffstat (limited to 'database/sqlite')
| -rw-r--r-- | database/sqlite/administration.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/database/sqlite/administration.c b/database/sqlite/administration.c index 825fcd0..6c586ec 100644 --- a/database/sqlite/administration.c +++ b/database/sqlite/administration.c @@ -409,9 +409,19 @@ inline int xml_set_flag(xmlNode *node, char *flagname, int flagged) { } -// This function will read out all info from eurephiaINFO *user which is not NULL and create a query based -// on these values. If a user is found, the *user struct will be updated with the user found. On success -// the function returns 1. +// This function will search up a user, based on information given in a fieldMapping structure. +// It will return an XML document containing the user information requested, controlled by the +// getInfo flag. These flags are defined in eurephiadb_driver.h +// +// The search XML document format is: +// <eurephia format="1"> +// <fieldMapping table="users"> +// <{search field}>{search value}</{search field}> +// </fieldMapping> +// </eurehpia> +// +// It can be several search field tags to limit the search even more. +// xmlDoc *eDBadminGetUserInfo(eurephiaCTX *ctx, int getInfo, xmlDoc *srch) { dbresult *uinf = NULL, *certinf = NULL; eDBfieldMap *uinfo_map = NULL; @@ -546,6 +556,19 @@ int eDBadminAddUser(eurephiaCTX *ctx, xmlDoc *usrinf) { } +// This function will update a user account based on the XML document sent in as a parameter. +// The function will double check that the uid in the argument list and the uid in the XML +// document is coherent. +// +// The format of the input XML is: +// <eurephia format="1"> +// <update_user uid="{uid}"> +// <fieldMapping table="users"> +// <{field name}>{new value}</{field name}> +// </fieldMapping> +// </update_user> +// </eurephia> +// int eDBadminUpdateUser(eurephiaCTX *ctx, const int uid, xmlDoc *usrinf) { dbresult *uinf = NULL; xmlDoc *srch_xml = NULL; @@ -554,6 +577,7 @@ int eDBadminUpdateUser(eurephiaCTX *ctx, const int uid, xmlDoc *usrinf) { xmlChar *xmluid = 0; assert( (ctx != NULL) && (usrinf != NULL) ); + // Get the update_user node root_n = eurephiaXML_getRoot(ctx, usrinf, "update_user", 1); if( root_n == NULL ) { eurephia_log(ctx, LOG_ERROR, 0, "Could not find proper XML element for user update"); @@ -574,7 +598,7 @@ int eDBadminUpdateUser(eurephiaCTX *ctx, const int uid, xmlDoc *usrinf) { // Create an eDBfieldMap structure for the srch_map (used for WHERE clause) eurephiaXML_CreateDoc(ctx, 1, "fieldMapping", &srch_xml, &srch_n); xmlNewProp(srch_n, (xmlChar *) "table", (xmlChar *) "users"); - xmlNewChild(srch_n, NULL, (xmlChar *) "uid", xmluid); + xmlNewChild(srch_n, NULL, (xmlChar *) "uid", xmluid); // Add uid as the only criteria srch_map = eDBxmlMapping(ctx, tbl_sqlite_users, NULL, srch_n); assert( srch_map != NULL ); |
