Persisting a Result Set as an XML Data File
NOTE: If you are persisting a result set that contains Long data, you must enable the EnableStaticCursorsforLongData connection string attribute.
This driver allows you to persist a result set as an XML data file with embedded schema. To implement XML persistence, a client application must do the following:
- Turn on STATIC cursors. For example:
SQLSetStmtAttr (hstmt, SQL_ATTR_CURSOR_TYPE, SQL_CURSOR_STATIC, SQL_IS_INTEGER)
NOTE: A result set can be persisted as an XML data file only if the result set is generated using STATIC cursors. Otherwise, the following error is returned:
Driver only supports XML persistence when using driver's static cursors.
- Execute a SQL statement. For example:
SQLExecDirect (hstmt, "SELECT * FROM GTABLE", SQL_NTS)
- Persist the result set as an XML data file. For example:
SQLSetStmtAttr (hstmt, SQL_PERSIST_AS_XML, "C:\temp\GTABLE.XML", SQL_NTS)
NOTE: A statement attribute is available to support XML persistence, SQL_PERSIST_AS_XML. A client application must call SQLSetStmtAttr with this attribute as an argument. See the following table for the definition of valid arguments for SQLSetStmtAttr.
A client application can choose to persist the data at any time that the statement is in an executed or cursor-positioned state. At any other time, the driver returns the following message:
Using the UNIX and Linux XML Persistence Demo Tool
On UNIX and Linux, the product is shipped with an XML persistence demo tool named demoodbc. This tool is installed in the demo subdirectory of the installation directory. For information about how to use this tool, refer to the demoodbc.txt file installed in the demo directory.