private function FrxOracle::oracle_xml in Forena Reports 7.3
Same name and namespace in other branches
- 6.2 plugins/FrxOracle.inc \FrxOracle::oracle_xml()
- 6 plugins/FrxOracle.inc \FrxOracle::oracle_xml()
- 7 plugins/FrxOracle.inc \FrxOracle::oracle_xml()
- 7.2 plugins/FrxOracle.inc \FrxOracle::oracle_xml()
- 7.4 plugins/FrxOracle.inc \FrxOracle::oracle_xml()
Generate xml from sql using the provided f_forena
Parameters
unknown_type $sql:
Return value
unknown
1 call to FrxOracle::oracle_xml()
- FrxOracle::sqlData in plugins/
FrxOracle.inc - Get data based on file data block in the repository.
File
- plugins/
FrxOracle.inc, line 107 - Oracle specific driver that takes advantage of oracles native XML support
Class
- FrxOracle
- @file Oracle specific driver that takes advantage of oracles native XML support
Code
private function oracle_xml($sql, $block) {
$db = $this->db;
//$rs->debugDumpParams();
$fsql = 'declare x XMLTYPE; begin x := f_forena_xml(:p1); :ret_val := x.getClobVal(); end; ';
$stmt = oci_parse($db, $fsql);
$ret = oci_new_descriptor($db, OCI_D_LOB);
oci_bind_by_name($stmt, ':ret_val', $ret, -1, OCI_B_CLOB);
oci_bind_by_name($stmt, ':p1', $sql);
$r = oci_execute($stmt, OCI_DEFAULT);
// Report errors
if (!$r) {
$e = oci_error($stmt);
// For oci_execute errors pass the statement handle
$msg .= htmlentities($e['message']);
$msg .= "\n<pre>\n";
$msg .= htmlentities($e['sqltext']);
//printf("\n%".($e['offset']+1)."s", "^");
$msg .= "\n</pre>\n";
$this
->error('Database error in ' . $this->block_name . ' see logs for info', $msg);
return NULL;
}
$xml_text = $ret
->load();
if ($xml_text) {
$xml = new SimpleXMLElement($xml_text);
if ($xml
->getName() == 'error') {
$msg = (string) $xml . ' in ' . $this->block_name . '.sql. ';
$this
->error($msg . 'See logs for more info', $msg . ' in <pre> ' . $sql . '</pre>');
}
}
oci_free_statement($stmt);
return $xml;
}