Opened 14 years ago
Last modified 14 years ago
#1398 closed task
Upgrade to DbXml 2.5.16 — at Version 3
Reported by: | rohitr | Owned by: | brucedechant |
---|---|---|---|
Priority: | low | Milestone: | 2.3 |
Component: | General | Version: | 2.2.0 |
Severity: | trivial | Keywords: | dbxml, upgrade, oem |
Cc: | External ID: |
Description (last modified by )
1.> Used DbEnv.get_DB_ENV and DbTxn.get_DB_TXN to get the underlying DB_ENV and DB_TXN structure and used that with the DbXml public interface.
Changed
environment->GetXmlManager().createTransaction(m_dbTxn)));
to
environment->GetXmlManager().createTransaction(m_dbTxn->get_DB_TXN())));
and
m_xmlMan = XmlManager(&m_dbEnv, DBXML_ALLOW_EXTERNAL_ACCESS);
to
m_xmlMan = XmlManager(m_dbEnv.get_DB_ENV(), DBXML_ALLOW_EXTERNAL_ACCESS);
2.>Added a function DbXml::getContentAsDOM(const XmlValue &value). and used the constructor of the XmlValue to get an XmlValue handle on xmlDoc. The function is modified from an example in dbxml/example folder. Its a hack and I plan to make a proper class pretty soon.
Created 2 files xercesDomTranslator.h and xercesDomTranslator.cpp. These are trivially modified forms of the file of the same name in dbxml example folder. However the function is trivial and I would make a class to encapsulate it, after I finish compilation. The function defined is
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *getContentAsDOM(const DbXml::XmlValue &value);
It requires an XmlValue and this is constructed by the constructor of the XmlValue class from the XmlDocument passed to it.
3.>Since XmlModify has been removed, we can use a simple Xquery Update to delete records. For example where our query was
query = "/Role/Users/User[Name=<foobar>]";
we change it to
query = "delete nodes /Role/Users/User[Name=<foobar>]";
and just execute the query with XmlManager::query().
4.>The function for assigning flags to DbEnv has been changed from set_flags to log_set_config. The define LOG_INMEMORY is no longer defined. It has been replaced with LOG_IN_MEMORY, which is functionally equivalent.
5.>Included db_cxx.h . Also removed the 'catch' for DbException. This isnt completely necessary but seeing that DbXml wants to encapsulate DbException inside XmlException and the functionality was similar, I removed it.
catch (XmlException& e) \ { \ MgStringCollection arguments; \ STRING message; \ \ if (DB_LOCK_DEADLOCK == e.getDbErrno()) \ { \ message = MgUtil::GetResourceMessage( \ MgResources::ResourceService, L"MgRepositoryBusy"); \ } \ else \ { \ MgUtil::MultiByteToWideChar(string(e.what()), message); \ } \ \ arguments.Add(message); \ mgException = new MgDbXmlException(methodName, __LINE__, __WFILE__, NULL, L"MgFormatInnerExceptionMessage", &arguments); \ (static_cast<MgThirdPartyException*>(mgException.p))->SetErrorCode(e.getDbErrno()); \ }
and
catch (DbException& e) \ { \ MgStringCollection arguments; \ STRING message; \ \ if (DB_LOCK_DEADLOCK == e.get_errno()) \ { \ message = MgUtil::GetResourceMessage( \ MgResources::ResourceService, L"MgRepositoryBusy"); \ } \ else \ { \ MgUtil::MultiByteToWideChar(string(e.what()), message); \ } \ \ arguments.Add(message); \ mgException = new MgDbException(methodName, __LINE__, __WFILE__, NULL, L"MgFormatInnerExceptionMessage", &arguments); \ (static_cast<MgThirdPartyException*>(mgException.p))->SetErrorCode(e.get_errno()); \ }
Since XmlException would be triggered on a DbException and would give the same DbErrno and what() string, it seemed redundant to include this. Note the initial motivation was this to go with the philosophy of dbxml of hiding DB as much as possible. Unfortunately due to MapGuide's use of DB objects in multiple places, that won't be possible.
6.>As there is no other option, but to go with LiveValues and afaik there appears to be no difference, I have just removed the lines.
Change History (3)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Description: | modified (diff) |
---|---|
Owner: | set to |
comment:3 by , 14 years ago
Description: | modified (diff) |
---|
This ticket is inline with the dbxml upgrade outlined in http://trac.osgeo.org/mapguide/wiki/MapGuideRfc102.
Changelogs for DbXml
http://www.oracle.com/technology/documentation/berkeley-db/xml/ref_xml/changelog/2.5.html
http://www.oracle.com/technology/documentation/berkeley-db/xml/ref_xml/changelog/2.4.html
Principle changes that concern us:-
1.>C++ applications are required to change the use of the Berkeley DB C++ objects in the public interface to their C equivalents.
2.>All C++ interfaces that used Xerces-C DOM have been removed, including XmlDocument::getContentAsDOM() .
3.>XmlModify has been removed.
4.>Functionality in DbEnv.set_flags() has been moved to DbEnv.log_set_config()
5.>The underlying DB environment is hidden from the program and has to be explicitly enabled by including db_cxx.h
6.>The enumeration, XmlQueryContext::DeadValues, has been removed. The related method, XmlQueryContext::setReturnType() remains but is a no-op. All results are LiveValues.