public function FrxPostgres::__construct in Forena Reports 7
Same name and namespace in other branches
- 6.2 plugins/FrxPostgres.inc \FrxPostgres::__construct()
- 6 plugins/FrxPostgres.inc \FrxPostgres::__construct()
- 7.2 plugins/FrxPostgres.inc \FrxPostgres::__construct()
- 7.3 plugins/FrxPostgres.inc \FrxPostgres::__construct()
- 7.4 plugins/FrxPostgres.inc \FrxPostgres::__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/
FrxPostgres.inc, line 22 - Oracle specific driver that takes advantage of oracles native XML support
Class
- FrxPostgres
- @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 (@$conf['postgres_xml']) {
$this->use_postgres_xml = TRUE;
}
if ($uri) {
// Test for postgres suport
if (!is_callable('pg_connect')) {
forena_error('PHP Postgres support not installed.', 'PHP Postgres support not installed.');
return;
}
try {
$db = pg_connect($uri);
if (isset($conf['search path'])) {
pg_query($db, "SET search_path=" . $conf['search path']);
}
$this->db = $db;
} catch (Exception $e) {
forena_error('Unable to connect to database ' . $conf['title'], $e
->getMessage());
}
}
else {
forena_error('No database connection string specified', 'No database connection: ' . print_r($conf, 1));
}
// Set up the stuff required to translate.
$this->te = new FrxSyntaxEngine(FRX_SQL_TOKEN, ':', $this);
}