added checks for server version in the tests

This commit is contained in:
Jenny Tam 2017-08-24 10:55:27 -07:00
Родитель 8177786ddf
Коммит 0441af291c
6 изменённых файлов: 59 добавлений и 5 удалений

Просмотреть файл

@ -44,9 +44,20 @@ RUN pip install --upgrade pip && pip install cpp-coveralls
#Either Install git / download zip (One can see other strategies : https://ryanfb.github.io/etc/2015/07/29/git_strategies_for_docker.html )
#One option is to get source from zip file of repository.
<<<<<<< HEAD
#another option is to copy source to build directory on image
RUN mkdir -p $PHPSQLDIR
COPY . $PHPSQLDIR
=======
# another option is to copy source to build directory on image
RUN mkdir -p $PHPSQLDIR
COPY . $PHPSQLDIR
# copy odbc header file to setup
COPY $PHPSQLDIR/source/shared/msodbcsql.h $PHPSQLDIR/test/functional/setup
>>>>>>> 328286b... added checks for server version in the tests
WORKDIR $PHPSQLDIR/source/
RUN chmod +x ./packagize.sh

Просмотреть файл

@ -835,9 +835,8 @@ void load_configure_ksp( _Inout_ sqlsrv_conn* conn TSRMLS_DC )
char* encrypt_key = Z_STRVAL_P( conn->ce_option.ksp_encrypt_key );
memcpy_s( pKsd->data, key_size * sizeof( char ) , encrypt_key, key_size );
// Will uncomment these two lines when it's ready to test with a real custom keystore provider
// core::SQLSetConnectAttr( conn, SQL_COPT_SS_CEKEYSTOREPROVIDER, ksp_path, SQL_NTS );
// core::SQLSetConnectAttr( conn, SQL_COPT_SS_CEKEYSTOREDATA, reinterpret_cast<SQLPOINTER>( pKsd ), SQL_IS_POINTER );
core::SQLSetConnectAttr( conn, SQL_COPT_SS_CEKEYSTOREPROVIDER, ksp_path, SQL_NTS );
core::SQLSetConnectAttr( conn, SQL_COPT_SS_CEKEYSTOREDATA, reinterpret_cast<SQLPOINTER>( pKsd ), SQL_IS_POINTER );
}
void common_conn_str_append_func( const char* odbc_name, const char* val, size_t val_len, std::string& conn_str TSRMLS_DC )

Просмотреть файл

@ -1,7 +1,7 @@
--TEST--
Fetch data from a prepopulated test table given a custom keystore provider
--SKIPIF--
<?php require('skipif.inc'); ?>
<?php require('skipif_server_old.inc'); ?>
--FILE--
<?php
require( 'MsSetup.inc' );

Просмотреть файл

@ -0,0 +1,19 @@
<?php
if (!extension_loaded("pdo") || !extension_loaded('pdo_sqlsrv'))
die("PDO driver cannot be loaded; skipping test.\n");
require_once( "MsSetup.inc" );
$conn = new PDO("sqlsrv:server = $server;", $uid, $pwd );
if( ! $conn )
{
die( "skip - could not connect during SKIPIF." );
}
$attr = $conn->getAttribute(constant('PDO::ATTR_SERVER_VERSION'));
$version = substr($attr, 0, 2);
if ($version < 13)
{
die( "skip - feature not supported in this version of SQL Server." );
}
?>

Просмотреть файл

@ -0,0 +1,25 @@
<?php
if (!extension_loaded("sqlsrv"))
die("skip extension not loaded");
require_once( "MsSetup.inc" );
$connectionInfo = array( "UID"=>$userName, "PWD"=>$userPassword );
$conn = sqlsrv_connect( $server, $connectionInfo );
if( ! $conn )
{
die( "skip - could not connect during SKIPIF." );
}
$server_info = sqlsrv_server_info( $conn );
if( $server_info )
{
// check SQL Server version
$version = substr($server_info['SQLServerVersion'], 0, 2);
if ($version < 13)
{
die( "skip - feature not supported in this version of SQL Server." );
}
}
?>

Просмотреть файл

@ -1,7 +1,7 @@
--TEST--
Connect using a custom keystore provider with some required inputs missing
--SKIPIF--
<?php require('skipif.inc'); ?>
<?php require('skipif_server_old.inc'); ?>
--FILE--
<?php