public function FrxPostgres::sqlData in Forena Reports 7.4
Same name and namespace in other branches
- 7.3 plugins/FrxPostgres.inc \FrxPostgres::sqlData()
Get data based on file data block in the repository.
Parameters
String $block_name:
Array $parm_data:
Query $subQuery:
Overrides FrxDataSource::sqlData
File
- plugins/
FrxPostgres.inc, line 58 - Postgres specific driver that takes advantage of native XML support
Class
- FrxPostgres
- @file Postgres specific driver that takes advantage of native XML support
Code
public function sqlData($sql, $options = array()) {
// Load the block from the file
$db = $this->db;
$xml = '';
// Load the types array based on data
$this->types = isset($options['type']) ? $options['type'] : array();
if ($sql && $db) {
$sql = $this->te
->replace($sql);
$time_start = microtime(true);
if ($this->use_postgres_xml) {
$xml = $this
->postgres_xml($sql, 'table');
}
else {
$xml = $this
->php_xml($sql);
}
$time_end = microtime(true);
if ($this->debug) {
$d = '';
if ($xml) {
$d = htmlspecialchars($xml
->asXML());
}
$elapsed = (int) (($time_end - $time_start) * 1000.0);
$this
->debug("SQL ({$elapsed}ms): " . $sql, '<pre> SQL:' . $sql . "\n XML: " . $d . "\n</pre>");
}
return $xml;
}
}