602SQL Documentation Index  



boolean wb_import_from_XML_buffer( resource connection, string dad_ref, string buffer [, array hostvars] )


Identifier of the open connection returned by the wb_connect or wb_pconnect function.
Pointer to the DAD.
A text string of the XML document that is to be imported.
An array with the client variable descriptions. Optional parameter.

Since version



This function imports XML data from the specified string buffer according to the mapping description set in the DAD.

The dad_ref may have two forms: object_name prefixed with an asterisk (e.g. *object_name), the transfer type object is searched for in the DAD of the current opened application, otherwise the DAD definition is read directly 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 PHP application client variables bound to an element of the DAD. If you do not use these variables, either omit the hostvars parameter, or set to the PHP constant NULL. The format of client variable descriptions are specified here.


TRUE if successful, otherwise FALSE.



XML data come from the 602XML Filler to the script - we'll create the query and return it back to the Filler as new data:

  $xml_data = $GLOBALS["HTTP_RAW_POST_DATA"];  // receiving XML data (POST method)

 // 1. read XML data and assignt then to PHP variables
 //    A Special import DAD (to variables) will use as well as a XMLAPI function

    // first variable is _id_seller
    "_id_seller" => array(
        // a type is Integer
        "type" => ATT_INT32,
        // it is OUT variable
        "out" => TRUE,
        "value" => null
    // second variable is _date
    "_date" => array(
        // a type is Date
        "type" => ATT_DATE,
        // it is OUT variable
        "out" => TRUE,
        "value" => null

  @wb_import_from_XML_buffer($connection, "*sellers_imp_var", $xml_data, $hostvars);

  if($hostvars["_id_prodejce"]["value"]==null){        // variable is empty 
   echo ' Id nebylo zadano.';                  // print info for 602XML Filler to the std. output
  if($hostvars["_datum"]["value"]==null){              // variable is empty
   echo ' Datum nebylo zadano.';               // print info for 602XML Filler to the std. output

 // echo date("d.m.Y",$hostvars["_datum"]["value"]);  // date conversino to readable form

 // 2. to creater the new query using the client variables 

  $psqlstmt = 'SELECT * FROM Sellers, Sale WHERE Sellers._id_seller=Sale._id_seller AND _id_seller=? AND Sale.s_date=?' ;
  wb_psql_send_param($psql, 0, $hostvars["_id_seller"]["value"]);
  wb_psql_send_param($psql, 1, $hostvars["_date"]["value"]);
  $res = wb_psql_execute($psql);

  if ($res)  // a cursor number is in $res
    print(wb_export_to_XML_buffer($connection,'*dadexport_sale',$res));       // send the result of the function to the Filler
    close($res);                                                              // close curzor
  else  {
    echo 'Opening cursor error...';