602SQL Documentation Index  



boolean wb_export_to_XML( resource connection, string dad_ref, string fname, resource cursor [, array hostvars] )


Identifier of the open connection, returned by the wb_connect or wb_pconnect function.
Reference to the DAD.
Name of the target XML file for data export.
Identifier of an open cursor or the NULL PHP constant.
An array with the client variable descriptions. Optional parameter.

Since version



This function exports data specified in the Data Access Definition (DAD) to the XML format (using the specified file fname). Using an analytical DAD, the data source is fixed by the DAD description, therefore set the cursor = NULL. Using a syntactical DAD you may use the DAD description, then set cursor = NULL or use redirecting to an open cursor of the same structure (set the PHP identifier of this cursor in the curs parameter, the result of the wb_exec or wb_psql_execute function that opened the cursor).

The dad_ref may have two forms: object_name prefixed with an asterisk (*object_name), then the transfer type object is searched for in the DAD of the opened application, otherwise the DAD definition is read from this parameter.

If the DAD is designed to a ODBC Data Source, then this ODBC connection must be open using the wb_odbc_connect fuction in advance. If the DAD is designed to a different 602SQL server, then this different connection must be open using wb_connect function in advance.

The hostvars array allows you to pass the PHP application client variables that may be used in the query specified as the data source in DAD as variables bound to some element of the DAD. If you do not use these variables, either omit the hostvars parameter, or set the PHP constant to NULL. The format of client variable descriptions is specified here.


TRUE if successful, otherwise it is FALSE.



Export XML data from DAD that is redirected to a variable cursor:

  $dad = "*c_test";
  $exfile = "C:\\temp\\test.xml";
  $id = 0;

  $sql = "SELECT id_cust, surname, first_name, register_date FROM Customers WHERE id_cust =".$id;
  $cur = wb_exec($conn,$sql);
  $res = wb_export_to_XML($conn, $dad, $exfile, $cur, NULL);