modified skipif and code based on review

This commit is contained in:
Jenny Tam 2017-08-29 12:52:01 -07:00
parent 58f2068479
commit d62d434cd0
4 changed files with 45 additions and 21 deletions

View file

@ -809,14 +809,13 @@ void load_configure_ksp( _Inout_ sqlsrv_conn* conn TSRMLS_DC )
char* ksp_name = Z_STRVAL_P( conn->ce_option.ksp_name );
char* ksp_path = Z_STRVAL_P( conn->ce_option.ksp_path );
unsigned int name_len = Z_STRLEN_P( conn->ce_option.ksp_name );
unsigned int path_len = Z_STRLEN_P( conn->ce_option.ksp_path );
unsigned int key_size = conn->ce_option.key_size;
sqlsrv_malloc_auto_ptr<unsigned char> ksp_data;
ksp_data = reinterpret_cast<unsigned char*>( sqlsrv_malloc( sizeof( CEKEYSTOREDATA ) + key_size ) );
CEKEYSTOREDATA *pKsd = (CEKEYSTOREDATA*) ksp_data.get();
CEKEYSTOREDATA *pKsd = reinterpret_cast<CEKEYSTOREDATA*>( ksp_data.get() );
pKsd->dataSize = key_size;

View file

@ -2434,10 +2434,8 @@ struct ce_ksp_provider_set_func {
static void func( _In_ connection_option const* option, _In_ zval* value, _Inout_ sqlsrv_conn* conn, _Inout_ std::string& conn_str TSRMLS_DC)
{
CHECK_CUSTOM_ERROR( Z_TYPE_P( value ) != IS_STRING, conn, SQLSRV_ERROR_INVALID_OPTION_TYPE_STRING, option->odbc_name ) {
throw core::CoreException();
}
SQLSRV_ASSERT( Z_TYPE_P( value ) == IS_STRING, "Wrong zval type for this keyword" )
size_t value_len = Z_STRLEN_P( value );
CHECK_CUSTOM_ERROR( value_len == 0, conn, SQLSRV_ERROR_KEYSTORE_INVALID_VALUE ) {

View file

@ -7,13 +7,25 @@ require_once( "MsSetup.inc" );
$conn = new PDO("sqlsrv:server = $server;", $uid, $pwd );
if( ! $conn )
{
die( "skip - could not connect during SKIPIF." );
echo ( "Error: could not connect during SKIPIF!" );
}
$attr = $conn->getAttribute(constant('PDO::ATTR_SERVER_VERSION'));
$version = substr($attr, 0, 2);
if ($version < 13)
else
{
die( "skip - feature not supported in this version of SQL Server." );
$attr = $conn->getAttribute(constant('PDO::ATTR_SERVER_VERSION'));
$version = substr($attr, 0, 2);
if ($version < 13)
{
// older than SQL Server 2016
die( "skip - feature not supported in this version of SQL Server." );
}
// check ODBC driver version
$attr = $conn->getAttribute(constant('PDO::ATTR_CLIENT_VERSION'));
$version = substr($attr['DriverVer'], 0, 2);
if ($version < 13)
{
// older than ODBC 13
die( "skip - feature not supported in this version of ODBC driver." );
}
}
?>

View file

@ -9,17 +9,32 @@ $connectionInfo = array( "UID"=>$userName, "PWD"=>$userPassword );
$conn = sqlsrv_connect( $server, $connectionInfo );
if( ! $conn )
{
die( "skip - could not connect during SKIPIF." );
echo ( "Error: 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)
else
{
$server_info = sqlsrv_server_info( $conn );
if( $server_info )
{
// check SQL Server version
$version = substr($server_info['SQLServerVersion'], 0, 2);
if ($version < 13)
{
// older than SQL Server 2016
die( "skip - feature not supported in this version of SQL Server." );
}
}
$client_info = sqlsrv_client_info( $conn );
if( $client_info )
{
die( "skip - feature not supported in this version of SQL Server." );
// check ODBC driver version
$version = substr($client_info['DriverVer'], 0, 2);
if ($version < 13)
{
// older than ODBC 13
die( "skip - feature not supported in this version of ODBC driver." );
}
}
}
?>