isc_dsql_xml_fetch()

From InterBase

Go Up to API Function Reference


Appends retrieved data to an XML-formatted file and returns this data to the XSQLDA.

Syntax

 int isc_dsql_xml_fetch(
 ISC_STATUS *status_vector, 
 isc_stmt_handle *stmt_handle, 
 unsigned short da_version, 
 XSQLDA *xsqlda, 
 IB_XMLDA *ib_xmlda);
Parameter Type Description

status_vector

ISC_STATUS*

Pointer to the error status vector

stmt_handle

isc_stmt_handle *

Pointer to a statement handle previously executed with isc_dsql_execute_statement() or ­isc_dsql_alloc_execute2().

da_version

unsigned short

Specifies that XSQLDA, rather than SQLDA, should be used; set this value to 1.

xsqlda

XSQLDA *

Pointer to an optional, previously allocated XSQLDA used for results of statement execution.

ib_xmlda

IB_XMLDA*

Pointer to an initialized XML descriptor area, IB_XMLDA

Description: isc_dsql_xml_fetch() works on a previously prepared and executed statement and returns one row of data into the xmlda_file_name file each time it is called. Each time it is called in a loop, it retrieves and processes one row of data. It is used in the same manner as isc_dsql_fetch(). It is up to the application code to provide the loop construct for fetching the data.

The ib_xmlda descriptor area is described in detail in the Exporting XML chapter in this book.

Before calling isc_dsql_xml_fetch(), a statement must be prepared with isc_dsql_prepare() and executed with isc_dsql_execute(). Statement execution produces a result set containing the returned row. Each call to isc_dsql_xml_fetch() retrieves the next available row of data from the InterBase database using stmt_handle and produces two possible outputs: it retrieves into the XSQLDA and appends to the XML file specified by xmlda_file_name in the ib_xmlda descriptor.

After calling isc_dsql_xml_fetch(), you still have access to the data in the cursor using XSQLDA.

Example

fetch_stat = isc_dsql_xml_fetch(status_vector, &stmt_handle, 1,
  sqlda, &xmlda) == 0

For a complete example of how to generate XML from an InterBase table, see Exporting XML.

See Also

Advance To: