Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
<?php
private function query($query) {
...
...
$qlink = sqlsrv_query($this->connectionlink, $query);
if (!$qlink) {
$errNumber = $this->getErrorCode(); // получаем номер ошибки
// deadlock
if( $errNumber == 1205
&& ( ($this->deadlockRetryCount && $this->deadlockRetryCount >= $this->deadlockRepeatCount+1) || $this->deadlockRetryCount == -1)) {
$this->deadlockRepeatCount++; // число повторений
if($this->deadlock_retry_timeout) sleep($this->deadlock_retry_timeout); // ждем
return $this->query($query); // пробуем еще
} else {
// тут вызываем обработчик ошибок
}
}
return 0;
}
private function getErrorCode() {
$errNumber = 0;
$errors = sqlsrv_errors();
if(is_array($errors)) {
$lastError = end(array_keys($errors)); // берем последнюю ошибку
$err = (int)$errors[$lastError]['code'];
}
return $errNumber;
}
?>[Microsoft][Диспетчер драйверов ODBC] Источник данных не найден и не указан драйвер, используемый по умолчанию
[message] => The SQL Server Driver for PHP requires the SQL Server 2008 Native Client ODBC Driver (SP1 or later) to communicate with SQL Server. That ODBC Driver is not currently installed. Accessing the following URL will download the SQL Server 2008 Native Client ODBC driver for x86: go.microsoft.com/fwlink/?LinkId=137108
Сравнительный обзор Microsoft SQL Driver for PHP