]> granicus.if.org Git - php/commitdiff
Use TDS version attribute to determine whether to skip tests
authorAdam Baratz <adambaratz@php.net>
Fri, 10 Nov 2017 19:26:25 +0000 (14:26 -0500)
committerAdam Baratz <adambaratz@php.net>
Fri, 10 Nov 2017 19:36:35 +0000 (14:36 -0500)
ext/pdo_dblib/tests/config.inc
ext/pdo_dblib/tests/stringify_uniqueidentifier.phpt
ext/pdo_dblib/tests/types.phpt

index 40e8bf6ff9864d823273a2bc515b43a7f27a3986..2723090f08840b5390f14b52a5cbdf1a8db6ea9a 100644 (file)
@@ -1,21 +1,5 @@
 <?php
 
-function get_tds_version() {
-       global $dsn;
-
-       $dsn_parts = explode(':', $dsn, 2);
-       if ($dsn_parts[0] == 'dblib') { // uri is an option, which we'll ignore
-               foreach (explode(';', $dsn_parts[1]) as $arg) {
-                       $arg = explode('=', $arg);
-                       if ($arg[0] == 'version') {
-                               return $arg[1];
-                       }
-               }
-       }
-
-       return null;
-}
-
 // 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) {
index 02b28257dfe5c4144e10bab12303dcd4dce5dca5..627efed1686583d302a9ff87a568d3cc5bd357bf 100644 (file)
@@ -4,7 +4,7 @@ PDO_DBLIB: Uniqueidentifier column data type stringifying
 <?php
 if (!extension_loaded('pdo_dblib')) die('skip not loaded');
 require __DIR__ . '/config.inc';
-if (in_array(get_tds_version(), ['4.2', '4.6'])) die('skip feature unsupported by this TDS version');
+if (in_array($db->getAttribute(PDO::DBLIB_ATTR_TDS_VERSION), ['4.2', '4.6'])) die('skip feature unsupported by this TDS version');
 ?>
 --FILE--
 <?php
index 6f5d2f2e195cab622b0ee376f9b9d40c05b15dbe..a4d4fd39f78e0f3e8010296cbbc1605821a07ab2 100644 (file)
@@ -10,7 +10,9 @@ require __DIR__ . '/config.inc';
 require __DIR__ . '/config.inc';
 
 function get_expected_float_string() {
-       switch (get_tds_version()) {
+       global $db;
+
+       switch ($db->getAttribute(PDO::DBLIB_ATTR_TDS_VERSION)) {
                case '5.0':
                case '6.0':
                case '7.0':