You are here

public function FrxMSSQL::__construct in Forena Reports 7.5

Object constructor

Parameters

unknown_type $uri Database connection string.:

string $repos_path Path to location of data block definitions:

Overrides FrxDataSource::__construct

File

src/Driver/FrxMSSQL.php, line 24
Oracle specific driver that takes advantage of oracles native XML support

Class

FrxMSSQL

Namespace

Drupal\forena\Driver

Code

public function __construct($conf, $repos_path, $name) {
  parent::__construct($conf, $repos_path, $name);
  $this->db_type = 'mssql';
  $this->use_mssql_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')) {
      \Frx::error('MSSQL support not installed.', 'MSSQL mssql support not installed.');
      return;
    }
    try {
      ini_set('mssql.textlimit', 2147483647);
      ini_set('mssql.textsize', 2147483647);
      $db = mssql_connect($uri, $conf['user'], $conf['password']);
      $this->db = $db;
      if ($db) {
        mssql_select_db($conf['database'], $db);
        mssql_query("SET QUOTED_IDENTIFIER ON");
      }
    } catch (Exception $e) {
      \Frx::error('Unable to connect to database ' . $conf['title'], $e
        ->getMessage());
    }
  }
  else {
    \Frx::error('No database connection string specified', 'No database connection: ' . print_r($conf, 1));
  }

  // Set up the stuff required to translate.
  $this->te = new SQLReplacer($this);
}