You are here

public function FrxMSSQL::__construct in Forena Reports 7

Same name and namespace in other branches
  1. 6.2 plugins/FrxMSSQL.inc \FrxMSSQL::__construct()
  2. 6 plugins/FrxMSSQL.inc \FrxMSSQL::__construct()
  3. 7.2 plugins/FrxMSSQL.inc \FrxMSSQL::__construct()
  4. 7.3 plugins/FrxMSSQL.inc \FrxMSSQL::__construct()
  5. 7.4 plugins/FrxMSSQL.inc \FrxMSSQL::__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/FrxMSSQL.inc, line 22
Oracle specific driver that takes advantage of oracles native XML support

Class

FrxMSSQL
@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['mssql_xml']) {
    $this->use_mssql_xml = TRUE;
  }
  if ($uri) {

    // Test for mssql suport
    if (!is_callable('mssql_connect')) {
      forena_error('MSSQL support not installed.', 'MSSQL mssql support not installed.');
      return;
    }
    try {
      $db = mssql_connect($uri, $conf['user'], $conf['password']);
      $this->db = $db;
      if ($db) {
        mssql_select_db($conf['database'], $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);
}