Project

General

Profile

Actions

Bug #66674

closed

exec_SELECTgetRows does not return any rows

Added by Xavier Perseguers about 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2015-04-30
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Using ADOdb with MSSQL native driver.

exec_SELECTgetRows() checks for sql_errors() and this method is overridden in DBAL:

    public function sql_error() {
        $output = '';
        switch ($this->handlerCfg[$this->lastHandlerKey]['type']) {
            case 'native':
                $output = $this->handlerInstance[$this->lastHandlerKey]['link']->error;
                break;
            case 'adodb':
                $output = $this->handlerInstance[$this->lastHandlerKey]->ErrorMsg();
                break;
            case 'userdefined':
                $output = $this->handlerInstance[$this->lastHandlerKey]->sql_error();
                break;
        }
        return $output;
    }

Problem is that ->ErrorMsg in ADOdb for mssql_native is defined as

    function ErrorMsg()
    {
        $retErrors = sqlsrv_errors(SQLSRV_ERR_ALL);
        if($retErrors != null) {
            foreach($retErrors as $arrError) {
                $this->_errorMsg .= "SQLState: ".$arrError[ 'SQLSTATE']."\n";
                $this->_errorMsg .= "Error Code: ".$arrError[ 'code']."\n";
                $this->_errorMsg .= "Message: ".$arrError[ 'message']."\n";
            }
        } else {
            $this->_errorMsg = "No errors found";
        }
        return $this->_errorMsg;
    }

It should return an empty string instead of "No errors found".

Actions

Also available in: Atom PDF