docker-php-extension-installer/scripts/tests/sqlsrv
2021-09-28 12:27:17 +02:00

28 lines
735 B
PHP
Executable File

#!/usr/bin/env php
<?php
require_once __DIR__ . '/_bootstrap.php';
sqlsrv_connect(
'localhost, 50000',
[
'Authentication' => 'SqlPassword',
'ConnectRetryCount' => 0,
'Database' => 'example',
'LoginTimeout' => 1, // string for PDO_SQLSRV
'UID' => 'userName', // not for PDO_SQLSRV
'PWD' => 'password',
]
);
$rc = 0;
$errors = sqlsrv_errors(SQLSRV_ERR_ALL);
if (is_array($errors)) {
foreach ($errors as $error) {
if (isset($error['message']) && stripos($error['message'], 'This extension requires the Microsoft ODBC Driver for SQL Server') !== false) {
fwrite(STDERR, trim($error['message']) . "\n");
$rc = 1;
}
}
}
exit($rc);