DataDirect forODBC drivers allow 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:
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.
2. Execute a SQL statement. For example:
SQLExecDirect (hstmt, "SELECT * FROM GTABLE", SQL_NTS)
3. Persist the result set as an XML data file. For example:
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.
Argument
Definition
StatementHandle
The handle of the statement that contains the result set to persist as XML.
Attribute
SQL_PERSIST_AS_XML. This statement attribute can be found in the file qesqlext.h, which is installed with the driver.
ValuePtr
Pointer to a URL that specifies the full path name of the XML data file to be generated. The directory specified in the path name must exist, and if the specified file name exists, the file will be overwritten.
StringLength
The length of the string pointed to by ValuePtr or SQL_NTS if ValuePtr points to a NULL-terminated string.
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: