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