You are here

private function FrxMSSQL::mssql_xml in Forena Reports 7.5

Generate xml from sql using the provided f_forena

Parameters

unknown_type $sql:

Return value

unknown

1 call to FrxMSSQL::mssql_xml()
FrxMSSQL::sqlData in src/Driver/FrxMSSQL.php
Get data based on file data block in the repository.

File

src/Driver/FrxMSSQL.php, line 102
Oracle specific driver that takes advantage of oracles native XML support

Class

FrxMSSQL

Namespace

Drupal\forena\Driver

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. ';
      \Frx::error($msg . 'See logs for more info', $msg . ' in <pre> ' . $sql . '</pre>');
    }
  }
  if ($rs) {
    mssql_free_result($rs);
  }
  return $xml;
}