private function FrxOracle::oracle_xml in Forena Reports 7.4
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.3 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 121 - 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) {
$msg .= htmlentities($e['message'], NULL, 'UTF-8');
$msg .= "\n<pre>\n";
$msg .= htmlentities($e['sqltext'], NULL, 'UTF-8');
//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') {
if (!$this->block_name) {
$short = t('%e.', array(
'%e' => (string) $xml,
));
}
else {
$short = t('%e in %b.sql', array(
'%e' => (string) $xml,
'%b' => $this->block_name,
));
}
$msg = (string) $xml . ' in ' . $this->block_name . '.sql. ';
$this
->error($short, $msg . ' in <pre> ' . $sql . '</pre>');
}
}
oci_free_statement($stmt);
return $xml;
}