public function FrxOracle::__construct in Forena Reports 6.2
Same name and namespace in other branches
- 6 plugins/FrxOracle.inc \FrxOracle::__construct()
- 7 plugins/FrxOracle.inc \FrxOracle::__construct()
- 7.2 plugins/FrxOracle.inc \FrxOracle::__construct()
- 7.3 plugins/FrxOracle.inc \FrxOracle::__construct()
- 7.4 plugins/FrxOracle.inc \FrxOracle::__construct()
Object constructor
Parameters
unknown_type $uri Database connection string.:
string $repos_path Path to location of data block definitions:
Overrides FrxDataProvider::__construct
File
- plugins/
FrxOracle.inc, line 23 - 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
public function __construct($conf, $repos_path) {
parent::__construct($conf, $repos_path);
$this->use_oracle_xml = FALSE;
$uri = $conf['uri'];
$this->debug = $conf['debug'];
if (isset($conf['schema'])) {
$this->schema = $conf['schema'];
}
if ($conf['oracle_xml']) {
$this->use_oracle_xml = TRUE;
}
if ($uri) {
// Test for postgres suport
if (!is_callable('oci_connect')) {
$this
->error('OCI support not installed.', 'OCI support not installed.');
return;
}
try {
$db = oci_connect($conf['user'], $conf['password'], $uri, @$conf['character_set']);
$this->db = $db;
} catch (Exception $e) {
$this
->error('Unable to connect to database ' . $conf['title'], $e
->getMessage());
}
}
else {
$this
->error('No database connection string specified', 'No database connection: ' . print_r($conf, 1));
}
if ($this->db) {
$stmt = oci_parse($this->db, "alter session set NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'");
oci_execute($stmt);
}
// Set up the stuff required to translate.
$this->te = new FrxSyntaxEngine(FRX_SQL_TOKEN, ':', $this);
}