protected function checkConnection($reconnect = false)
        {
            if(empty($this->_lnk)) {
                $this->log('CheckConnection: link is not valid');
                if($reconnect) {
                    $this->log('CheckConnection: try to reconnect');
                    $this->_lnk = @odbc_connect('Driver=' . VERTICA_DRIVER . ';Servername=' . VERTICA_SERVER . ';Database='.VERTICA_DATABASE, VERTICA_USER_ETL, VERTICA_PASS_ETL);
                    if(!$this->_lnk) {
                        $this->log('CheckConnection: reconnect failed');
                        throw new Exception('Connection failed or gone away and can\'t reconnect - '.odbc_errormsg($this->_link), self::CONNECTION_FAILED);
                    }
                    $this->log('CheckConnection: reconnected!');
                    return;
                }
                throw new Exception('Connection failed or gone away - ' . odbc_errormsg($this->_link), self::CONNECTION_FAILED);
            }
        }
protected function checkConnection($reconnect = false)
        {
            if(empty($this->_lnk)) {
                $this->log('CheckConnection: link is not valid');
                if($reconnect) {
                    $this->log('CheckConnection: try to reconnect');
                    $this->_lnk = @odbc_connect('Driver=' . VERTICA_DRIVER . ';Servername=' . VERTICA_SERVER . ';Database='.VERTICA_DATABASE, VERTICA_USER_ETL, VERTICA_PASS_ETL);
                    if(!$this->_lnk) {
                        $this->log('CheckConnection: reconnect failed');
                        throw new Exception('Connection failed or gone away and can\'t reconnect - '.odbc_errormsg($this->_link), self::CONNECTION_FAILED);
                    }
                    $this->log('CheckConnection: reconnected!');
                    return;
                }
                throw new Exception('Connection failed or gone away - ' . odbc_errormsg($this->_link), self::CONNECTION_FAILED);
            }
        }
protected function checkConnection ( $ reconnect = false ) { if ( empty ( $ this -> _lnk ) ) { $ this -> log ( 'CheckConnection: link is not valid' ) ; if ( $ reconnect ) { $ this -> log ( 'CheckConnection: try to reconnect' ) ; $ this -> _lnk = @ odbc_connect ( 'Driver=' . VERTICA_DRIVER . ';Servername=' . VERTICA_SERVER . ';Database=' . VERTICA_DATABASE , VERTICA_USER_ETL , VERTICA_PASS_ETL ) ; if ( ! $ this -> _lnk ) { $ this -> log ( 'CheckConnection: reconnect failed' ) ; throw new Exception ( 'Connection failed or gone away and can\'t reconnect - ' . odbc_errormsg ( $ this -> _link ) , self :: CONNECTION_FAILED ) ; } $ this -> log ( 'CheckConnection: reconnected!' ) ; return ; } throw new Exception ( 'Connection failed or gone away - ' . odbc_errormsg ( $ this -> _link ) , self :: CONNECTION_FAILED ) ; } }
Check if the connection failed and try to reconnect if asked
@param bool $reconnect
@throws Exception
Check if the connection failed and try to reconnect if asked