SQL::ResultSetToXML Method
Syntax
Arguments
- RowsToCopyNumeric
Default = -1. The number of rows to copy.
- StartRowNumeric
Default = 1. The first row to copy.
- DocumentNameNumeric
The tag for the document element. See example.
- RowNameNumeric
The tag for the row element. See example.
- HeaderNumeric
The tag for the header element. See example.
- ReferenceColumnsSQL::TableInfo
When data is formatted for a column in the result set: (1) if ReferenceColumns has a column with a matching name, that object will be used to format the data; (2) otherwise the ColumnInfo property of the result set is used to format the data.
- UserContextPointer
The user context is passed into the evaluation of the expression when data is formatted.
Returns
- XML_StringCharacter
Returns the XML formatted data returned by the query.
Description
Convert ResultSet an XML formatted string.
Discussion
The ToXML() method converts a SQL::ResultSet object to a XML formatted string.
Example
dim sql as C sql = "select * from customers where country = :country" dim args as SQL::Arguments args.set("country","Poland") dim conn as SQL::Connection if .not. conn.open("::Name::AADemo-Northwind") ui_msg_box("Error", conn.CallResult.text) end end if if .not. conn.execute(sql, args) ui_msg_box("Error", conn.CallResult.text) conn.close() end end if dim xml as c xml = conn.ResultSet.toXML(-1, -1, "DocName", "RowName", "HeaderName") conn.close() showvar(xml,"XML Data")
The XML data looks like this:
HeaderName <DocName> <RowName> <CustomerID Type="C">WOLZA</CustomerID> <CompanyName Type="C">Wolski Zajazd</CompanyName> <ContactName Type="C">Zbyszek Piestrzeniewicz</ContactName> <ContactTitle Type="C">Owner</ContactTitle> <Address Type="C">ul. Filtrowa 68</Address> <City Type="C">Warszawa</City> <Region Type="C"></Region> <PostalCode Type="C">01-012</PostalCode> <Country Type="C">Poland</Country> <Phone Type="C">(26) 642-7012</Phone> <Fax Type="C">(26) 642-7012</Fax> </RowName> </DocName>