You are here

private function FrxMSSQL::mssql_xml in Forena Reports 7.2

Same name and namespace in other branches
  1. 6.2 plugins/FrxMSSQL.inc \FrxMSSQL::mssql_xml()
  2. 6 plugins/FrxMSSQL.inc \FrxMSSQL::mssql_xml()
  3. 7 plugins/FrxMSSQL.inc \FrxMSSQL::mssql_xml()
  4. 7.3 plugins/FrxMSSQL.inc \FrxMSSQL::mssql_xml()
  5. 7.4 plugins/FrxMSSQL.inc \FrxMSSQL::mssql_xml()

Generate xml from sql using the provided f_forena

Parameters

unknown_type $sql:

Return value

unknown

1 call to FrxMSSQL::mssql_xml()
FrxMSSQL::data in plugins/FrxMSSQL.inc
Get data based on file data block in the repository.

File

plugins/FrxMSSQL.inc, line 97
Oracle specific driver that takes advantage of oracles native XML support

Class

FrxMSSQL
@file Oracle specific driver that takes advantage of oracles native XML support

Code

private function mssql_xml($sql, $block) {
  $db = $this->db;

  //$rs->debugDumpParams();
  $fsql = $sql . ' FOR XML AUTO';
  $rs = mssql_query($db, $fsql, array(
    $sql,
    '',
  ));
  if ($rs) {
    $row = mssql_fetch_row($rs);
    $xml_text = $row[0];
  }
  if ($xml_text) {
    $xml = new SimpleXMLElement($xml_text);
    if ($xml
      ->getName() == 'error') {
      $msg = (string) $xml . ' in ' . $block . '.sql. ';
      FrxReportGenerator::instance()
        ->error($msg . 'See logs for more info', $msg . ' in <pre> ' . $sql . '</pre>');
    }
  }
  if ($rs) {
    mssql_free_result($rs);
  }
  return $xml;
}