config.inc 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // bug #72969 reflects a bug with FreeTDS, not with pdo_dblib
  3. // this function will version detect so the relevant tests can XFAILIF
  4. // assume this bug isn't present if not using FreeTDS
  5. // otherwise require FreeTDS>=1.1
  6. function driver_supports_batch_statements_without_select($db) {
  7. $version = $db->getAttribute(PDO::DBLIB_ATTR_VERSION);
  8. return !strstartswith($version, 'freetds ') || !strstartswith($version, 'freetds v1.0');
  9. }
  10. function strstartswith($haystack, $needle) {
  11. return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
  12. }
  13. if (false !== getenv('PDO_DBLIB_TEST_DSN')) {
  14. $dsn = getenv('PDO_DBLIB_TEST_DSN');
  15. } else {
  16. $dsn = 'dblib:host=localhost;dbname=test';
  17. }
  18. if (false !== getenv('PDO_DBLIB_TEST_USER')) {
  19. $user = getenv('PDO_DBLIB_TEST_USER');
  20. } else {
  21. $user = 'php';
  22. }
  23. if (false !== getenv('PDO_DBLIB_TEST_PASS')) {
  24. $pass = getenv('PDO_DBLIB_TEST_PASS');
  25. } else {
  26. $pass = 'password';
  27. }
  28. try {
  29. $db = new PDO($dsn, $user, $pass);
  30. $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  31. $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
  32. } catch (PDOException $e) {
  33. die('skip ' . $e->getMessage());
  34. }
  35. ?>