function db_init() {
        if ($this->is_configured() === false) {
            throw new moodle_exception('auth_dbcantconnect', 'auth_db');
        }

        // Connect to the external database (forcing new connection).
        $authdb = ADONewConnection($this->config->type);
        if (!empty($this->config->debugauthdb)) {
            $authdb->debug = true;
            ob_start(); //Start output buffer to allow later use of the page headers.
        }
        $authdb->Connect($this->config->host, $this->config->user, $this->config->pass, $this->config->name, true);
        $authdb->SetFetchMode(ADODB_FETCH_ASSOC);
        if (!empty($this->config->setupsql)) {
            $authdb->Execute($this->config->setupsql);
        }

        return $authdb;
    }
function db_init() {
        if ($this->is_configured() === false) {
            throw new moodle_exception('auth_dbcantconnect', 'auth_db');
        }

        // Connect to the external database (forcing new connection).
        $authdb = ADONewConnection($this->config->type);
        if (!empty($this->config->debugauthdb)) {
            $authdb->debug = true;
            ob_start(); //Start output buffer to allow later use of the page headers.
        }
        $authdb->Connect($this->config->host, $this->config->user, $this->config->pass, $this->config->name, true);
        $authdb->SetFetchMode(ADODB_FETCH_ASSOC);
        if (!empty($this->config->setupsql)) {
            $authdb->Execute($this->config->setupsql);
        }

        return $authdb;
    }
function db_init ( ) { if ( $ this -> is_configured ( ) === false ) { throw new moodle_exception ( 'auth_dbcantconnect' , 'auth_db' ) ; } // Connect to the external database (forcing new connection). $ authdb = ADONewConnection ( $ this -> config -> type ) ; if ( ! empty ( $ this -> config -> debugauthdb ) ) { $ authdb -> debug = true ; ob_start ( ) ; //Start output buffer to allow later use of the page headers. } $ authdb -> Connect ( $ this -> config -> host , $ this -> config -> user , $ this -> config -> pass , $ this -> config -> name , true ) ; $ authdb -> SetFetchMode ( ADODB_FETCH_ASSOC ) ; if ( ! empty ( $ this -> config -> setupsql ) ) { $ authdb -> Execute ( $ this -> config -> setupsql ) ; } return $ authdb ; }
Connect to external database.

@return ADOConnection
@throws moodle_exception
Connect to external database .