首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

eXtremeDB XML[通俗易懂]

大家好,又见面了,我是你们的朋友全栈君。 For C/C++ applications the eXtremeDB schema compiler option “–x” causes mcocomp to generate interface functions to retrieve, create and replace (update) the contents of an object with the content of an XML string. In addition to the common use of XML interfaces for porting data, these XML interface functions can be used, for instance, in concert with the eXtremeDB event notifications, to cause live data to be shared between eXtremeDB and other systems when an object of interest changes in the database. The XML interfaces can also be used to facilitate simple schema evolution by exporting the database to XML, adding/dropping fields, indexes, and classes, and importing the saved XML into the new database. XML export and import The XML export and import functions are used in conjunction with user-defined file I/O helper functions to stream eXtremeDB database contents to and from persistent media files: MCO_RET mco_db_xml_export(mco_trans_h t, void* stream_handle, mco_stream_write output_stream_writer); MCO_RET mco_db_xml_import(mco_trans_h t, void* stream_handle, mco_stream_read input_stream_reader); When mco_db_xml_export() is called the internal runtime implementation calls the user-defined handler output_stream_writer to manage the output stream. And likewise mco_db_xml_import() causes the handler input_stream_reader to be called. Simple file I/O handlers look like the following: mco_size_sig_t file_writer(void* stream_handle /* FILE* */, const void* from, mco_size_t nbytes) { return (mco_size_t) fwrite(from, 1, nbytes, (FILE*) stream_handle); } mco_size_sig_t file_reader(void* stream_handle /* FILE* */, void* to, mco_size_t max_nbytes) { return (mco_size_t) fread(to, 1, max_nbytes, (FILE*) stream_handle); } Chapter 13 : eXtremeDB XML Interfaces 264 eXtremeDB User’s Guide Function mco_db_xml_export() may be called within a READ_ONLY transaction but, as expected, mco_db_xml_import() must be calle

02
领券