blob: 165f1d9330ace6f6a1819d1038fe00bbc9ce040c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<?php
// bug #72969 reflects a bug with FreeTDS, not with pdo_dblib
// this function will version detect so the relevant tests can XFAILIF
function driver_supports_batch_statements_without_select($db) {
$version = $db->getAttribute(PDO::DBLIB_ATTR_VERSION);
// assume driver doesn't have this bug if not using FreeTDS
if (!strstartswith($version, 'freetds ')) {
return true;
}
// hasn't made it to numbered release yet
if (!strstartswith($version, 'freetds v1.1.dev.')) {
return false;
}
// fc820490336c50d5c175d2a15327383256add4c9 was committed on the 5th
return intval(substr($version, -8)) >= 20161206;
}
function strstartswith($haystack, $needle) {
return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
}
if (false !== getenv('PDO_DBLIB_TEST_DSN')) {
$dsn = getenv('PDO_DBLIB_TEST_DSN');
} else {
$dsn = 'dblib:host=localhost;dbname=test';
}
if (false !== getenv('PDO_DBLIB_TEST_USER')) {
$user = getenv('PDO_DBLIB_TEST_USER');
} else {
$user = 'php';
}
if (false !== getenv('PDO_DBLIB_TEST_PASS')) {
$pass = getenv('PDO_DBLIB_TEST_PASS');
} else {
$pass = 'password';
}
try {
$db = new PDO($dsn, $user, $pass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
} catch (PDOException $e) {
die('skip ' . $e->getMessage());
}
?>
|