#ifndef _DBXML_HELPER_H_ #define _DBXML_HELPER_H_ #include #include #include "pthread.h" extern "C" { struct XmlQueryExpressionInfo; struct XmlManagerInfo { XmlManagerInfo(); ~XmlManagerInfo(); pthread_mutex_t mutex; DbXml::XmlManager mgr; std::set queryExpressions; }; struct XmlQueryExpressionInfo { XmlQueryExpressionInfo( DbXml::XmlQueryExpression qe, XmlManagerInfo* mi); ~XmlQueryExpressionInfo(); DbXml::XmlQueryExpression qe; XmlManagerInfo* mi; }; int _xmlManager(DbEnv* dbenv, u_int32_t flags, XmlManagerInfo** mgr); void _xmlManager_close(XmlManagerInfo* mgr); int _xmlManager_openContainer(XmlManagerInfo* mgr, const char* name, u_int32_t flags, int cType, int mode, DbXml::XmlContainer*** container); void _xmlContainer_delete(DbXml::XmlContainer** cont); void _xmlContainer_close(DbXml::XmlContainer** cont); int _xmlManager_createTransaction(XmlManagerInfo* mgr, u_int32_t flags, DbXml::XmlTransaction** trans); int _xmlManager_createTransaction_DbTxn(XmlManagerInfo* mgr, DbTxn** dbtxnp, DbXml::XmlTransaction** trans); void _xmlTransaction_delete(DbXml::XmlTransaction* trans); int _xmlTransaction_commit(DbXml::XmlTransaction* trans); int _xmlTransaction_abort(DbXml::XmlTransaction* trans); int _xmlContainer_getDocument(DbXml::XmlContainer** cont, DbXml::XmlTransaction* trans, const char* key, u_int32_t flags, DbXml::XmlDocument** doc); char* _xmlContainer_getName(DbXml::XmlContainer** cont); void _deleteString(char* str); void _xmlDocument_delete(DbXml::XmlDocument* doc); int _xmlDocument_getContent(DbXml::XmlDocument* doc, char** str, int* length); int _xmlManager_createQueryContext(XmlManagerInfo* mgr, int rt, int ev, DbXml::XmlQueryContext** ctx); void _xmlQueryContext_delete(DbXml::XmlQueryContext* ctx); void _xmlResults_delete(DbXml::XmlResults* res); int _xmlResults_hasNext(DbXml::XmlResults* res, int* answer); int _xmlResults_nextDocument(DbXml::XmlResults* res, DbXml::XmlDocument** doc); int _xmlResults_nextValue(DbXml::XmlResults* res, DbXml::XmlValue** val); int _xmlManager_query(XmlManagerInfo* mgr, DbXml::XmlTransaction* trans, const char* query, DbXml::XmlQueryContext* ctx, u_int32_t flags, DbXml::XmlResults** res); void _xmlQueryExpression_delete(XmlQueryExpressionInfo* exp); int _xmlManager_prepare(XmlManagerInfo* mgr, DbXml::XmlTransaction* trans, const char* query, DbXml::XmlQueryContext* ctx, XmlQueryExpressionInfo** exp); int _xmlQueryContext_setDefaultCollection(DbXml::XmlQueryContext* ctx, const char* coll); int _xmlQueryContext_setVariableValue(DbXml::XmlQueryContext* ctx, const char* name, DbXml::XmlValue* value); void _xmlValue_delete(DbXml::XmlValue* exp); DbXml::XmlValue* _xmlNone(); DbXml::XmlValue* _xmlString(const char* text); DbXml::XmlValue* _xmlBool(int value); DbXml::XmlValue* _xmlDouble(double value); int _xmlValue_asString(DbXml::XmlValue* value, char** str); int _xmlQueryExpression_execute(XmlQueryExpressionInfo* exp, DbXml::XmlTransaction* trans, DbXml::XmlValue* contextItem, DbXml::XmlQueryContext* qctx, u_int32_t flags, DbXml::XmlResults** res); int _xmlManager_createDocument(XmlManagerInfo* mgr, DbXml::XmlDocument** doc); int _xmlDocument_getName(DbXml::XmlDocument* doc, char** name); int _xmlDocument_setName(DbXml::XmlDocument* doc, const char* name); void _xmlUpdateContext_delete(DbXml::XmlUpdateContext* ctx); int _xmlManager_createUpdateContext(XmlManagerInfo* mgr, DbXml::XmlUpdateContext** ctx); int _xmlDocument_setContent(DbXml::XmlDocument* doc, const char* text, unsigned int length); int _xmlContainer_updateDocument(DbXml::XmlContainer** cont, DbXml::XmlTransaction* trans, DbXml::XmlDocument* doc, DbXml::XmlUpdateContext* uctx); int _xmlContainer_putDocument(DbXml::XmlContainer** cont, DbXml::XmlTransaction* trans, DbXml::XmlDocument* doc, DbXml::XmlUpdateContext* uctx, u_int32_t flags); int _xmlContainer_deleteDocument(DbXml::XmlContainer** cont, DbXml::XmlTransaction* trans, DbXml::XmlDocument* doc, DbXml::XmlUpdateContext* uctx); } #endif