#66674exec_SELECTgetRows does not return any rows
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”.